-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Not able to modify the instance label in prometheus receiver #34147
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
Comments
Pinging code owners:
See Adding Labels via Comments if you do not have permissions to add labels yourself. |
You have added an "instance" label to each metric's datapoints, rather than to the resource. You should be able to do: transform:
metric_statements:
- context: resource
statements:
- set(attributes["instance"],attributes["host.name"]) |
Pinging code owners for processor/transform: @TylerHelmuth @kentquirk @bogdandrutu @evan-bradley. See Adding Labels via Comments if you do not have permissions to add labels yourself. |
@dashpole I changed my transform to this:
And then used the following exporter:
Without telemetry conversion (i.e., If I enable it, I again get the same conflict error you see above. I tried adding a P.S. Please suggest if there is any easier alternative to this. All I want is to add the host-name as |
Ah, I forgot. Can you do:
The prom exporter uses service.instance.id as instance |
Oh yess! Thank you so much! that works as expected. |
Closing this since this clearly is not a bug. |
Component(s)
receiver/prometheus
What happened?
Description
I am using otelcol-contrib in agent mode (i.e., running on the same host as the application).
I have my Go app pushing metrics to otelcol-contrib via OTLP. Then, i am using prometheus receiver to scrape the node-exporter running on the same EC2 instance. Then using prometheus exporter to expose the combined metrics.
Both metrics are being emitted. But the node-exporter metrics have
instance=localhost:9100
from all nodes. I want to change this to the hostname. So I tried the following setup to override theinstance
label usingtransform
processor. But this doesn't change and causes the duplicate label error reported below.Steps to Reproduce
Expected Result
I expected the label
instance
to be overriden with the value ofhost.name
Actual Result
Collector version
otelcol-contrib version 0.104.0
Environment information
Environment
Linux ip-50-0-50-55 6.8.0-1010-aws #10-Ubuntu SMP Thu Jun 13 17:48:42 UTC 2024 aarch64 aarch64 aarch64 GNU/Linux
OpenTelemetry Collector configuration
Log output
Additional context
I know the pipeline overall works as I am expectign since if i change the
set(attributes["instance"]...
toset(attributes["foo"],....)
, the foo label appears with the expected values.I think the instance label is being added similarly. but when prometheus exporter tries to format it for scraping, it is erroring out since it finds two values of
instance
The text was updated successfully, but these errors were encountered: