]> git.ipfire.org Git - collecty.git/commitdiff
metrics: Allow to push multiple values
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 29 May 2026 11:09:31 +0000 (11:09 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 29 May 2026 11:09:31 +0000 (11:09 +0000)
We will just sum the data because there are sometimes sources that have
multiple metrics that we need to aggregate - for example counters per
worker/thread.

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

index 67d1e0f03b79d49dddcc8ef1e7674c24b5359d5f..4b05833973602540a281eb170581dda81336d387 100644 (file)
@@ -337,15 +337,15 @@ static int td_metrics_push_value(td_metrics* self,
                        break;
 
                case TD_METRIC_INT64:
-                       metric->value._int64 = *(int64_t*)value;
+                       metric->value._int64 += *(int64_t*)value;
                        break;
 
                case TD_METRIC_UINT64:
-                       metric->value._uint64 = *(uint64_t*)value;
+                       metric->value._uint64 += *(uint64_t*)value;
                        break;
 
                case TD_METRIC_FLOAT:
-                       metric->value._float = *(double*)value;
+                       metric->value._float += *(double*)value;
                        break;
        }