Open bienzaaron opened 1 year ago
It looks like 9e49ee6378e8e1632321ef401db827df24291c2b started to pave the way for this: https://github.com/siimon/prom-client/blob/2ffd316444e08b16517e8172e76e93c0a52c63de/lib/counter.js#L18-L22
Happy to review a PR if you want to wire up incWithoutExemplar()
to use defaultLabels
.
I would like to propose an option to be added to each metric type, which would allow specifying default label values for that metric only. Those labels would then be applied to each metric value (unless the value is overridden when recorded, similar to how default labels already work at the client level in
prom-client
).It would look something like this:
If this is a valid use case / not already possible, I would love to contribute.
More use case details: My team uses prom-client to expose metrics which are scraped by prometheus and ultimately pushed to newrelic via a prometheus remote write integration.
We have an issue occasionally where if a metric is created that does not follow the naming convention expected by newrelic, newrelic interprets the metric as an inappropriate type (most often, counters are interpreted as gauges). I'd like to use this API to add the
newrelic_metric_type
label in a universal way to prevent this.