]> git.ipfire.org Git - telemetry.git/commitdiff
graphs: Create a new vlabel function for "Percent"
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 4 Dec 2025 17:51:17 +0000 (17:51 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 4 Dec 2025 17:51:17 +0000 (17:51 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/daemon/graph.c
src/daemon/graph.h
src/daemon/graphs/processor.c

index 4d9b008a7ccd5691c401379e7b068111b9e50a0c..5319d93f58eb426f2b19e2269049ee9525dbd333 100644 (file)
@@ -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"));
index cdc412326bdca475f66c90dd710a916a588470ae..2c126f0fed110fae64d990a8584c3dd16d5251db 100644 (file)
@@ -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);
 
index 2d8670762b525fb509953a9f19d2551ff22fa21d..74f90796f3dee87f6ab631b88f6905224d2aa981 100644 (file)
@@ -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,