From 95d03b842f6fdbfda19ed050131bc95ece13a171 Mon Sep 17 00:00:00 2001 From: Jesper Jensen Date: Mon, 14 Apr 2025 12:22:20 +0200 Subject: 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. --- src/peers.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/peers.c') 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); } -- cgit v1.2.3