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

Add Custom Labels #6

Open
harsha-chamarthi opened this issue Jan 18, 2022 · 6 comments
Open

Add Custom Labels #6

harsha-chamarthi opened this issue Jan 18, 2022 · 6 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@harsha-chamarthi
Copy link

Add support for custom labels to uniquely identify the source of metrics if you are running multiple Grafana Agents across multiple machines

@nleiva
Copy link
Owner

nleiva commented Jan 20, 2022

Could you provide a config example with these labels?

@harsha-chamarthi
Copy link
Author

https://grafana.com/docs/agent/latest/configuration/metrics-config/#global_config

A list of static labels to add for all metrics.

external_labels:
{ : }

Add a label, for example environment: dev to differentiate between different environments

@nleiva
Copy link
Owner

nleiva commented Feb 11, 2022

Thanks. The current config looks like this:

prometheus:
  wal_directory: /tmp/grafana-agent-wal
  global:
    scrape_interval: 15s
  configs: null

Maybe we can make it something like:

prometheus:
  wal_directory: /tmp/grafana-agent-wal
  global:
    scrape_interval: 15s
external_labels:
  { environment : {{ grafana_agent_env | default('dev') }} }
  configs: null

And expose the variable grafana_agent_env. What do you think?

We also need to be mindful of users that don't want any labels.

@nleiva nleiva added enhancement New feature or request good first issue Good for newcomers labels Feb 11, 2022
@harsha-chamarthi
Copy link
Author

Yes, this config looks good to me. Can we maybe use a flag(true or false) like used to install unzip here? to enable disable external_labels.

@kmf
Copy link

kmf commented Jun 29, 2022

what is required for this to be added?

@nleiva
Copy link
Owner

nleiva commented Aug 17, 2022

Time and/or a PR. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants