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

[spanmetricsprocessor] All metrics extracted from spans has the same resource attributes, despite the spans' resources are different #6486

Closed
hstan opened this issue Dec 2, 2021 · 8 comments
Labels
bug Something isn't working closed as inactive processor/spanmetrics Span Metrics processor Stale

Comments

@hstan
Copy link

hstan commented Dec 2, 2021

Describe the bug
In the span metrics processor, all metrics extracted from spans are sharing the same resource, even when the spans have different resources. (https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/processor/spanmetricsprocessor/processor.go#L234).
This only makes sense when there's no resource labels on the metrics. Once we decided to attach resource labels to metrics based on spans resource, this all-metrics-under-same-resource approach seems to be incorrect.

What did you expect to see?
When processing spanA (under span resource A) and spanB (under span resource B), the metrics created should be under metrics resource A and metrics resource B

What did you see instead?
All metrics created are under the same empty metrics resource.

Additional context
The following PR is an experiment to extract resource from spans and attach to generated metrics, which is when we found the issue. It also changed the way the buildMetrics function works to meet our expectations.
https://github.com/atlassian-forks/opentelemetry-collector-contrib/pull/1184/files

@hstan hstan added the bug Something isn't working label Dec 2, 2021
@jpkrohling
Copy link
Member

@albertteoh, are you interested in looking into this?

@jpkrohling jpkrohling added the processor/spanmetrics Span Metrics processor label Dec 2, 2021
@albertteoh
Copy link
Contributor

Yup, I can take a look at this.

@chenzhihao
Copy link
Contributor

hey @albertteoh, I wonder have you got a chance to check this?

@albertteoh
Copy link
Contributor

albertteoh commented Dec 6, 2021

At a high-level, this makes sense to me. Please go ahead and create the PR when you get the chance (assuming you were planning to create one in otel-contrib based on your draft).

@gbbr
Copy link
Member

gbbr commented Oct 5, 2022

I've kind of lost track of what happened here. The support for Resource Attributes that was added in this PR seems to have been removed without any reference. Is the conclusion that adding resource attributes required aggregating the metrics into different groups as specified in comment #403 (comment) ?

I am here because of a similar reason - I was looking for the instrumentation scope which is lost. Is there any chance we can add that as a dimension via configuration?

@github-actions
Copy link
Contributor

github-actions bot commented Dec 5, 2022

This issue has been inactive for 60 days. It will be closed in 60 days if there is no activity. To ping code owners by adding a component label, see Adding Labels via Comments, or if you are unsure of which component this issue relates to, please ping @open-telemetry/collector-contrib-triagers. If this issue is still relevant, please ping the code owners or leave a comment explaining why it is still relevant. Otherwise, please close it.

Pinging code owners:

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

@github-actions github-actions bot added the Stale label Dec 5, 2022
povilasv referenced this issue in coralogix/opentelemetry-collector-contrib Dec 19, 2022
Signed-off-by: Bogdan <bogdandrutu@gmail.com>

Signed-off-by: Bogdan <bogdandrutu@gmail.com>
@github-actions
Copy link
Contributor

github-actions bot commented Apr 8, 2023

This issue has been closed as inactive because it has been stale for 120 days with no activity.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Apr 8, 2023
@kovrus
Copy link
Member

kovrus commented Apr 11, 2023

@hstan the spanmetrics connector addresses this issue already.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working closed as inactive processor/spanmetrics Span Metrics processor Stale
Projects
None yet
Development

No branches or pull requests

6 participants