rcrowley / go-metrics

Go port of Coda Hale's Metrics library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Locks missing on Registry's Each and GetAll functions => concurrent reads/writes in registry map

jo-me opened this issue · comments

Hi,

several times I've seen exceptions that there are concurrent reads and writes on a map. The map in question is registry.metrics.
This apparently happens in the case that values are iterated in the map while new ones are added by GetOrRegister() or Register().

I assume this is due to the fact that Get()/Register()/GetOrRegister() functions all use locking while Each() and GetAll() don't.

Could this be added so that the map access can happen thread-safe?