Fork me on GitHub
#observability
<
2022-02-04
>
lukasz17:02:22

I'm looking into moving our observability pipeline from statsd to prometheus - so far https://github.com/clj-commons/iapetos looks great, but one thing bugs me: why do I have to define metrics upfront? Is there a way of adding them dynamically that doesn't involve rebuilding the registry all the time? I tried to find answer for this and there's no clear answer anywhere or my google-fu is simply not good enough. thx 🙏

nivekuil02:02:41

what do you mean by rebuilding a registry? the registry is initialized with collectors and you can hold a reference to a collector and register metrics to that, mutably/dynamically

lukasz15:02:49

The readme clearly states: https://github.com/clj-commons/iapetos#registering-metrics "All metrics have to be registered with a collector registry before being used" - so that's pretty clear to me that I need to know all metrics upfront. For the most part that's how we use statsd, but we also have a http router that creates metrics for all routes automatically, so generate all metric keys when the route configuration is read. I realize I can hook into the metric registration process but it will weirdly couple the metric collector with our router.