-
-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Default instance labels for all custom metrics #1209
Comments
Thanks @raphaabreu By design, I try not to add anything to this library that isn't directly supported by the prom-client library. I was browsing through their docs and it seems like even they don't really have a way to apply common labels to both default and custom metrics (I was reading here). If I am wrong on this, please correct me. In the meantime, I'd be more than happy to look at any proposals you may have for an API. If it doesn't add a lot of surface area to the project, I'd be fine incorporating those changes in. As far as implementation goes, you may want to look at creating an injectable with those common labels you want applied everywhere. This would allow to inject them when creating metrics (code). As far as where to get those labels, I would add an option to this interface that - ideally - matches the structure that prom-client accepts. Given that each metric accepts |
I also required this but found a somewhat simple work around. I have a file
Now all my metircs have app_name=wallet in them |
🎉 This issue has been resolved in version 4.6.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Hello @willsoto, awesome package!
I am trying to have all my custom metrics carry some common tags like the service name, version and the hostname but I am not finding any easy way to do this. All paths seems to require a lot of code duplication to have these common tags set on all custom metrics.
Is there a way to add a parameter to the PrometheusModule.register(PrometheusOptions) class so that a Record<string,string> could be specified with all tags that all metrics should always carry? This would be analogous to the defaultMetrics -> config -> labels property, but it should apply to both "defaultMetrics" and "customMetrics".
What do you think? I can help with a PR if you point me in the right direction.
The text was updated successfully, but these errors were encountered: