Skip to content

[receiver/discovery] Assign correct resource in the metric evaluation #4725

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

Merged
merged 1 commit into from
Apr 24, 2024

Conversation

dmitryax
Copy link
Contributor

Metric evaluation emits entities with attributes from the first resource in the metric batch regardless of where the matching metrics were found. This change fixes the bug. The resource attributes are now assigned from the resource where the metrics are found.

It doesn't make sense to mention it in the changelog because we don't have any pre-configured receiver to run into this bug.

@dmitryax dmitryax requested review from a team as code owners April 24, 2024 22:48
Metric evaluation emits entities with attribute from the first resource in the metric batch regardless where the matching metrics were found. This change fixes the bug. The resource attributes now assigned from the resource where the metrics are found.

It doesn't make sense to mention in the changelog because we don't have any pre-configured receiver that can run into this bug.
@dmitryax dmitryax force-pushed the fix-metrics-evaluation branch from 17874c1 to f3b4577 Compare April 24, 2024 22:49
entityEvent.ID().PutStr(discovery.EndpointIDAttr, string(endpointID))
entityState := entityEvent.SetEntityState()

md.ResourceMetrics().At(0).Resource().Attributes().CopyTo(entityState.Attributes())
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The core of the bug fix is replacing this line with line 116

Copy link
Contributor

@crobert-1 crobert-1 Apr 24, 2024

Choose a reason for hiding this comment

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

Should there be a changelog for this, or was this bug introduced since the last release? Sorry, just read the PR description 🤦

@dmitryax dmitryax merged commit 7f076f7 into main Apr 24, 2024
27 checks passed
@dmitryax dmitryax deleted the fix-metrics-evaluation branch April 24, 2024 23:17
@github-actions github-actions bot locked and limited conversation to collaborators Apr 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants