refactor: default to prometheus.DefaultRegisterer#722
Conversation
119816e to
fb39749
Compare
Codecov ReportAttention: Patch coverage is
@@ Coverage Diff @@
## main #722 +/- ##
==========================================
+ Coverage 60.31% 60.33% +0.02%
==========================================
Files 244 244
Lines 31034 31036 +2
==========================================
+ Hits 18717 18725 +8
+ Misses 10644 10639 -5
+ Partials 1673 1672 -1
|
fb39749 to
edd18aa
Compare
|
I think the approach of special-casing tests is too tedious, especially if people elaready use boxo modules in their tests, we will be breaking them forcing people to add similar wrappers. We have a different approach in boxo/gateway/metrics where we catch "duplicate registration" error and log error instead. This way all tests can run in parallel without extra wrapper. So next steps here:
|
edd18aa to
678be0d
Compare
|
Pushed refactored version. Boxo will no longer panic when This way
|
678be0d to
e345d49
Compare
replace NewRegistry() call with global `prometheus.DefaultRegisterer` so by default boxo users who did not specify custom registry are not missing any metrics
e345d49 to
6b292d9
Compare
This PR contains changes on top of #718
It replaces
prometheus.NewRegistry()calls withprometheus.DefaultRegistererto ensure that by default boxo users who do not specify an explicit registry are not missing some of the metrics.This convention is what go-libp2p does already, and I feel boxo should follow, to remove confusion why some metrics are present, and some are missing.
TODO
prometheus.DefaultRegistereris used and tests are run in parallelregistry.MustRegister