From e782194166e079a27b960e6857c4e071f4df8552 Mon Sep 17 00:00:00 2001 From: "Matt T. Proud" Date: Tue, 15 Apr 2014 01:49:28 +0200 Subject: [PATCH] Fix lock semantics on Summary#Reset. This erroneously used the read lock as opposed to the write lock. Change-Id: Ib127f8c117a516709eff9fd927603879501089b4 --- prometheus/histogram.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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) }