-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat: sdk/trace: span processed metric for simple span processor #7162
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
base: main
Are you sure you want to change the base?
feat: sdk/trace: span processed metric for simple span processor #7162
Conversation
…le_span_processor.go
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #7162 +/- ##
=====================================
Coverage 82.8% 82.8%
=====================================
Files 265 265
Lines 24896 24944 +48
=====================================
+ Hits 20631 20677 +46
- Misses 3885 3887 +2
Partials 380 380
🚀 New features to boost your workflow:
|
…is already being used in batch span processor
For some reason codecov comment is not updated but new code is covered by tests. (https://app.codecov.io/github/open-telemetry/opentelemetry-go/pull/7162) |
sdk/trace/simple_span_processor.go
Outdated
} | ||
|
||
// configureSelfObservability configures metrics for the simple span processor. | ||
func (ssp *simpleSpanProcessor) configureSelfObservability() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please flatten this into the span processor creation function or refactor it to not produce side-effects.
Related:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
- separate changelog entry - flatten self observability initialization - reset simpleProcessorIDCounter so tests can be run in parallel and order doesn't matter
- use sync.Pool to amortize allocation for metric attrs
- use sync.Pool to amortize allocation for metric attrs - pass context with span to ensure metric is recorded with correct span context
@MrAlias Addressed the comments. Please do another round of review when you can. Thanks. |
if ssp.selfObservabilityEnabled { | ||
// Add the span to the context to ensure the metric is recorded | ||
// with the correct span context. | ||
ctx := trace.ContextWithSpanContext(context.Background(), s.SpanContext()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this the correct way to add span to context given we have ReadOnlySpan in this method instead of Span?
Fixes: #7004
This PR adds support for experimental
otel.sdk.processor.span.processed
metric in simple span processor.Definition of metric at: https://github.com/open-telemetry/semantic-conventions/blob/v1.36.0/docs/otel/sdk-metrics.md
Experimental metrics are behind a feature flag:
OTEL_GO_X_SELF_OBSERVABILITY