Thanks!

The discussion is happening on the PR 
<https://github.com/prometheus/client_golang/pull/1598>. Will circle back 
to it next week.

Kind Regards,
Bartek Plotka @bwplotka

On Thursday, September 19, 2024 at 1:23:29 PM UTC+1 Eugen wrote:

> Hello Prometheans,
>
> At my company, we’ve run into multiple production panics using *promauto* 
> due to issues with *counter.With(prometheus.Labels{})*—whether it’s 
> typos, missing/extra labels, or messing up the order when using 
> *counter.WithLabelValues()*.
>
> To solve this, we built a custom wrapper that adds type safety by using a 
> struct for labels instead of a raw map. With Go generics, it’s 
> straightforward: you declare a type (struct with fields = labels) at the 
> metric registration stage, and only that type can be used when calling the 
> metric.
>
> I’ve put together a PR for this:
>
> https://github.com/prometheus/client_golang/pull/1598
>
> It’s an optional sub-package (called *promsafe*), fully non-breaking, and 
> easy to switch to for those already using *promauto*. Currently, it 
> covers only Counter, but if the idea gains traction, I’m happy to extend it 
> to other metrics.
>
> I’d really appreciate your support—or even critical feedback if you’re not 
> on board with the idea.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Prometheus Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/prometheus-developers/bfc31964-e9e9-42a9-9923-1ecfa77dc600n%40googlegroups.com.

Reply via email to