diff --git a/prometheus/histogram.go b/prometheus/histogram.go index b7d39c7..1654e9d 100644 --- a/prometheus/histogram.go +++ b/prometheus/histogram.go @@ -300,8 +300,8 @@ func (h *histogram) Purge() { func (h *histogram) Reset(labels map[string]string) { signature := labelValuesToSignature(labels) - h.mutex.RLock() - defer h.mutex.RUnlock() + h.mutex.Lock() + defer h.mutex.Unlock() value, ok := h.values[signature] @@ -312,6 +312,7 @@ func (h *histogram) Reset(labels map[string]string) { for _, bucket := range value.buckets { bucket.Reset() } + delete(h.values, signature) }