Skip to content

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

@ashok-an

Description

@ashok-an

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)

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