-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
All metrics scraped from push gateway have same job label #34237
Comments
Pinging code owners:
See Adding Labels via Comments if you do not have permissions to add labels yourself. |
I was looking into this to get a better understanding of this receiver, and also reproduced this behavior. Looking at the code, it seems like after every scrape for a certain scrape config, all gathered metrics are put into the same resource, which is created in the
Question to the code owners - @Aneurysm9 @dashpole - is the creation of one resource per transaction intended, or does the logic need to be adjusted to account for the possibility of having different values for the |
Good find. The logic needs to be adjusted to account for multiple resources. We should create a new, unique resource for each combination of job + instance. |
Thanks for the response @dashpole - I would be happy to work on a PR for this. I already have a PoC implementation that should fix this which needs some polishing and tests, but I should have a PR ready this week |
…rom `job`/`instance` label pairs (#34344) **Description:** This PR solves a bug where metrics with different `job`/`instance` labels were added into the same resource. This can happen with the `honor_labels` being set to `true`, in which case those labels are not taken by the scrape config, but from the individual data points that are aggregated during a scrape iteration. This change also affects the use of relabel configs, if the job or instance labels of gathered metrics are changed by those. Here a new resource for each distinct job/instance label will be created, with the matching metrics being added to those. The additional scrape metrics (number of scraped samples, scrape duration, up, etc.) will be put into a resource representing the scrape config. **Link to tracking Issue:** #34237 **Testing:** Added Unit tests and adapted relevant e2e tests --------- Signed-off-by: Florian Bacher <florian.bacher@dynatrace.com> Co-authored-by: Evan Bradley <11745660+evan-bradley@users.noreply.github.com>
…rom `job`/`instance` label pairs (open-telemetry#34344) **Description:** This PR solves a bug where metrics with different `job`/`instance` labels were added into the same resource. This can happen with the `honor_labels` being set to `true`, in which case those labels are not taken by the scrape config, but from the individual data points that are aggregated during a scrape iteration. This change also affects the use of relabel configs, if the job or instance labels of gathered metrics are changed by those. Here a new resource for each distinct job/instance label will be created, with the matching metrics being added to those. The additional scrape metrics (number of scraped samples, scrape duration, up, etc.) will be put into a resource representing the scrape config. **Link to tracking Issue:** open-telemetry#34237 **Testing:** Added Unit tests and adapted relevant e2e tests --------- Signed-off-by: Florian Bacher <florian.bacher@dynatrace.com> Co-authored-by: Evan Bradley <11745660+evan-bradley@users.noreply.github.com>
Tested the fix, it works. Thank you! |
Component(s)
receiver/prometheus
What happened?
Description
In our setup, we have a push gateway which jobs push metrics to. Each of the metrics pushed by the jobs have a different job label. We want to preserve the job label set by the metric publishing job. But when we set
honor_labels: true
in the otel prometheus receiver configuration for the scrape job, all metrics scraped from the push gateway has a single value for the job label. The value set for the job label is from a one set of metrics pushed by a job.Steps to Reproduce
Configure a push gateway, push few metrics to it with different values for job label.
Configure OTEL collector to scrape push gateway.
Check the values for the job label.
Expected Result
Metrics scraped from push gateway should have the job label value set by the metrics publisher.
Actual Result
All metrics scraped from push gateway has a single value for the job label.
Collector version
v0.103.0
Environment information
No response
OpenTelemetry Collector configuration
Log output
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: