fix AttributePropagatingSpanProcessor with NonRecordingSpan as parent - #744
fix AttributePropagatingSpanProcessor with NonRecordingSpan as parent#744zhongkechen wants to merge 5 commits into
Conversation
|
I partially am okay with these changes, though I don't agree with this span processor working with NonRecording Spans since there's no SpanKind. |
There was a problem hiding this comment.
instead of isinstance(parent_span, ReadableSpan), could we use parent_span.is_recording() instead?
The OTel spec defines that NonRecordingSpan.is_recording() must return False, so it's a cleaner check that doesn't require importing ReadableSpan and aligns directly with the spec's contract:
elif parent_span and parent_span.is_recording() and _is_server_kind(parent_span):
propagation_data = self._propagation_data_extractor(parent_span)
elif parent_span and parent_span.is_recording():
propagation_data = parent_span.attributes.get(self._propagation_data_key)
|
@zhongkechen Please add unit tests for this change as well and a |
I'm using I thought I should keep the check logic consistent at least in the same method |
I see though I'd still suggest using what is OTel spec aligned instead of using |
|
I don't think Since this is an SDK plugin it should be fine for it to introspect API spans to get at the underlying SDK spans, which is where |
I'm okay with the changes then, @zhongkechen please add unit tests and a changelog entry and we can help merge this |
0ac5569 to
c6b79ce
Compare
|
added a unit test case |
cecc45a to
9ec83c3
Compare
Issue #, if available:
Fixes: #743
Description of changes:
aws-otel-python-instrumentation/aws-opentelemetry-distro/src/amazon/opentelemetry/distro/attribute_propagating_span_processor.py
Lines 80 to 81 in 28fc34e
When the
parent_spanisn't aReadableSpan(e.g. aNonRecordingSpan),_is_server_kindwould throw an attribute exception because the other types of span may not have thekindattribute.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.