Fix lock semantics on Summary#Reset.

This erroneously used the read lock as opposed to the write lock.

Change-Id: Ib127f8c117a516709eff9fd927603879501089b4
This commit is contained in:
Matt T. Proud 2014-04-15 01:49:28 +02:00
parent 7efd34a6f8
commit e782194166
1 changed files with 3 additions and 2 deletions

View File

@ -300,8 +300,8 @@ func (h *histogram) Purge() {
func (h *histogram) Reset(labels map[string]string) { func (h *histogram) Reset(labels map[string]string) {
signature := labelValuesToSignature(labels) signature := labelValuesToSignature(labels)
h.mutex.RLock() h.mutex.Lock()
defer h.mutex.RUnlock() defer h.mutex.Unlock()
value, ok := h.values[signature] value, ok := h.values[signature]
@ -312,6 +312,7 @@ func (h *histogram) Reset(labels map[string]string) {
for _, bucket := range value.buckets { for _, bucket := range value.buckets {
bucket.Reset() bucket.Reset()
} }
delete(h.values, signature) delete(h.values, signature)
} }