From 5e3a9ae424ab69affe497e615110eff4d10fb90a Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Thu, 4 Dec 2025 17:51:17 +0000 Subject: [PATCH] graphs: Create a new vlabel function for "Percent" Signed-off-by: Michael Tremer --- src/daemon/graph.c | 5 +++++ src/daemon/graph.h | 3 +++ src/daemon/graphs/processor.c | 7 +------ 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/daemon/graph.c b/src/daemon/graph.c index 4d9b008..5319d93 100644 --- a/src/daemon/graph.c +++ b/src/daemon/graph.c @@ -577,6 +577,11 @@ int td_graph_vlabel_objects(td_ctx* ctx, td_graph* graph, return __td_string_set(vlabel, length, _("Objects")); } +int td_graph_vlabel_percent(td_ctx* ctx, td_graph* graph, + const td_graph_render_options* options, const char* object, char* vlabel, size_t length) { + return __td_string_set(vlabel, length, _("Percent")); +} + int td_graph_vlabel_pps(td_ctx* ctx, td_graph* graph, const td_graph_render_options* options, const char* object, char* vlabel, size_t length) { return __td_string_set(vlabel, length, _("Packets Per Second")); diff --git a/src/daemon/graph.h b/src/daemon/graph.h index cdc4123..2c126f0 100644 --- a/src/daemon/graph.h +++ b/src/daemon/graph.h @@ -129,6 +129,9 @@ int td_graph_vlabel_days(td_ctx* ctx, td_graph* graph, int td_graph_vlabel_objects(td_ctx* ctx, td_graph* graph, const td_graph_render_options* options, const char* object, char* vlabel, size_t length); +int td_graph_vlabel_percent(td_ctx* ctx, td_graph* graph, + const td_graph_render_options* options, const char* object, char* vlabel, size_t length); + int td_graph_vlabel_pps(td_ctx* ctx, td_graph* graph, const td_graph_render_options* options, const char* object, char* vlabel, size_t length); diff --git a/src/daemon/graphs/processor.c b/src/daemon/graphs/processor.c index 2d86707..74f9079 100644 --- a/src/daemon/graphs/processor.c +++ b/src/daemon/graphs/processor.c @@ -29,11 +29,6 @@ static int processor_title(td_ctx* ctx, td_graph* graph, return __td_string_set(title, length, _("Processor Usage")); } -static int processor_vlabel(td_ctx* ctx, td_graph* graph, - const td_graph_render_options* options, const char* object, char* vlabel, size_t length) { - return __td_string_set(vlabel, length, _("Percent")); -} - static int processor_render(td_ctx* ctx, td_graph* graph, const td_graph_render_options* options, td_args* args, const char* object) { int r; @@ -128,7 +123,7 @@ const td_graph_impl processor_graph = { .name = "Processor", .render = processor_render, .title = processor_title, - .vlabel = processor_vlabel, + .vlabel = td_graph_vlabel_percent, // Flags .flags = TELEMETRY_GRAPH_REVERSE, -- 2.47.3