From c2075586084ece032e47adba2aacbc507adc2b26 Mon Sep 17 00:00:00 2001 From: Jesper Jensen Date: Sun, 4 May 2025 22:21:05 +0200 Subject: Expose the hash table size as a metric --- 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 eb50f09..c1113a7 100644 --- a/src/metrics.c +++ b/src/metrics.c @@ -10,6 +10,7 @@ prom_counter_t *meta = NULL; prom_counter_t *peers = NULL; prom_gauge_t *current_hashes = NULL; prom_counter_t *hashes = NULL; +prom_gauge_t *hashes_size = NULL; prom_counter_t *hash_expired = NULL; prom_gauge_t *hash_next_expire = NULL; prom_counter_t *queries = NULL; @@ -132,6 +133,15 @@ void metric_init() { ) ); + hashes_size = prom_collector_registry_must_register_metric( + prom_gauge_new( + "dht_hashes_size", + "InfoHash table capacity", + 0, + NULL + ) + ); + hash_expired = prom_collector_registry_must_register_metric( prom_counter_new( "dht_hashes_expired_total", -- cgit v1.2.3