From da58f47978e3f2a97c9616b013c274cfcc39f495 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20V=C3=A1rady?= Date: Tue, 2 Apr 2024 13:10:43 +0200 Subject: [PATCH] fix(syslog-ng-ctl): fix event delay timestamp precision issues MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: László Várady --- pkg/syslog-ng-ctl/stats_prometheus.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/syslog-ng-ctl/stats_prometheus.go b/pkg/syslog-ng-ctl/stats_prometheus.go index 28150a9..e46bac1 100644 --- a/pkg/syslog-ng-ctl/stats_prometheus.go +++ b/pkg/syslog-ng-ctl/stats_prometheus.go @@ -129,9 +129,9 @@ func transformEventDelayMetric(delayMetric *io_prometheus_client.MetricFamily, d delayMetric := m if d, ok := delayMetricAgeByLabel[fmt.Sprint(m.Label)]; ok { - delayMetricAge := d.GetGauge().GetValue() + delayMetricAge := int(d.GetGauge().GetValue()) - lastDelaySampleTS := now.Add(time.Duration(-delayMetricAge * float64(time.Second))) + lastDelaySampleTS := now.Add(time.Duration(-delayMetricAge) * time.Second) if lastDelaySampleTS.After(lastMetricQueryTime) { timestampMs := timestamp.FromTime(lastDelaySampleTS) transformedMetric = append(transformedMetric,