Fix prometheus metrics

This commit is contained in:
Michael 2019-07-24 12:38:03 +02:00 committed by Traefiker Bot
parent 7c852fbf33
commit c0ef5ce512

View file

@ -506,11 +506,14 @@ func (h *histogram) With(labelValues ...string) metrics.Histogram {
func (h *histogram) Observe(value float64) { func (h *histogram) Observe(value float64) {
labels := h.labelNamesValues.ToLabels() labels := h.labelNamesValues.ToLabels()
collector := h.hv.With(labels) observer := h.hv.With(labels)
collector.Observe(value) observer.Observe(value)
h.collectors <- newCollector(h.name, labels, h.hv, func() { // Do a type assertion to be sure that prometheus will be able to call the Collect method.
h.hv.Delete(labels) if collector, ok := observer.(stdprometheus.Histogram); ok {
}) h.collectors <- newCollector(h.name, labels, collector, func() {
h.hv.Delete(labels)
})
}
} }
func (h *histogram) Describe(ch chan<- *stdprometheus.Desc) { func (h *histogram) Describe(ch chan<- *stdprometheus.Desc) {