https://youtu.be/cYjF4zTJxP4

Check it out and let me know

On Thu 23 Apr, 2020, 2:34 AM 'Chris Taylor' via Prometheus Developers, <
[email protected]> wrote:

> Dear Prometheans,
>
> posting this here because the Github issue template suggested discussing
> changes on the
> mailing list first.
>
> I just discovered the `promauto.With(Reigsterer)` API[1] today, which
> looked like a nice way
> to ensure that metrics are registered with a Registerer when they are
> created.
>
> In my use-case, the code receives the Registerer as a dependency.
> Since it may be called multiple times, I'd like to be able to register
> metrics multiple times,
> As an example, imagine writing a middleware to instrument an HTTP handler,
> similar to
> package promhttp:
>
> func InstrumentedHandler(r Registerer, next http.Handler) http.Handler {
>   // register a bunch of metrics on `r` and return a Handler that
>   // bumps them appropriately
> }
>
> Currently, my code uses prometheus.Register(), and checks whether the
> returned error is
> a prometheus.AlreadyRegisteredError to get access to the
> previously-registered metric and
> uses that instead.
>
> It'd be easy enough to write a "lenient" version of promauto.Filter that
> uses this logic.
> Would it make sense to add this to client_golang? If so, what do you think
> the API should
> look like?
>
> Thanks for your time!
> Chris
>
> [1]:
> https://pkg.go.dev/github.com/prometheus/[email protected]/prometheus/promauto?tab=doc#With
>
> --
> 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 on the web visit
> https://groups.google.com/d/msgid/prometheus-developers/97aa0973-1a26-4a16-af27-b1d926971c21%40googlegroups.com
> <https://groups.google.com/d/msgid/prometheus-developers/97aa0973-1a26-4a16-af27-b1d926971c21%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 on the web visit 
https://groups.google.com/d/msgid/prometheus-developers/CAOiV00WNGUn2Z8s74Sg4waWGsi7KwyHCpyKT_aSaf9YCDe8OGg%40mail.gmail.com.

Reply via email to