-
I want to have labels on the metrics from the discovery:
I could not find an example or docs on how to match inside Grafana which service the metrics were coming from ('backend-production' or 'backend-staging') I want the data coming from the "backend-production" service to also have a label added clarifying it is coming from a backend-production service. The instance label has the host and port - but I also need the service label. Right now I am getting for example:
But what I want is
I don't see how to write the relabel_configs/metric_relabel_config to reference the service. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
The Prometheus documentation says that relabel_configs:
- source_labels: ['__meta_consul_service']
target_label: service |
Beta Was this translation helpful? Give feedback.
-
It must be
|
Beta Was this translation helpful? Give feedback.
It must be
relabel_configs
. Labels starting with__meta_
are only available prior to scraping.relabel_configs
applies to discovered targets prior to scraping, whilemetric_relabel_configs
applies to individual metrics post-scraping.https://grafana.com/docs/agent/latest/configuration/