Commit Graph

10 Commits

Author SHA1 Message Date
Rafael Franco 7c46c150bd
Clarify documentation around what constructors do (#1125)
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>
2022-09-12 11:17:56 +02:00
Tom Wilkie 9c8ba1f945 Review feedback: add comment and tests for WrapRegistererWith.
Signed-off-by: Tom Wilkie <tom.wilkie@gmail.com>
2020-06-04 11:51:51 +01:00
Tom Wilkie 614377c550 Review feedback: use one line.
Signed-off-by: Tom Wilkie <tom.wilkie@gmail.com>
2020-06-04 10:57:40 +01:00
Tom Wilkie 8961609f91 Ensure that nil registers are treat as a no-op, even when wrapping.
Signed-off-by: Tom Wilkie <tom.wilkie@gmail.com>
2020-06-04 10:30:51 +01:00
beorn7 3ba240a80f Improve doc comments in promauto
In particular, point out that `With(nil)` is valid.

Signed-off-by: beorn7 <beorn@grafana.com>
2020-06-03 13:56:49 +02:00
Michael Cristina be019d1f24 Fix typo in godoc help text
Signed-off-by: Michael Cristina <mcristina444@gmail.com>
2020-05-02 10:44:25 -05:00
beorn7 1c2884b807 Add NewUntypedFunc to promauto
This constructor was simply forgotten.

Signed-off-by: beorn7 <beorn@grafana.com>
2020-02-13 22:08:18 +01:00
beorn7 92c1ac77e7 Add a "factory" to make promauto work for custom registries
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>
2020-02-13 22:03:30 +01:00
Adam Thomason 660e6909cc promauto: add NewCounterFunc and NewGaugeFunc 2018-03-17 14:01:36 -07:00
beorn7 b82bcfe55f Add a package promauto that provides auto-registering metrics
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.
2018-02-16 12:55:57 +01:00