Define metrics using Prometheus.unsafeRegister
instead of having the metrics-core wrapper
#4085
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The
metrics-core
package provided a wrapper around metrics which allowed for metrics reuse using 3IORef (HashMap Text <metric-type>)
values. This makes the code much safer than the default way of using the Promehtheus library but also doesn't allow for having Labels and makes using metrics clunkier. It is possible to make these lookups type level and get safe Labels, but it just feels wrong to put so much work into this given metrics are not super important part of the business logic and they are never reused from different places. It is easier to the just useunsafeRegister
once on a top level binding.This PR is a result of me getting carried away and seeing how long it would take me to rework everything, it took ~4 hours. It is completely fine to throw it away and my feeling won't be hurt if we decide this is not a good idea (please, really don't worry about it).
More work on this PR:
Replace all dots in the metric names with underscores, they aren't supported by prometheus and get replaced at runtimeI tried this, the dots are helpful for people who read the code, so let's leave them.NOINLINE
pragmahttps://wearezeta.atlassian.net/browse/WPB-9680
Checklist
changelog.d