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: Metric adjuster sets start time incorrectly when honor_labels==true #36477

Closed
ridwanmsharif opened this issue Nov 20, 2024 · 2 comments · Fixed by #36479
Closed
Assignees
Labels
bug Something isn't working receiver/prometheus Prometheus receiver

Comments

@ridwanmsharif
Copy link
Contributor

Component(s)

receiver/prometheus

What happened?

Description

When honor_labels is set to true - the metrics could override the job and instance labels. But the metrics adjuster assumes that all the metrics from a single scrape share the same job and instance which isn't true.

job, found := metrics.ResourceMetrics().At(0).Resource().Attributes().Get(semconv.AttributeServiceName)
if !found {
return errors.New("adjusting metrics without job")
}
instance, found := metrics.ResourceMetrics().At(0).Resource().Attributes().Get(semconv.AttributeServiceInstanceID)

Acceptance Criteria: validate and test against this assumption. Or add assertion that all metrics must come from the same resource if that is intended.

Collector version

all versions of contrib

Environment information

Environment

OS: (e.g., "Ubuntu 20.04")
Compiler(if manually compiled): (e.g., "go 14.2")

OpenTelemetry Collector configuration

No response

Log output

No response

Additional context

No response

@ridwanmsharif ridwanmsharif added bug Something isn't working needs triage New item requiring triage labels Nov 20, 2024
@github-actions github-actions bot added the receiver/prometheus Prometheus receiver label Nov 20, 2024
Copy link
Contributor

Pinging code owners:

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

@dashpole
Copy link
Contributor

dashpole commented Dec 4, 2024

Let me know if you need any help with this

andrzej-stencel pushed a commit that referenced this issue Dec 16, 2024
…esource (#36479)

<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description
This change removes as assumption that all metrics in a single scrape
come from the same resource. This is indeed not true when `honor_labels`
is set to `true` AND when the scraped metrics contain a `job` or
`instance` label.

<!-- Issue number (e.g. #1234) or full URL to issue, if applicable. -->
#### Link to tracking issue
Fixes #36477

<!--Describe what testing was performed and which tests were added.-->
#### Testing
Added unit tests

<!--Describe the documentation added.-->
#### Documentation
N/A

<!--Please delete paragraphs that you did not use before submitting.-->
sbylica-splunk pushed a commit to sbylica-splunk/opentelemetry-collector-contrib that referenced this issue Dec 17, 2024
…esource (open-telemetry#36479)

<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description
This change removes as assumption that all metrics in a single scrape
come from the same resource. This is indeed not true when `honor_labels`
is set to `true` AND when the scraped metrics contain a `job` or
`instance` label.

<!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. -->
#### Link to tracking issue
Fixes open-telemetry#36477

<!--Describe what testing was performed and which tests were added.-->
#### Testing
Added unit tests

<!--Describe the documentation added.-->
#### Documentation
N/A

<!--Please delete paragraphs that you did not use before submitting.-->
mterhar pushed a commit to mterhar/opentelemetry-collector-contrib that referenced this issue Dec 19, 2024
…esource (open-telemetry#36479)

<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description
This change removes as assumption that all metrics in a single scrape
come from the same resource. This is indeed not true when `honor_labels`
is set to `true` AND when the scraped metrics contain a `job` or
`instance` label.

<!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. -->
#### Link to tracking issue
Fixes open-telemetry#36477

<!--Describe what testing was performed and which tests were added.-->
#### Testing
Added unit tests

<!--Describe the documentation added.-->
#### Documentation
N/A

<!--Please delete paragraphs that you did not use before submitting.-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working receiver/prometheus Prometheus receiver
Projects
None yet
2 participants