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

Handle scope name version #38413

Merged
merged 8 commits into from
Mar 6, 2025

Conversation

perebaj
Copy link
Contributor

@perebaj perebaj commented Mar 6, 2025

Description

This PR ensures that when Prometheus samples lack the otel_scope_name or otel_scope_version labels, the receiver fills in default values.

It take care of part of #37277

@perebaj perebaj marked this pull request as ready for review March 6, 2025 14:31
@perebaj perebaj requested a review from a team as a code owner March 6, 2025 14:31
Copy link
Member

@ArthurSens ArthurSens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also have a test case called duplicated scope name and version at the top of TestTranslatev2. It would be nice if it were grouped together with the new test at the bottom. While you're at it, could you also add comments with the index positions? It's hard to look at the labelsRef and immediately understand which labels they represent 😛

Also, rereading it, I feel like duplicated... sounds confusing 🤔 Where is the duplication? Something like timeseries with different scopes sounds more appropriate

Comment on lines 237 to 246
scopeName := prw.settings.BuildInfo.Description
scopeVersion := prw.settings.BuildInfo.Version

if sName := ls.Get("otel_scope_name"); sName != "" {
scopeName = sName
}

if sVersion := ls.Get("otel_scope_version"); sVersion != "" {
scopeVersion = sVersion
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we make this a function? We'll repeat this code in all Add...Datapoints calls, so we might as well make this reusable instead of duplicated

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed here 91fd77c

@perebaj
Copy link
Contributor Author

perebaj commented Mar 6, 2025

We also have a test case called duplicated scope name and version at the top of TestTranslatev2. It would be nice if it were grouped together with the new test at the bottom. While you're at it, could you also add comments with the index positions? It's hard to look at the labelsRef and immediately understand which labels they represent 😛

Also, rereading it, I feel like duplicated... sounds confusing 🤔 Where is the duplication? Something like timeseries with different scopes sounds more appropriate

Fixed cc705d5, looking directly in the git diff it's a little bit hard to understand that I just changed the order. Maybe will be easy to understand if you "open the branch"

Copy link
Member

@ArthurSens ArthurSens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed cc705d5, looking directly in the git diff it's a little bit hard to understand that I just changed the order. Maybe will be easy to understand if you "open the branch"

Yeah, I did that :) Looks good

The failing test seems to be unrelated to your change.

@dehaansa dehaansa added the ready to merge Code review completed; ready to merge by maintainers label Mar 6, 2025
@songy23 songy23 merged commit e3062ec into open-telemetry:main Mar 6, 2025
167 checks passed
@github-actions github-actions bot added this to the next release milestone Mar 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready to merge Code review completed; ready to merge by maintainers receiver/prometheusremotewrite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants