From: Michael Tremer Date: Fri, 5 Jun 2026 15:10:06 +0000 (+0000) Subject: graphs: Extend implemention to check if a graph can be rendered X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=024ffe3be7255a18f8e03f54ce507f74399e057a;p=telemetry.git graphs: Extend implemention to check if a graph can be rendered Signed-off-by: Michael Tremer --- diff --git a/src/daemon/graph.c b/src/daemon/graph.c index 9d7001b..51caa46 100644 --- a/src/daemon/graph.c +++ b/src/daemon/graph.c @@ -336,6 +336,13 @@ int td_graph_render(td_graph* self, const char* object, if (!self->impl->render) return -ENOTSUP; + // Check if this can be rendered + if (self->impl->can_render) { + r = self->impl->can_render(self->ctx, self, options, object); + if (r < 0) + goto ERROR; + } + // Store the start time t_start = clock(); if (t_start < 0) { diff --git a/src/daemon/graph.h b/src/daemon/graph.h index 5890dc6..0a86d84 100644 --- a/src/daemon/graph.h +++ b/src/daemon/graph.h @@ -72,6 +72,10 @@ typedef struct td_graph_impl { // Available int (*available)(td_ctx* ctx, td_daemon* daemon); + // Can Render? + int (*can_render)(td_ctx* ctx, td_graph* graph, + const td_graph_render_options* options, const char* object); + // Render! int (*render)(td_ctx* ctx, td_graph* graph, const td_graph_render_options* options, td_args* args, const char* object);