Skip to content

sys.exit(0) sets transaction/span status as internal_error #4024

Closed
@sentrivana

Description

@sentrivana

How do you use Sentry?

Sentry Saas (sentry.io)

Version

latest

Steps to Reproduce

sys.exit(0) is treated as an exception (because internally it is one) when __exit__ing a Span. We don't check what kind of exception we've encountered, just that there was one. And if there is one, we mark the transaction as failed (i.e., set the status to internal_error.

import sentry_sdk
import sys
import time

sentry_sdk.init(traces_sample_rate=1.0)

with sentry_sdk.start_transaction(name="txn"):
    with sentry_sdk.start_span(name="span"):
        time.sleep(2)
        sys.exit(0)

Check Sentry. See transaction status is internal_error.

Expected Result

Transaction status should be ok.

Actual Result

See above.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions