Skip to content

Don't create segments where we were creating child spans #6819

Description

@sentrivana

Currently, only a handful of integrations create transactions. Most integrations just create spans via sentry_sdk.start_span. In that case, the spans only get created if there's a running transaction.

In span streaming, sentry_sdk.traces.start_span will always create a span. If there is no active span, it'll be a segment (root-level) span. This is not what we want in most integrations. We want to keep the old behavior to only create the spans if they'd be child spans.

For all integrations that have tracing:

  • If the legacy tracing code path creates a span via start_span, guard the streaming traces.start_span counterpart with a if sentry_sdk.traces.get_current_span() is not None check to only create the span if there's a running span.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions