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

Skip to content

Not properly set status on exception #377

Closed
@GoPavel

Description

@GoPavel

Exception handling from PR#297 have misbehavior in straightforward case:

    def test2_error_status(self):
        try:
            with trace.Tracer("test_error_status").start_as_current_span("root") as root:
                raise Exception("unknown")
        except Exception:  # pylint: disable=broad-except
            pass

        # Fail: root.status.canonical_code is StatusCanonicalCode.OK
        self.assertIs(root.status.canonical_code, StatusCanonicalCode.UNKNOWN)
        self.assertEqual(root.status.description, "Exception: unknown")

I find that Span's method __exist__ can set status on exception, but it is not used here.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingsdkAffects the SDK package.tracing

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions