Skip to content

Warning message Calling set_status() on an ended span in examples and tests #357

@condorcet

Description

@condorcet

Describe your environment
Python 3.6, 3.7, 3.8
Code in master, hash: a89bbc8

Steps to reproduce
Add logging to stdout in pytest.ini

[pytest]
log_cli = true
...

and run tests

OR

Run tracing example https://github.com/open-telemetry/opentelemetry-python/tree/8fa21e6bcbb0b28917039661ca2ba369d0dee6b2#tracing

What is the expected behavior?
No warning messages in positive tests and examples.

What is the actual behavior?
Multiple warning logs:
opentelemetry.sdk.trace:__init__.py:287 Calling set_status() on an ended span.

Additional context
It happens because we call set_status after ending a span

self.set_status(Status(canonical_code=StatusCanonicalCode.OK))
which check if the (already ended) span is ended

Metadata

Metadata

Assignees

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