Thanks to visit codestin.com
Credit goes to github.com

Skip to content

AttributeError: 'NonRecordingSpan' object has no attribute 'parent' #2348

Closed
@Zhouhao12345

Description

@Zhouhao12345

[Environment]

python==3.7.1
opentelemetry-api==1.7.1
opentelemetry-exporter-jaeger==1.7.1
opentelemetry-propagator-jaeger==1.7.1
opentelemetry-sdk==1.7.1

OTEL_TRACES_SAMPLER=traceidratio
OTEL_TRACES_SAMPLER_ARG=0

My Code :
image

[Issue]

0 rate for TraceIdRatioBased sampler to create the NonRecordingSpan, which with no parent attribute.
Then I try to inject carrier with Jaeger Propagator. Following exception happened:
'NonRecordingSpan' object has no attribute 'parent' File "/usr/local/lib/python3.7/dist-packages/opentelemetry/propagators/jaeger/__init__.py", line 84, in inject span_parent_id = span.parent.span_id if span.parent else 0

[expected behavior]

It should return with empty carrier without any exception.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions