]> git.ipfire.org Git - telemetry.git/commitdiff
source: Remove stepsize
authorMichael Tremer <michael.tremer@ipfire.org>
Mon, 6 Oct 2025 17:06:02 +0000 (17:06 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 6 Oct 2025 17:06:02 +0000 (17:06 +0000)
We can fetch this from the heartbeat which is easier to understand in
its function.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/daemon/source.c

index fd53b31de66ad74fdbd7ac7173e9ed435824bb58..04678dec18b2a839f69c8df729afce6efb11d43b 100644 (file)
 // 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();