diff options
| author | Jesper Jensen <jesper@jnsn.dev> | 2025-04-12 09:35:32 +0200 |
|---|---|---|
| committer | Jesper Jensen <jesper@jnsn.dev> | 2025-04-12 10:21:20 +0200 |
| commit | 04c5b9d5ef4723d469ea3472012787a8e2a5bdbd (patch) | |
| tree | c9626a0cbc18e9d54fad639ac091121dc7d69713 /src/routing.c | |
| parent | cd622b745254baafa21adf4b1b724e079652321a (diff) | |
Add prometheus monitoring
Diffstat (limited to 'src/routing.c')
| -rw-r--r-- | src/routing.c | 4 |
1 files changed, 3 insertions, 1 deletions
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 <assert.h> #include <limits.h> @@ -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; |
