Fix prometheus metrics
This commit is contained in:
parent
7c852fbf33
commit
c0ef5ce512
1 changed files with 8 additions and 5 deletions
|
@ -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) {
|
||||||
|
|
Loading…
Reference in a new issue