go-metrics icon indicating copy to clipboard operation
go-metrics copied to clipboard

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

Open jo-me opened this issue 3 years ago • 0 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?

jo-me avatar Mar 06 '21 14:03 jo-me