mirror of
https://github.com/codex-storage/nim-codex-dht.git
synced 2025-01-24 19:00:42 +00:00
metrics: rename routing_table_nodes to discovery_routing_table_nodes
Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
This commit is contained in:
parent
6e180af4aa
commit
b7b04ed9e4
@ -14,7 +14,7 @@ import
|
|||||||
|
|
||||||
export options
|
export options
|
||||||
|
|
||||||
declarePublicGauge routing_table_nodes,
|
declarePublicGauge discovery_routing_table_nodes,
|
||||||
"Discovery routing table nodes", labels = ["state"]
|
"Discovery routing table nodes", labels = ["state"]
|
||||||
|
|
||||||
logScope:
|
logScope:
|
||||||
@ -208,14 +208,14 @@ proc ipLimitDec(r: var RoutingTable, b: KBucket, n: Node) =
|
|||||||
|
|
||||||
proc add(k: KBucket, n: Node) =
|
proc add(k: KBucket, n: Node) =
|
||||||
k.nodes.add(n)
|
k.nodes.add(n)
|
||||||
routing_table_nodes.inc()
|
discovery_routing_table_nodes.inc()
|
||||||
|
|
||||||
proc remove(k: KBucket, n: Node): bool =
|
proc remove(k: KBucket, n: Node): bool =
|
||||||
let i = k.nodes.find(n)
|
let i = k.nodes.find(n)
|
||||||
if i != -1:
|
if i != -1:
|
||||||
routing_table_nodes.dec()
|
discovery_routing_table_nodes.dec()
|
||||||
if k.nodes[i].seen:
|
if k.nodes[i].seen:
|
||||||
routing_table_nodes.dec(labelValues = ["seen"])
|
discovery_routing_table_nodes.dec(labelValues = ["seen"])
|
||||||
k.nodes.delete(i)
|
k.nodes.delete(i)
|
||||||
trace "removed node:", node = n
|
trace "removed node:", node = n
|
||||||
true
|
true
|
||||||
@ -527,7 +527,7 @@ proc setJustSeen*(r: RoutingTable, n: Node) =
|
|||||||
|
|
||||||
if not n.seen:
|
if not n.seen:
|
||||||
b.nodes[0].seen = true
|
b.nodes[0].seen = true
|
||||||
routing_table_nodes.inc(labelValues = ["seen"])
|
discovery_routing_table_nodes.inc(labelValues = ["seen"])
|
||||||
|
|
||||||
proc nodeToRevalidate*(r: RoutingTable): Node =
|
proc nodeToRevalidate*(r: RoutingTable): Node =
|
||||||
## Return a node to revalidate. The least recently seen node from a random
|
## Return a node to revalidate. The least recently seen node from a random
|
||||||
|
Loading…
x
Reference in New Issue
Block a user