Skip to content

Commit

Permalink
fix(syslog-ng-ctl): fix event delay timestamp precision issues
Browse files Browse the repository at this point in the history
Signed-off-by: László Várady <laszlo.varady@axoflow.com>
  • Loading branch information
MrAnno committed Apr 2, 2024
1 parent 287b50f commit da58f47
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/syslog-ng-ctl/stats_prometheus.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit da58f47

Please sign in to comment.