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/metrics.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/metrics.c')
| -rw-r--r-- | src/metrics.c | 10 |
1 files changed, 10 insertions, 0 deletions
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", |
