From: Michael Tremer Date: Wed, 3 Dec 2025 13:27:32 +0000 (+0000) Subject: graphs: Split the Unbound graphs into multiple files X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b7d4c2ec40f2dfec35340f4edf4cbffb49914f82;p=collecty.git graphs: Split the Unbound graphs into multiple files Signed-off-by: Michael Tremer --- diff --git a/Makefile.am b/Makefile.am index 21933db..2a2601e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -140,8 +140,14 @@ dist_telemetryd_SOURCES = \ src/daemon/graphs/pressure.h \ src/daemon/graphs/processor.c \ src/daemon/graphs/processor.h \ - src/daemon/graphs/unbound.c \ - src/daemon/graphs/unbound.h \ + src/daemon/graphs/unbound-cache-performance.c \ + src/daemon/graphs/unbound-cache-performance.h \ + src/daemon/graphs/unbound-cache-usage.c \ + src/daemon/graphs/unbound-cache-usage.h \ + src/daemon/graphs/unbound-memory-usage.c \ + src/daemon/graphs/unbound-memory-usage.h \ + src/daemon/graphs/unbound-recursion-time.c \ + src/daemon/graphs/unbound-recursion-time.h \ src/daemon/graphs/uptime.c \ src/daemon/graphs/uptime.h \ src/daemon/i18n.h \ diff --git a/po/POTFILES.in b/po/POTFILES.in index d230ee2..f6a266b 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -49,8 +49,14 @@ src/daemon/graphs/pressure.c src/daemon/graphs/pressure.h src/daemon/graphs/processor.c src/daemon/graphs/processor.h -src/daemon/graphs/unbound.c -src/daemon/graphs/unbound.h +src/daemon/graphs/unbound-cache-performance.c +src/daemon/graphs/unbound-cache-performance.h +src/daemon/graphs/unbound-cache-usage.c +src/daemon/graphs/unbound-cache-usage.h +src/daemon/graphs/unbound-memory-usage.c +src/daemon/graphs/unbound-memory-usage.h +src/daemon/graphs/unbound-recursion-time.c +src/daemon/graphs/unbound-recursion-time.h src/daemon/graphs/uptime.c src/daemon/graphs/uptime.h src/daemon/i18n.h @@ -83,8 +89,8 @@ src/daemon/sources/disk.h src/daemon/sources.h src/daemon/sources/hostapd.c src/daemon/sources/hostapd.h -src/daemon/sources/interfaces.c -src/daemon/sources/interfaces.h +src/daemon/sources/interface.c +src/daemon/sources/interface.h src/daemon/sources/ipfrag4.c src/daemon/sources/ipfrag4.h src/daemon/sources/iptables.c diff --git a/po/telemetry.pot b/po/telemetry.pot index eede036..10a3336 100644 --- a/po/telemetry.pot +++ b/po/telemetry.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-11-29 12:36+0000\n" +"POT-Creation-Date: 2025-12-03 13:27+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -151,6 +151,10 @@ msgstr "" msgid "Last ACK Signal" msgstr "" +#, c-format +msgid "Throughput - %s" +msgstr "" + msgid "Latency to the Default Gateway" msgstr "" diff --git a/src/daemon/graphs.c b/src/daemon/graphs.c index 3ca2b54..5d4901e 100644 --- a/src/daemon/graphs.c +++ b/src/daemon/graphs.c @@ -40,7 +40,10 @@ #include "graphs/memory.h" #include "graphs/pressure.h" #include "graphs/processor.h" -#include "graphs/unbound.h" +#include "graphs/unbound-cache-performance.h" +#include "graphs/unbound-cache-usage.h" +#include "graphs/unbound-memory-usage.h" +#include "graphs/unbound-recursion-time.h" #include "graphs/uptime.h" // Legacy graphs diff --git a/src/daemon/graphs/unbound-cache-performance.c b/src/daemon/graphs/unbound-cache-performance.c new file mode 100644 index 0000000..b0bf55f --- /dev/null +++ b/src/daemon/graphs/unbound-cache-performance.c @@ -0,0 +1,78 @@ +/*############################################################################# +# # +# telemetryd - The IPFire Telemetry Collection Service # +# Copyright (C) 2025 IPFire Development Team # +# # +# This program is free software: you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation, either version 3 of the License, or # +# (at your option) any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program. If not, see . # +# # +#############################################################################*/ + +#include + +#include "graph.h" +#include "unbound-cache-performance.h" + +static int unbound_cache_performance_title(td_ctx* ctx, td_graph* graph, + const char* object, char* title, size_t length) { + return __td_string_set(title, length, _("DNS Cache Performance")); +} + +static int unbound_cache_performance_render(td_ctx* ctx, td_graph* graph, + const td_graph_render_options* options, td_args* args, const char* object) { + int r; + + // Load all sources + r = td_graph_require_source(graph, args, "unbound", NULL); + if (r < 0) + return r; + + // Header + PRINT_HEADER4(args, _("Current"), _("Average"), _("Minimum"), _("Maximum")); + + // Show the total queries + PRINT_LABEL(args, _("Total")); + PRINT_CAMM(args, "queries", NULL, QPS); + + PRINT_EMPTY_LINE(args); + + // Draw the stacked background first + DRAW_AREA_BACKGROUND(args, "cachehits", NULL, COLOR_CACHE_HIT, 0); + DRAW_AREA_BACKGROUND(args, "cachemiss", NULL, COLOR_CACHE_MISS, STACKED); + + // Draw the area outlines afterwards + DRAW_AREA_OUTLINE_WITH_LABEL(args, "cachehits", NULL, + COLOR_CACHE_HIT, 0, _("Cache Hits")); + PRINT_CAMM(args, "cachehits", NULL, QPS); + + DRAW_AREA_OUTLINE_WITH_LABEL(args, "cachemiss", NULL, + COLOR_CACHE_MISS, STACKED, _("Cache Miss")); + PRINT_CAMM(args, "cachemiss", NULL, QPS); + + DRAW_LINE_WITH_LABEL(args, 1, "prefetch", NULL, + COLOR_CACHE_PREFETCH, 0, _("Prefetched Queries")); + PRINT_CAMM(args, "prefetch", NULL, QPS); + + return 0; +} + +const td_graph_impl unbound_cache_performance_graph = { + .name = "UnboundCachePerformance", + .render = unbound_cache_performance_render, + .title = unbound_cache_performance_title, + .vlabel = td_graph_vlabel_qps, + + // Limits + .lower_limit = 0, + .upper_limit = LONG_MAX, +}; diff --git a/src/daemon/graphs/unbound.h b/src/daemon/graphs/unbound-cache-performance.h similarity index 85% rename from src/daemon/graphs/unbound.h rename to src/daemon/graphs/unbound-cache-performance.h index 41cdc41..5452e3e 100644 --- a/src/daemon/graphs/unbound.h +++ b/src/daemon/graphs/unbound-cache-performance.h @@ -18,14 +18,11 @@ # # #############################################################################*/ -#ifndef TELEMETRY_GRAPH_UNBOUND_H -#define TELEMETRY_GRAPH_UNBOUND_H +#ifndef TELEMETRY_GRAPH_UNBOUND_CACHE_PERFORMANCE_H +#define TELEMETRY_GRAPH_UNBOUND_CACHE_PERFORMANCE_H #include "../graph.h" extern const td_graph_impl unbound_cache_performance_graph; -extern const td_graph_impl unbound_cache_usage_graph; -extern const td_graph_impl unbound_memory_usage_graph; -extern const td_graph_impl unbound_recursion_time_graph; -#endif /* TELEMETRY_GRAPH_UNBOUND_H */ +#endif /* TELEMETRY_GRAPH_UNBOUND_CACHE_PERFORMANCE_H */ diff --git a/src/daemon/graphs/unbound-cache-usage.c b/src/daemon/graphs/unbound-cache-usage.c new file mode 100644 index 0000000..1fcebbf --- /dev/null +++ b/src/daemon/graphs/unbound-cache-usage.c @@ -0,0 +1,83 @@ +/*############################################################################# +# # +# telemetryd - The IPFire Telemetry Collection Service # +# Copyright (C) 2025 IPFire Development Team # +# # +# This program is free software: you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation, either version 3 of the License, or # +# (at your option) any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program. If not, see . # +# # +#############################################################################*/ + +#include + +#include "graph.h" +#include "unbound-cache-usage.h" + +static int unbound_cache_usage_title(td_ctx* ctx, td_graph* graph, + const char* object, char* title, size_t length) { + return __td_string_set(title, length, _("DNS Cache Usage")); +} + +static int unbound_cache_usage_render(td_ctx* ctx, td_graph* graph, + const td_graph_render_options* options, td_args* args, const char* object) { + int r; + + // Load all sources + r = td_graph_require_source(graph, args, "unbound", NULL); + if (r < 0) + return r; + + // Draw the stacked background first + DRAW_AREA_BACKGROUND(args, "cache_key_objects", NULL, COLOR_DNS_KEYS, 0); + DRAW_AREA_BACKGROUND(args, "cache_infra_objects", NULL, COLOR_DNS_INFRA, STACKED); + DRAW_AREA_BACKGROUND(args, "cache_rrset_objects", NULL, COLOR_DNS_RRSETS, STACKED); + DRAW_AREA_BACKGROUND(args, "cache_msg_objects", NULL, COLOR_DNS_MSGS, STACKED); + + // Draw the area outlines afterwards + DRAW_AREA_OUTLINE_WITH_LABEL(args, "cache_key_objects", NULL, + COLOR_DNS_KEYS, 0, _("Key Objects")); + PRINT_CAMM(args, "cache_key_objects", NULL, LARGE_INTEGER); + + DRAW_AREA_OUTLINE_WITH_LABEL(args, "cache_infra_objects", NULL, + COLOR_DNS_INFRA, STACKED, _("Infrastructure Objects")); + PRINT_CAMM(args, "cache_infra_objects", NULL, LARGE_INTEGER); + + DRAW_AREA_OUTLINE_WITH_LABEL(args, "cache_rrset_objects", NULL, + COLOR_DNS_RRSETS, STACKED, _("RRSet Objects")); + PRINT_CAMM(args, "cache_rrset_objects", NULL, LARGE_INTEGER); + + DRAW_AREA_OUTLINE_WITH_LABEL(args, "cache_msg_objects", NULL, + COLOR_DNS_MSGS, STACKED, _("Message Objects")); + PRINT_CAMM(args, "cache_msg_objects", NULL, LARGE_INTEGER); + + PRINT_EMPTY_LINE(args); + + // Header + PRINT_HEADER4(args, _("Current"), _("Average"), _("Minimum"), _("Maximum")); + + return 0; +} + +const td_graph_impl unbound_cache_usage_graph = { + .name = "UnboundCacheUsage", + .render = unbound_cache_usage_render, + .title = unbound_cache_usage_title, + .vlabel = td_graph_vlabel_objects, + + // Flags + .flags = TELEMETRY_GRAPH_REVERSE, + + // Limits + .lower_limit = 0, + .upper_limit = LONG_MAX, +}; diff --git a/src/daemon/graphs/unbound-cache-usage.h b/src/daemon/graphs/unbound-cache-usage.h new file mode 100644 index 0000000..fbbc8ea --- /dev/null +++ b/src/daemon/graphs/unbound-cache-usage.h @@ -0,0 +1,28 @@ +/*############################################################################# +# # +# telemetryd - The IPFire Telemetry Collection Service # +# Copyright (C) 2025 IPFire Development Team # +# # +# This program is free software: you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation, either version 3 of the License, or # +# (at your option) any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program. If not, see . # +# # +#############################################################################*/ + +#ifndef TELEMETRY_GRAPH_UNBOUND_CACHE_USAGE_H +#define TELEMETRY_GRAPH_UNBOUND_CACHE_USAGE_H + +#include "../graph.h" + +extern const td_graph_impl unbound_cache_usage_graph; + +#endif /* TELEMETRY_GRAPH_UNBOUND_CACHE_USAGE_H */ diff --git a/src/daemon/graphs/unbound-memory-usage.c b/src/daemon/graphs/unbound-memory-usage.c new file mode 100644 index 0000000..7b32c40 --- /dev/null +++ b/src/daemon/graphs/unbound-memory-usage.c @@ -0,0 +1,88 @@ +/*############################################################################# +# # +# telemetryd - The IPFire Telemetry Collection Service # +# Copyright (C) 2025 IPFire Development Team # +# # +# This program is free software: you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation, either version 3 of the License, or # +# (at your option) any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program. If not, see . # +# # +#############################################################################*/ + +#include + +#include "graph.h" +#include "unbound-memory-usage.h" + +static int unbound_memory_usage_title(td_ctx* ctx, td_graph* graph, + const char* object, char* title, size_t length) { + return __td_string_set(title, length, _("DNS Memory Usage")); +} + +static int unbound_memory_usage_render(td_ctx* ctx, td_graph* graph, + const td_graph_render_options* options, td_args* args, const char* object) { + int r; + + // Load all sources + r = td_graph_require_source(graph, args, "unbound", NULL); + if (r < 0) + return r; + + // Draw the stacked background first + DRAW_AREA_BACKGROUND(args, "mem_mod_respip", NULL, COLOR_DNS_RPZ, 0); + DRAW_AREA_BACKGROUND(args, "mem_mod_validator", NULL, COLOR_DNS_VALIDATOR, STACKED); + DRAW_AREA_BACKGROUND(args, "mem_mod_iterator", NULL, COLOR_DNS_ITERATOR, STACKED); + DRAW_AREA_BACKGROUND(args, "mem_cache_rrset", NULL, COLOR_DNS_RRSETS, STACKED); + DRAW_AREA_BACKGROUND(args, "mem_cache_message", NULL, COLOR_DNS_MSGS, STACKED); + + // Draw the area outlines afterwards + DRAW_AREA_OUTLINE_WITH_LABEL(args, "mem_mod_respip", NULL, + COLOR_DNS_RPZ, 0, _("Request Policy Zones")); + PRINT_CAMM(args, "mem_mod_respip", NULL, BYTES); + + DRAW_AREA_OUTLINE_WITH_LABEL(args, "mem_mod_validator", NULL, + COLOR_DNS_VALIDATOR, STACKED, _("Validator")); + PRINT_CAMM(args, "mem_mod_validator", NULL, BYTES); + + DRAW_AREA_OUTLINE_WITH_LABEL(args, "mem_mod_iterator", NULL, + COLOR_DNS_ITERATOR, STACKED, _("Iterator")); + PRINT_CAMM(args, "mem_mod_iterator", NULL, BYTES); + + DRAW_AREA_OUTLINE_WITH_LABEL(args, "mem_cache_rrset", NULL, + COLOR_DNS_RRSETS, STACKED, _("RRSet Objects")); + PRINT_CAMM(args, "mem_cache_rrset", NULL, BYTES); + + DRAW_AREA_OUTLINE_WITH_LABEL(args, "mem_cache_message", NULL, + COLOR_DNS_MSGS, STACKED, _("Message Objects")); + PRINT_CAMM(args, "mem_cache_message", NULL, BYTES); + + PRINT_EMPTY_LINE(args); + + // Header + PRINT_HEADER4(args, _("Current"), _("Average"), _("Minimum"), _("Maximum")); + + return 0; +} + +const td_graph_impl unbound_memory_usage_graph = { + .name = "UnboundMemoryUsage", + .render = unbound_memory_usage_render, + .title = unbound_memory_usage_title, + .vlabel = td_graph_vlabel_bytes, + + // Flags + .flags = TELEMETRY_GRAPH_REVERSE, + + // Limits + .lower_limit = 0, + .upper_limit = LONG_MAX, +}; diff --git a/src/daemon/graphs/unbound-memory-usage.h b/src/daemon/graphs/unbound-memory-usage.h new file mode 100644 index 0000000..1010b03 --- /dev/null +++ b/src/daemon/graphs/unbound-memory-usage.h @@ -0,0 +1,28 @@ +/*############################################################################# +# # +# telemetryd - The IPFire Telemetry Collection Service # +# Copyright (C) 2025 IPFire Development Team # +# # +# This program is free software: you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation, either version 3 of the License, or # +# (at your option) any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program. If not, see . # +# # +#############################################################################*/ + +#ifndef TELEMETRY_GRAPH_UNBOUND_MEMORY_USAGE_H +#define TELEMETRY_GRAPH_UNBOUND_MEMORY_USAGE_H + +#include "../graph.h" + +extern const td_graph_impl unbound_memory_usage_graph; + +#endif /* TELEMETRY_GRAPH_UNBOUND_MEMORY_USAGE_H */ diff --git a/src/daemon/graphs/unbound-recursion-time.c b/src/daemon/graphs/unbound-recursion-time.c new file mode 100644 index 0000000..cf9671a --- /dev/null +++ b/src/daemon/graphs/unbound-recursion-time.c @@ -0,0 +1,59 @@ +/*############################################################################# +# # +# telemetryd - The IPFire Telemetry Collection Service # +# Copyright (C) 2025 IPFire Development Team # +# # +# This program is free software: you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation, either version 3 of the License, or # +# (at your option) any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program. If not, see . # +# # +#############################################################################*/ + +#include + +#include "graph.h" +#include "unbound-recursion-time.h" + +static int unbound_recursion_time_title(td_ctx* ctx, td_graph* graph, + const char* object, char* title, size_t length) { + return __td_string_set(title, length, _("DNS Recursion Time")); +} + +static int unbound_recursion_time_render(td_ctx* ctx, td_graph* graph, + const td_graph_render_options* options, td_args* args, const char* object) { + int r; + + // Load all sources + r = td_graph_require_source(graph, args, "unbound", NULL); + if (r < 0) + return r; + + // Header + PRINT_HEADER4(args, _("Current"), _("Average"), _("Minimum"), _("Maximum")); + + // Draw the average + DRAW_LINE_WITH_LABEL(args, 1, "rec_time_avg", NULL, COLOR_DEFAULT, 0, _("Recursion Time")); + PRINT_CAMM(args, "rec_time_avg", NULL, SECONDS_HIGHRES); + + return 0; +} + +const td_graph_impl unbound_recursion_time_graph = { + .name = "UnboundRecursionTime", + .render = unbound_recursion_time_render, + .title = unbound_recursion_time_title, + .vlabel = td_graph_vlabel_seconds, + + // Limits + .lower_limit = 0, + .upper_limit = LONG_MAX, +}; diff --git a/src/daemon/graphs/unbound-recursion-time.h b/src/daemon/graphs/unbound-recursion-time.h new file mode 100644 index 0000000..866f03e --- /dev/null +++ b/src/daemon/graphs/unbound-recursion-time.h @@ -0,0 +1,28 @@ +/*############################################################################# +# # +# telemetryd - The IPFire Telemetry Collection Service # +# Copyright (C) 2025 IPFire Development Team # +# # +# This program is free software: you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation, either version 3 of the License, or # +# (at your option) any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program. If not, see . # +# # +#############################################################################*/ + +#ifndef TELEMETRY_GRAPH_UNBOUND_RECURSION_TIME_H +#define TELEMETRY_GRAPH_UNBOUND_RECURSION_TIME_H + +#include "../graph.h" + +extern const td_graph_impl unbound_recursion_time_graph; + +#endif /* TELEMETRY_GRAPH_UNBOUND_RECURSION_TIME_H */ diff --git a/src/daemon/graphs/unbound.c b/src/daemon/graphs/unbound.c deleted file mode 100644 index ba12feb..0000000 --- a/src/daemon/graphs/unbound.c +++ /dev/null @@ -1,236 +0,0 @@ -/*############################################################################# -# # -# telemetryd - The IPFire Telemetry Collection Service # -# Copyright (C) 2025 IPFire Development Team # -# # -# This program is free software: you can redistribute it and/or modify # -# it under the terms of the GNU General Public License as published by # -# the Free Software Foundation, either version 3 of the License, or # -# (at your option) any later version. # -# # -# This program is distributed in the hope that it will be useful, # -# but WITHOUT ANY WARRANTY; without even the implied warranty of # -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # -# GNU General Public License for more details. # -# # -# You should have received a copy of the GNU General Public License # -# along with this program. If not, see . # -# # -#############################################################################*/ - -#include - -#include "graph.h" -#include "unbound.h" - -static int unbound_cache_performance_title(td_ctx* ctx, td_graph* graph, - const char* object, char* title, size_t length) { - return __td_string_set(title, length, _("DNS Cache Performance")); -} - -static int unbound_cache_performance_render(td_ctx* ctx, td_graph* graph, - const td_graph_render_options* options, td_args* args, const char* object) { - int r; - - // Load all sources - r = td_graph_require_source(graph, args, "unbound", NULL); - if (r < 0) - return r; - - // Header - PRINT_HEADER4(args, _("Current"), _("Average"), _("Minimum"), _("Maximum")); - - // Show the total queries - PRINT_LABEL(args, _("Total")); - PRINT_CAMM(args, "queries", NULL, QPS); - - PRINT_EMPTY_LINE(args); - - // Draw the stacked background first - DRAW_AREA_BACKGROUND(args, "cachehits", NULL, COLOR_CACHE_HIT, 0); - DRAW_AREA_BACKGROUND(args, "cachemiss", NULL, COLOR_CACHE_MISS, STACKED); - - // Draw the area outlines afterwards - DRAW_AREA_OUTLINE_WITH_LABEL(args, "cachehits", NULL, - COLOR_CACHE_HIT, 0, _("Cache Hits")); - PRINT_CAMM(args, "cachehits", NULL, QPS); - - DRAW_AREA_OUTLINE_WITH_LABEL(args, "cachemiss", NULL, - COLOR_CACHE_MISS, STACKED, _("Cache Miss")); - PRINT_CAMM(args, "cachemiss", NULL, QPS); - - DRAW_LINE_WITH_LABEL(args, 1, "prefetch", NULL, - COLOR_CACHE_PREFETCH, 0, _("Prefetched Queries")); - PRINT_CAMM(args, "prefetch", NULL, QPS); - - return 0; -} - -const td_graph_impl unbound_cache_performance_graph = { - .name = "UnboundCachePerformance", - .render = unbound_cache_performance_render, - .title = unbound_cache_performance_title, - .vlabel = td_graph_vlabel_qps, - - // Limits - .lower_limit = 0, - .upper_limit = LONG_MAX, -}; - -static int unbound_cache_usage_title(td_ctx* ctx, td_graph* graph, - const char* object, char* title, size_t length) { - return __td_string_set(title, length, _("DNS Cache Usage")); -} - -static int unbound_cache_usage_render(td_ctx* ctx, td_graph* graph, - const td_graph_render_options* options, td_args* args, const char* object) { - int r; - - // Load all sources - r = td_graph_require_source(graph, args, "unbound", NULL); - if (r < 0) - return r; - - // Draw the stacked background first - DRAW_AREA_BACKGROUND(args, "cache_key_objects", NULL, COLOR_DNS_KEYS, 0); - DRAW_AREA_BACKGROUND(args, "cache_infra_objects", NULL, COLOR_DNS_INFRA, STACKED); - DRAW_AREA_BACKGROUND(args, "cache_rrset_objects", NULL, COLOR_DNS_RRSETS, STACKED); - DRAW_AREA_BACKGROUND(args, "cache_msg_objects", NULL, COLOR_DNS_MSGS, STACKED); - - // Draw the area outlines afterwards - DRAW_AREA_OUTLINE_WITH_LABEL(args, "cache_key_objects", NULL, - COLOR_DNS_KEYS, 0, _("Key Objects")); - PRINT_CAMM(args, "cache_key_objects", NULL, LARGE_INTEGER); - - DRAW_AREA_OUTLINE_WITH_LABEL(args, "cache_infra_objects", NULL, - COLOR_DNS_INFRA, STACKED, _("Infrastructure Objects")); - PRINT_CAMM(args, "cache_infra_objects", NULL, LARGE_INTEGER); - - DRAW_AREA_OUTLINE_WITH_LABEL(args, "cache_rrset_objects", NULL, - COLOR_DNS_RRSETS, STACKED, _("RRSet Objects")); - PRINT_CAMM(args, "cache_rrset_objects", NULL, LARGE_INTEGER); - - DRAW_AREA_OUTLINE_WITH_LABEL(args, "cache_msg_objects", NULL, - COLOR_DNS_MSGS, STACKED, _("Message Objects")); - PRINT_CAMM(args, "cache_msg_objects", NULL, LARGE_INTEGER); - - PRINT_EMPTY_LINE(args); - - // Header - PRINT_HEADER4(args, _("Current"), _("Average"), _("Minimum"), _("Maximum")); - - return 0; -} - -const td_graph_impl unbound_cache_usage_graph = { - .name = "UnboundCacheUsage", - .render = unbound_cache_usage_render, - .title = unbound_cache_usage_title, - .vlabel = td_graph_vlabel_objects, - - // Flags - .flags = TELEMETRY_GRAPH_REVERSE, - - // Limits - .lower_limit = 0, - .upper_limit = LONG_MAX, -}; - -static int unbound_memory_usage_title(td_ctx* ctx, td_graph* graph, - const char* object, char* title, size_t length) { - return __td_string_set(title, length, _("DNS Memory Usage")); -} - -static int unbound_memory_usage_render(td_ctx* ctx, td_graph* graph, - const td_graph_render_options* options, td_args* args, const char* object) { - int r; - - // Load all sources - r = td_graph_require_source(graph, args, "unbound", NULL); - if (r < 0) - return r; - - // Draw the stacked background first - DRAW_AREA_BACKGROUND(args, "mem_mod_respip", NULL, COLOR_DNS_RPZ, 0); - DRAW_AREA_BACKGROUND(args, "mem_mod_validator", NULL, COLOR_DNS_VALIDATOR, STACKED); - DRAW_AREA_BACKGROUND(args, "mem_mod_iterator", NULL, COLOR_DNS_ITERATOR, STACKED); - DRAW_AREA_BACKGROUND(args, "mem_cache_rrset", NULL, COLOR_DNS_RRSETS, STACKED); - DRAW_AREA_BACKGROUND(args, "mem_cache_message", NULL, COLOR_DNS_MSGS, STACKED); - - // Draw the area outlines afterwards - DRAW_AREA_OUTLINE_WITH_LABEL(args, "mem_mod_respip", NULL, - COLOR_DNS_RPZ, 0, _("Request Policy Zones")); - PRINT_CAMM(args, "mem_mod_respip", NULL, BYTES); - - DRAW_AREA_OUTLINE_WITH_LABEL(args, "mem_mod_validator", NULL, - COLOR_DNS_VALIDATOR, STACKED, _("Validator")); - PRINT_CAMM(args, "mem_mod_validator", NULL, BYTES); - - DRAW_AREA_OUTLINE_WITH_LABEL(args, "mem_mod_iterator", NULL, - COLOR_DNS_ITERATOR, STACKED, _("Iterator")); - PRINT_CAMM(args, "mem_mod_iterator", NULL, BYTES); - - DRAW_AREA_OUTLINE_WITH_LABEL(args, "mem_cache_rrset", NULL, - COLOR_DNS_RRSETS, STACKED, _("RRSet Objects")); - PRINT_CAMM(args, "mem_cache_rrset", NULL, BYTES); - - DRAW_AREA_OUTLINE_WITH_LABEL(args, "mem_cache_message", NULL, - COLOR_DNS_MSGS, STACKED, _("Message Objects")); - PRINT_CAMM(args, "mem_cache_message", NULL, BYTES); - - PRINT_EMPTY_LINE(args); - - // Header - PRINT_HEADER4(args, _("Current"), _("Average"), _("Minimum"), _("Maximum")); - - return 0; -} - -const td_graph_impl unbound_memory_usage_graph = { - .name = "UnboundMemoryUsage", - .render = unbound_memory_usage_render, - .title = unbound_memory_usage_title, - .vlabel = td_graph_vlabel_bytes, - - // Flags - .flags = TELEMETRY_GRAPH_REVERSE, - - // Limits - .lower_limit = 0, - .upper_limit = LONG_MAX, -}; - -static int unbound_recursion_time_title(td_ctx* ctx, td_graph* graph, - const char* object, char* title, size_t length) { - return __td_string_set(title, length, _("DNS Recursion Time")); -} - -static int unbound_recursion_time_render(td_ctx* ctx, td_graph* graph, - const td_graph_render_options* options, td_args* args, const char* object) { - int r; - - // Load all sources - r = td_graph_require_source(graph, args, "unbound", NULL); - if (r < 0) - return r; - - // Header - PRINT_HEADER4(args, _("Current"), _("Average"), _("Minimum"), _("Maximum")); - - // Draw the average - DRAW_LINE_WITH_LABEL(args, 1, "rec_time_avg", NULL, COLOR_DEFAULT, 0, _("Recursion Time")); - PRINT_CAMM(args, "rec_time_avg", NULL, SECONDS_HIGHRES); - - return 0; -} - -const td_graph_impl unbound_recursion_time_graph = { - .name = "UnboundRecursionTime", - .render = unbound_recursion_time_render, - .title = unbound_recursion_time_title, - .vlabel = td_graph_vlabel_seconds, - - // Limits - .lower_limit = 0, - .upper_limit = LONG_MAX, -};