From 04c5b9d5ef4723d469ea3472012787a8e2a5bdbd Mon Sep 17 00:00:00 2001 From: Jesper Jensen Date: Sat, 12 Apr 2025 09:35:32 +0200 Subject: Add prometheus monitoring --- src/routing.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/routing.c') diff --git a/src/routing.c b/src/routing.c index e2f436e..47dee12 100644 --- a/src/routing.c +++ b/src/routing.c @@ -1,6 +1,7 @@ #include "routing.h" #include "log.h" +#include "metrics.h" #include #include @@ -148,6 +149,7 @@ void routing_remove(struct nodeid* id) { struct entry* entry = routing_get(id); entry->set = false; + entry->expire = 0; } bool routing_interested(struct nodeid* id) { @@ -156,6 +158,7 @@ bool routing_interested(struct nodeid* id) { if(bucketIndex == RT_IDBITS) { return false; } + prom_histogram_observe(offered, bucketIndex, NULL); uint16_t baseIndex = base_bucket(id); int8_t inBucketIndex = scan(baseIndex, id); @@ -246,7 +249,6 @@ void routing_oldest(struct entry** dest) { for(struct entry* entry = pTable->table; entry < pTable->table+RT_SIZE; entry++){ if(!entry->set) - continue; if(entry->expire == 0) continue; -- cgit v1.2.3