diff options
| author | Jesper Jensen <jesper@jnsn.dev> | 2025-04-14 12:22:20 +0200 |
|---|---|---|
| committer | Jesper Jensen <jesper@jnsn.dev> | 2025-04-14 12:22:20 +0200 |
| commit | 95d03b842f6fdbfda19ed050131bc95ece13a171 (patch) | |
| tree | f3147d3ca5fe6c757960366e04768af398c99636 /src/peers.c | |
| parent | 6cce106232e05e5ef20a69eb1dc9a0c617fb9fa4 (diff) | |
Add current hash metric
It seems like it would be nice to know how many infohashes we actually
know about. Let's add a guage that tells us that directly.
Diffstat (limited to 'src/peers.c')
| -rw-r--r-- | src/peers.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/peers.c b/src/peers.c index 781bc7e..6d23fff 100644 --- a/src/peers.c +++ b/src/peers.c @@ -105,6 +105,7 @@ int add_peer(struct infohash* infohash, struct addr* peer, time_t now) { peer_status.peers++; prom_counter_inc(peers, NULL); + prom_gauge_set(current_hashes, (double)peer_table_load, NULL); return 0; } @@ -155,6 +156,9 @@ void expire_hashes(time_t now) { // Remove the slot entry->set = false; + peer_table_load--; prom_counter_inc(hash_expired, NULL); } + + prom_gauge_set(current_hashes, (double)peer_table_load, NULL); } |
