From: Michael Tremer Date: Fri, 28 Nov 2025 12:38:58 +0000 (+0000) Subject: sources: unbound: Collect cache usage X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ba12783b6fd9ab71664806869821f814f841c7be;p=telemetry.git sources: unbound: Collect cache usage Signed-off-by: Michael Tremer --- diff --git a/src/daemon/sources/unbound.c b/src/daemon/sources/unbound.c index d9bb61f..093195e 100644 --- a/src/daemon/sources/unbound.c +++ b/src/daemon/sources/unbound.c @@ -33,6 +33,10 @@ static int unbound_on_success(td_ctx* ctx, unsigned long cachemiss = 0; unsigned long prefetch = 0; unsigned long queries = 0; + unsigned long msg_cache_count = 0; + unsigned long rrset_cache_count = 0; + unsigned long infra_cache_count = 0; + unsigned long key_cache_count = 0; double rec_time_median = 0; double rec_time_avg = 0; int r; @@ -43,8 +47,17 @@ static int unbound_on_success(td_ctx* ctx, PARSE1("total.num.cachemiss=%lu", &cachemiss), PARSE1("total.num.prefetch=%lu", &prefetch), PARSE1("total.num.recursivereplies=%lu", &rec_replies), + + // Recursion Performance PARSE1("total.recursion.time.avg=%lf", &rec_time_avg), PARSE1("total.recursion.time.median=%lf", &rec_time_median), + + // Cache Usage + PARSE1("msg.cache.count=%ld", &msg_cache_count), + PARSE1("rrset.cache.count=%ld", &rrset_cache_count), + PARSE1("infra.cache.count=%ld", &infra_cache_count), + PARSE1("key.cache.count=%ld", &key_cache_count), + { NULL }, }; @@ -60,8 +73,16 @@ static int unbound_on_success(td_ctx* ctx, VALUE_UINT64("cachemiss", &cachemiss), VALUE_UINT64("prefetch", &prefetch), VALUE_UINT64("rec_replies", &rec_replies), + + // Recursion Performance VALUE_FLOAT ("rec_time_avg", &rec_time_avg), - VALUE_FLOAT ("rec_time_median", &rec_time_median) + VALUE_FLOAT ("rec_time_median", &rec_time_median), + + // Cache Usage + VALUE_UINT64("cache_msg_objects", &msg_cache_count), + VALUE_UINT64("cache_rrset_objects", &rrset_cache_count), + VALUE_UINT64("cache_infra_objects", &infra_cache_count), + VALUE_UINT64("cache_key_objects", &key_cache_count) )); } @@ -84,8 +105,17 @@ const td_source_impl unbound_source = { { "cachemiss", "DERIVE", 0, -1, }, { "prefetch", "DERIVE", 0, -1, }, { "rec_replies", "DERIVE", 0, -1, }, + + // Recursion Performance { "rec_time_avg", "GAUGE", 0, -1, }, { "rec_time_median", "GAUGE", 0, -1, }, + + // Cache Usage + { "cache_msg_objects", "GAUGE", 0, -1 }, + { "cache_rrset_objects", "GAUGE", 0, -1 }, + { "cache_infra_objects", "GAUGE", 0, -1 }, + { "cache_key_objects", "GAUGE", 0, -1 }, + { NULL }, },