From: Michael Tremer Date: Mon, 6 Oct 2025 17:06:02 +0000 (+0000) Subject: source: Remove stepsize X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4f3356f7a91119fe1db2b76b5fd2c3dd9e927f3b;p=telemetry.git source: Remove stepsize We can fetch this from the heartbeat which is easier to understand in its function. Signed-off-by: Michael Tremer --- diff --git a/src/daemon/source.c b/src/daemon/source.c index fd53b31..04678de 100644 --- a/src/daemon/source.c +++ b/src/daemon/source.c @@ -43,10 +43,8 @@ // N seconds. #define STAGGER 60 -#define STEPSIZE 60 // seconds - // Interval after which the heartbeat function is being called again -#define HEARTBEAT SEC_TO_USEC(STEPSIZE) +#define HEARTBEAT SEC_TO_USEC(60) // XXX We need to check whether it is a good idea to hardcode this here #define XFF 0.1 @@ -512,8 +510,8 @@ static int collecty_source_create_database(collecty_source* self, const char* pa goto ERROR; // Add the DS line - r = collecty_args_push(args, "DS:%s:%s:%d:%s:%s", - ds->field, ds->type, STEPSIZE * 2, min, max); + r = collecty_args_push(args, "DS:%s:%s:%lu:%s:%s", + ds->field, ds->type, USEC_TO_SEC(HEARTBEAT), min, max); if (r < 0) goto ERROR; } @@ -538,7 +536,8 @@ static int collecty_source_create_database(collecty_source* self, const char* pa goto ERROR; // Create the RRD file - r = rrd_create_r(path, STEPSIZE, 0, collecty_args_argc(args), collecty_args_argv(args)); + r = rrd_create_r(path, USEC_TO_SEC(HEARTBEAT / 2), 0, + collecty_args_argc(args), collecty_args_argv(args)); if (r < 0) { ERROR(self->ctx, "Failed to create %s: %s\n", path, rrd_get_error()); rrd_clear_error();