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/metrics.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/metrics.c') diff --git a/src/metrics.c b/src/metrics.c index 3a56837..7bac410 100644 --- a/src/metrics.c +++ b/src/metrics.c @@ -8,6 +8,7 @@ prom_counter_t *bytesSent = NULL; prom_counter_t *meta = NULL; prom_counter_t *peers = NULL; +prom_gauge_t *current_hashes = NULL; prom_counter_t *hashes = NULL; prom_counter_t *hash_expired = NULL; prom_counter_t *queries = NULL; @@ -110,6 +111,15 @@ void metric_init() { ) ); + current_hashes = prom_collector_registry_must_register_metric( + prom_gauge_new( + "dht_live_hashes_total", + "Number of hashes with active peers", + 0, + NULL + ) + ); + hashes = prom_collector_registry_must_register_metric( prom_counter_new( "dht_hashes_total", -- cgit v1.2.3