Hello! I wanted to ask if it would be possible to add labels via static_config to a scrape job that uses the Consul Service Discovery mechanism?
Right now I have tested two solutions and with the static target, the labels are being applied while the Consul SD does not apply.
Consul SD:
- job_name: 'kubernetes-pods-federation'
scrape_interval: 30s
metrics_path: '/federate'
consul_sd_configs:
- server: 'localhost:8500'
relabel_configs:
- source_labels: [__meta_consul_tags]
regex: '^.*k8s.*$'
action: keep
- source_labels: ['__meta_consul_node']
target_label: instance
- source_labels: ['__meta_consul_service']
target_label: service
- source_labels: ['__meta_consul_tags']
target_label: consul_tags
static_configs:
- labels:
env: foo
region: bar
and second that has static target
- job_name: 'consul-agent'
scrape_interval: 30s
metrics_path: '/v1/agent/metrics'
params:
format: ['prometheus']
scheme: http
static_configs:
- targets: ['localhost:8500']
labels:
env: foo
region: bar
Thanks in advance for the help!