summaryrefslogtreecommitdiff
path: root/src/metrics.c
diff options
context:
space:
mode:
authorJesper Jensen <jesper@jnsn.dev>2025-05-04 22:21:05 +0200
committerJesper Jensen <jesper@jnsn.dev>2025-05-04 22:21:05 +0200
commitc2075586084ece032e47adba2aacbc507adc2b26 (patch)
tree9fb789bef76c2ce889e1f5a5693315a9e5e72a5c /src/metrics.c
parent7de1bafcab547d03eff5323f2af3f4e92bd95a83 (diff)
Expose the hash table size as a metric
Diffstat (limited to 'src/metrics.c')
-rw-r--r--src/metrics.c10
1 files changed, 10 insertions, 0 deletions
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",