wireapp / wire-server

🇪🇺 Wire back-end services
https://wire.com
GNU Affero General Public License v3.0
2.6k stars 325 forks source link

Define metrics using `Prometheus.unsafeRegister` instead of having the metrics-core wrapper #4085

Closed akshaymankar closed 3 months ago

akshaymankar commented 4 months ago

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:

https://wearezeta.atlassian.net/browse/WPB-9680

Checklist