Skip to content
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

[receiver/prometheus]: Group scraped metrics into resources created from job/instance label pairs #34344

Merged
merged 12 commits into from
Aug 27, 2024

Conversation

bacherfl
Copy link
Contributor

@bacherfl bacherfl commented Jul 31, 2024

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

@github-actions github-actions bot added the receiver/prometheus Prometheus receiver label Jul 31, 2024
@github-actions github-actions bot requested review from Aneurysm9 and dashpole July 31, 2024 09:26
…nd resources detected during scrape

Signed-off-by: Florian Bacher <[email protected]>
Signed-off-by: Florian Bacher <[email protected]>
Signed-off-by: Florian Bacher <[email protected]>
Signed-off-by: Florian Bacher <[email protected]>
@bacherfl bacherfl marked this pull request as ready for review August 1, 2024 13:42
@bacherfl bacherfl requested a review from a team August 1, 2024 13:42
Signed-off-by: Florian Bacher <[email protected]>
@evan-bradley evan-bradley merged commit 925839e into open-telemetry:main Aug 27, 2024
156 checks passed
@github-actions github-actions bot added this to the next release milestone Aug 27, 2024
f7o pushed a commit to f7o/opentelemetry-collector-contrib that referenced this pull request Sep 12, 2024
…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 <[email protected]>
Co-authored-by: Evan Bradley <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
receiver/prometheus Prometheus receiver
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants