]> git.ipfire.org Git - telemetry.git/commitdiff
sources: unbound: Collect memory usage of the cache & modules
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 28 Nov 2025 13:27:06 +0000 (13:27 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 28 Nov 2025 13:27:06 +0000 (13:27 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/daemon/sources/unbound.c

index 093195e914f4189bd5da6e8fb3a5ffcfe6d427a2..33d2229187a876a4066ea94b26911407891c1dbc 100644 (file)
@@ -37,6 +37,11 @@ static int unbound_on_success(td_ctx* ctx,
        unsigned long rrset_cache_count = 0;
        unsigned long infra_cache_count = 0;
        unsigned long key_cache_count = 0;
+       unsigned long mem_cache_rrset = 0;
+       unsigned long mem_cache_message = 0;
+       unsigned long mem_mod_iterator = 0;
+       unsigned long mem_mod_validator = 0;
+       unsigned long mem_mod_respip = 0;
        double rec_time_median = 0;
        double rec_time_avg = 0;
        int r;
@@ -58,6 +63,15 @@ static int unbound_on_success(td_ctx* ctx,
                PARSE1("infra.cache.count=%ld", &infra_cache_count),
                PARSE1("key.cache.count=%ld", &key_cache_count),
 
+               // Cache Memory Usage
+               PARSE1("mem.cache.rrset=%ld", &mem_cache_rrset),
+               PARSE1("mem.cache.message=%ld", &mem_cache_message),
+
+               // Module Memory Usage
+               PARSE1("mem.mod.iterator=%ld", &mem_mod_iterator),
+               PARSE1("mem.mod.validator=%ld", &mem_mod_validator),
+               PARSE1("mem.mod.respip=%ld", &mem_mod_respip),
+
                { NULL },
        };
 
@@ -82,7 +96,16 @@ static int unbound_on_success(td_ctx* ctx,
                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)
+               VALUE_UINT64("cache_key_objects",   &key_cache_count),
+
+               // Cache Memory Usage
+               VALUE_UINT64("mem_cache_rrset",     &mem_cache_rrset),
+               VALUE_UINT64("mem_cache_message",   &mem_cache_message),
+
+               // Module Memory Usage
+               VALUE_UINT64("mem_mod_iterator",    &mem_mod_iterator),
+               VALUE_UINT64("mem_mod_validator",   &mem_mod_validator),
+               VALUE_UINT64("mem_mod_respip",      &mem_mod_respip)
        ));
 }
 
@@ -116,6 +139,15 @@ const td_source_impl unbound_source = {
                { "cache_infra_objects", "GAUGE", 0, -1 },
                { "cache_key_objects",   "GAUGE", 0, -1 },
 
+               // Cache Memory Usage
+               { "mem_cache_rrset",     "GAUGE", 0, -1 },
+               { "mem_cache_message",   "GAUGE", 0, -1 },
+
+               // Module Memory Usage
+               { "mem_mod_iterator",    "GAUGE", 0, -1 },
+               { "mem_mod_validator",   "GAUGE", 0, -1 },
+               { "mem_mod_respip",      "GAUGE", 0, -1 },
+
                { NULL },
        },