From 0ad6e37846e2ebbbd0e33a38274094bd15b8f11b Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Mon, 19 Jul 2021 16:30:14 +0100 Subject: [PATCH] Fix observe for calculateStateDurations --- roomserver/state/state.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/roomserver/state/state.go b/roomserver/state/state.go index b28bda7f..38bcc182 100644 --- a/roomserver/state/state.go +++ b/roomserver/state/state.go @@ -501,9 +501,8 @@ func (c *calculateStateMetrics) stop(stateNID types.StateSnapshotNID, err error) } else { outcome = "failure" } - endTime := time.Now() calculateStateDurations.WithLabelValues(c.algorithm, outcome).Observe( - float64(endTime.Sub(c.startTime).Nanoseconds()) / 1000., + float64(time.Since(c.startTime).Milliseconds()), ) calculateStatePrevEventLength.WithLabelValues(c.algorithm, outcome).Observe( float64(c.prevEventLength),