The metrics-core package provided a wrapper around metrics which allowed for metrics reuse using 3 IORef (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 use unsafeRegister 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:
[x] ~Replace all dots in the metric names with underscores, they aren't supported by prometheus and get replaced at runtime~ I tried this, the dots are helpful for people who read the code, so let's leave them.
[x] Verify that all the top level binds have a NOINLINE pragma
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:
NOINLINE
pragmahttps://wearezeta.atlassian.net/browse/WPB-9680
Checklist
changelog.d