Skip to content
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

Unable to set span.set_status() directly from a span context #1742

Closed
ashok-an opened this issue Apr 3, 2021 · 4 comments
Closed

Unable to set span.set_status() directly from a span context #1742

ashok-an opened this issue Apr 3, 2021 · 4 comments
Labels
bug Something isn't working

Comments

@ashok-an
Copy link

ashok-an commented Apr 3, 2021

Describe your environment
Python 3.9 on mac; opentelemetry 1.0.0; jaeger tracer

Steps to reproduce
Trying to set status code of a span to StatusCode.ERROR
span.set_status(tracer.status.StatusCode.ERROR) fails due Status object not having status_code set

What is the expected behavior?
The default value should have worked for Status.status_code

What is the actual behavior?

    if status.status_code is not StatusCode.UNSET:
AttributeError: 'StatusCode' object has no attribute 'status_code'

Additional context
Workaround:

err = trace.status.Status(trace.status.StatusCode.ERROR)
span.set_status(err)
@ashok-an ashok-an added the bug Something isn't working label Apr 3, 2021
@srikanthccv
Copy link
Member

Span set_status definition expects instance of Status. The work around you highlighted is the expected way to do it.

@lzchen
Copy link
Contributor

lzchen commented Apr 7, 2021

@ashok-an
Has your issue been addressed?

@ashok-an
Copy link
Author

ashok-an commented Apr 8, 2021

@ashok-an
Has your issue been addressed?

Yes; closing the issue

@ashok-an ashok-an closed this as completed Apr 8, 2021
@jspurestore
Copy link

I think leaving this as it is an invitation to have people fall into this pit, like I just di. Either the interface should be extended to see if the caller passed a valid code or improve the documentation to make it clear what is expected and how someone can work around it. I am happy to do the documentation update if someone can tell me how I can propose a documentation change.

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

No branches or pull requests

4 participants