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! 

-- 
You received this message because you are subscribed to the Google Groups 
"Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/2bff96e0-a11f-4d10-b01d-60965241e099n%40googlegroups.com.

Reply via email to