client_python icon indicating copy to clipboard operation
client_python copied to clipboard

Allow adding arbitrary labels to metrics when generating output

Open willnewton opened this issue 3 years ago • 1 comments

It's useful to be able to apply a label across all metrics, for example when using a multi-processing framework to apply a label for worker ID to all metrics (including from builtin collector types). This change alows passing a dictionary of labels and values to generate_latest which will then be applied to all generated metrics.

Signed-off-by: Will Newton [email protected]

Let me know if this approach looks viable to you, happy to rework it if you have suggestions for how to do it in a better way.

willnewton avatar Dec 20 '21 09:12 willnewton

I opened a new PR #741 that adds a new collector type. It's a little more complex but conceptually cleaner that way I think.

willnewton avatar Dec 22 '21 11:12 willnewton