From: Dmitry Smirnov Date: Tue, 3 Sep 2019 17:59:35 +0000 (+0100) Subject: go-metrics_prometheus-fix_Observer X-Git-Tag: archive/raspbian/18.09.1+dfsg1-7.1+rpi1+deb10u1^2~17 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=cd8695b8dcbadf857a225a25607134c67bb49e19;p=docker.io.git go-metrics_prometheus-fix_Observer Gbp-Pq: Name go-metrics_prometheus-fix_Observer.patch --- diff --git a/go-metrics/timer.go b/go-metrics/timer.go index e91eca76..2529e092 100644 --- a/go-metrics/timer.go +++ b/go-metrics/timer.go @@ -48,7 +48,7 @@ func (lt *labeledTimer) Collect(c chan<- prometheus.Metric) { } type timer struct { - m prometheus.Histogram + m prometheus.Observer } func (t *timer) Update(duration time.Duration) { @@ -60,9 +60,14 @@ func (t *timer) UpdateSince(since time.Time) { } func (t *timer) Describe(c chan<- *prometheus.Desc) { - t.m.Describe(c) + c <- t.m.(prometheus.Metric).Desc() } func (t *timer) Collect(c chan<- prometheus.Metric) { - t.m.Collect(c) + // Are there any observers that don't implement Collector? It is really + // unclear what the point of the upstream change was, but we'll let this + // panic if we get an observer that doesn't implement collector. In this + // case, we should almost always see metricVec objects, so this should + // never panic. + t.m.(prometheus.Collector).Collect(c) }