Skip to content

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

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

Closed
condorcet opened this issue Jan 8, 2020 · 2 comments · Fixed by #358
Closed

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

condorcet opened this issue Jan 8, 2020 · 2 comments · Fixed by #358
Assignees
Labels
bug Something isn't working

Comments

@condorcet
Copy link

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

@condorcet condorcet added the bug Something isn't working label Jan 8, 2020
@ocelotl ocelotl self-assigned this Jan 8, 2020
@condorcet
Copy link
Author

@ocelotl As I can see another bug correlated with this: default status of ended span must be 'OK' according to spec https://github.com/open-telemetry/opentelemetry-specification/blob/ccbf36374730488548703a65af40d9051d7ab944/specification/api-tracing.md#set-status, but now it's None

@ocelotl
Copy link
Contributor

ocelotl commented Jan 8, 2020

Thanks for reporting, @condorcet . We are aiming to have the span status set to None as long as it is not ended. Once it is, it should be set to OK unless the user specifically has it set otherwise. I'll take a look at this issue to figure out why this is not happening.

ocelotl added a commit to ocelotl/opentelemetry-python that referenced this issue Jan 9, 2020
ocelotl added a commit to ocelotl/opentelemetry-python that referenced this issue Jan 9, 2020
ocelotl added a commit to ocelotl/opentelemetry-python that referenced this issue Jan 13, 2020
srikanthccv pushed a commit to srikanthccv/opentelemetry-python that referenced this issue Nov 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants