client_rust icon indicating copy to clipboard operation
client_rust copied to clipboard

Allow root registry creation with prefix AND label(s)

Open popadi opened this issue 1 year ago • 1 comments

As the title says, is it okay to add a constructor (with_prefix_and_labels; please suggest a better name eventually) that allows the creation of a base/root registry with a prefix and some default labels? Or maybe a way to allow the mutation of the labels of a registry.

I have a bunch of counters coming from from processes running on different hosts and I'd like to have them labeled with about 2-3 base/identification labels to be able to query them in my dashboards properly. Due to some restrictions I am not able to inject these labels directly via kubernetes on Prometheus scrape. At the same time, I see no reason TO NOT allow the creation of a registry with default labels.

This is a question related a bit to the previously posted issue (https://github.com/prometheus/client_rust/issues/144) for which I submitted a pull request (https://github.com/prometheus/client_rust/pull/145).

popadi avatar May 28 '23 14:05 popadi

No objections to adding Registry::with_prefix_and_labels. Contribution welcome.

mxinden avatar May 29 '23 04:05 mxinden