prometheus/client_golang

Mention concurrency-safety properties in doc comments

varungandhi-src opened this issue · 0 comments

Hello, thanks for your work on this library. I noticed that the types such as Registry as well as interfaces like Registerer don't mention anything around what the expected behavior is when multiple goroutines call the same methods like Register.

Looking at the implementation, it seems like the expectation is that all of a Registerer's methods should be concurrency-safe (and any custom implementations should respect this contract) since a Registerer is meant to be a global object.

It would be helpful as a downstream user to document the concurrency-safety guarantees for core types and requirements for interfaces (or lack thereof, in case you want callers to use synchronization on top). I'd be happy to submit a PR to do this if there is consensus on what the docs ought to say.