The wording of the documentation is slightly misleading. Before this
commit, it says that the returned collectors are "already registered".
This could be interpreted in two ways, one could think that promauto
keeps some sort of cache of already registered Collectors that are
returned by this package, and the other way is that the Collectors
constructed are registered before being returned. What is actually
happening is the latter, and the wording after this PR leaves no room to
think that the former could be the case.
Signed-off-by: Rafael Franco <me@rafaelfranco.es>
Signed-off-by: Rafael Franco <me@rafaelfranco.es>
Also, update the package documentation. The concerns about the global
registry aren't really valid anymore because promauto now also works
with custom registries.
The musings about the http.DefaultMux are more a digression and
shouldn't be in a doc comment.
Signed-off-by: beorn7 <beorn@grafana.com>
Finally, I found an easy solution to provide the "evil"
auto-registration without getting death threats from the wardens of Go
purity. The reasoning can be found in the package's doc comment.