From c73a7b2c9a9d3c1745031d29d18a7bf5b0d16a80 Mon Sep 17 00:00:00 2001 From: SpencerMalone Date: Wed, 9 Jan 2019 10:31:05 -0500 Subject: [PATCH] Scale summaries from milliseconds to seconds. Fixes #177 Updating exporter tests for new summary unit scaling behavior Signed-off-by: Spencer Malone --- exporter.go | 2 +- exporter_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/exporter.go b/exporter.go index 3d366f4..7a6adb4 100644 --- a/exporter.go +++ b/exporter.go @@ -420,7 +420,7 @@ func (b *Exporter) handleEvent(event Event) { mapping, ) if err == nil { - summary.Observe(event.Value()) + summary.Observe(event.Value() / 1000) // prometheus presumes seconds, statsd millisecond b.saveLabelValues(metricName, prometheusLabels, mapping.Ttl) eventStats.WithLabelValues("timer").Inc() } else { diff --git a/exporter_test.go b/exporter_test.go index a7c6655..f353c96 100644 --- a/exporter_test.go +++ b/exporter_test.go @@ -216,7 +216,7 @@ mappings: // event with ttl = 2s from a mapping &TimerEvent{ metricName: "bazqux.main", - value: 42, + value: 42000, }, }