Skip to content

add defaultLabels option to metric classes#600

Open
bienzaaron wants to merge 7 commits into
prometheus:mainfrom
bienzaaron:master
Open

add defaultLabels option to metric classes#600
bienzaaron wants to merge 7 commits into
prometheus:mainfrom
bienzaaron:master

Conversation

@bienzaaron

Copy link
Copy Markdown

adds a defaultLabels option to the base Metric class and updates each metric class to use the value where appropriate.

Closes #598

@BourgoisMickael

Copy link
Copy Markdown

Instead of applying it during metric usage, maybe it could be added at metric scrape time https://github.com/siimon/prom-client/blob/c1d76c5d497ef803f6bd90c56c713c3fa811c3e0/lib/registry.js#L55-L57

@jdmarshall

Copy link
Copy Markdown
Contributor

There is default label support in the registry, which you can add each metric to.

https://github.com/siimon/prom-client/blob/4c6421b2253c9780a845889004b9a58dac646a1c/lib/registry.js#L17

Given the number of open tickets about memory and CPU pressure, and how much of that is down to the fact of labels, I think it would probably be good to use what is already there instead of adding more ways to do the slow things.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Set default labels on a single metric

3 participants