-
Notifications
You must be signed in to change notification settings - Fork 438
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
[Trace SDK] Input of SpanProcessor::OnEnd should be a readable span #1475
Comments
Just curious - Are you trying to create a custom span-processor with filtration support? Instead of trying to do this on the processor, you can create a custom Sampler which takes this decision based on the initial set of attributes of the Span. Have a look at the default samplers provided by the SDK - https://github.com/open-telemetry/opentelemetry-cpp/tree/main/sdk/src/trace/samplers |
My use case is to decide whether span needs to be collected based on status code. It can't be done in Sampler, since sampler is called when span starts, but status code is available only when span ends. I think
Avoid copying |
That looks to be the fair ask, though it would be a breaking change for any external exporters (not part of this repo) and needs to be communicated ahead of time. @pyohannes - Just in case you have any comments, as I think you were involved in the initial recordable design :) One concern is it would increase the effort for devs to implement exporters, as now they need to provide both getters and setters for the span. |
Sounds like we need pass read only span to OnEnd instead of the current recordable? Like it is unexpected to change/set span data in |
I think there's no general solution for this. For some implementations of One possibility I see is extending the virtual explicit operator SpanData*() const {
return nullptr;
} Then |
According to the specification, input of
SpanProcessor::OnEnd
should be a readable span.https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/sdk.md#onendspan
Current input of
SpanProcessor::OnEnd
is aRecordable
,opentelemetry-cpp/sdk/include/opentelemetry/sdk/trace/processor.h
Line 47 in 9efb7a1
but
Recordable
only contains setters for span attributes.https://github.com/open-telemetry/opentelemetry-cpp/blob/main/sdk/include/opentelemetry/sdk/trace/recordable.h
I want to filter out some spans by attributes in
SpanProcessor::OnEnd
, but it's not doable if span attributes cannot be read.The text was updated successfully, but these errors were encountered: