opentelemetry-collector-contrib icon indicating copy to clipboard operation
opentelemetry-collector-contrib copied to clipboard

[receiver/prometheus] Add static TAG/LABEL to all metrics scraped with job

Open SaschaBrechmannVHV opened this issue 1 year ago • 4 comments

Component(s)

receiver/prometheus

Describe the issue you're reporting

Hi all, i use the prometheus-receiver, to scrape the otel-col Metrics. Now i would route the otel-metrics to an other metrics-DB than the default OT-Metrics, createt by the OT-Agent. For this i need an extra TAG/LABEL with every metric, create bei on prometheus-receiver job.

This is my current config:

receivers:
  prometheus:
    config:
      scrape_configs:
        - job_name: otel-collector-emtrics
          scrape_interval: 3s
          static_configs:
            - targets: ['localhost:8888']
              labels: ['influxdb_database: apm']

The label-part is not working. Did any one have an idee, what i could do?

SaschaBrechmannVHV avatar Mar 18 '24 14:03 SaschaBrechmannVHV

Pinging code owners:

  • receiver/prometheus: @Aneurysm9 @dashpole

See Adding Labels via Comments if you do not have permissions to add labels yourself.

github-actions[bot] avatar Mar 18 '24 14:03 github-actions[bot]

maybe you can use attributesprocessor to add your label

Frapschen avatar Mar 22 '24 03:03 Frapschen

I think the labels section might have the wrong quoting? At least it looks funky to me.

https://prometheus.io/docs/prometheus/latest/configuration/configuration/#static_config

Try labels: ['influxdb_database': 'apm']? or labels: [influxdb_database: apm]?

dashpole avatar Mar 22 '24 13:03 dashpole

This issue has been inactive for 60 days. It will be closed in 60 days if there is no activity. To ping code owners by adding a component label, see Adding Labels via Comments, or if you are unsure of which component this issue relates to, please ping @open-telemetry/collector-contrib-triagers. If this issue is still relevant, please ping the code owners or leave a comment explaining why it is still relevant. Otherwise, please close it.

Pinging code owners:

  • receiver/prometheus: @Aneurysm9 @dashpole

See Adding Labels via Comments if you do not have permissions to add labels yourself.

github-actions[bot] avatar May 22 '24 03:05 github-actions[bot]

This issue has been closed as inactive because it has been stale for 120 days with no activity.

github-actions[bot] avatar Jul 21 '24 05:07 github-actions[bot]