Skip to content
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

Global labels #121

Closed
gouthamve opened this issue May 26, 2016 · 5 comments
Closed

Global labels #121

gouthamve opened this issue May 26, 2016 · 5 comments
Labels

Comments

@gouthamve
Copy link
Member

Hi,

I want to add a label to all the metrics exposed. Just like prometheus appends instance label to all the metrics of a client, I want to add it at the client level.

For example I want to add env=test to all the metrics. Is it possible? If its not possible, would you a accept a PR?

Thanks,
Goutham.

@brian-brazil
Copy link
Contributor

That's an anti-pattern, target labels should be provided at the Prometheus level via relabelling rather than from clients or exporters.

@gouthamve
Copy link
Member Author

Thanks! This might solve half my use case. Can you point me to some examples of relabelling_config?

But take the case of env=beta/qa/prod, in a dynamic environment such as AWS, its impossible to have static relabelling config. How do you propose I fix this?

@brian-brazil
Copy link
Contributor

You can use EC2 tags for example to determine you labels. See http://www.robustperception.io/automatically-monitoring-ec2-instances/

@gouthamve
Copy link
Member Author

Well, that is out of the window! We are using tags for everything and as a result the tags API is throttled when we are spinning up machines rapidly. We are currently implementing the SD as a hack for now and will move to consul soon.

Hmm, I think I will make a wrapper over the Prometheus collectors that would automatically insert such info. Hope moving to consul will fix most of the issues of the peculiar use-case we have.

Thanks!

@brian-brazil
Copy link
Contributor

Consul tags are a list rather than key/value so while you can use them with relabelling it's a bit more difficult.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants