Skip to content

SDK incorrectly uses baggage sample-rate for sampling decision when sentry-trace header is missing #1999

@cleptric

Description

@cleptric

Problem

When the SDK receives a baggage header but no sentry-trace header, it incorrectly uses the sentry-sample_rate value from the baggage to make a sampling decision.

Expected Behavior

When there is no sentry-trace header, the SDK should treat this as a new trace and make an independent sampling decision using the configured traces_sample_rate or traces_sampler. The baggage header without a corresponding sentry-trace header should not influence the sampling decision.

Current Behavior

The SDK extracts the sample rate from the incoming baggage header and uses it to determine whether to sample the transaction, even though the absence of sentry-trace means this is effectively a new trace head.

Why This Matters

  • The baggage sample rate reflects the sampling decision of an upstream service that may have different sampling configuration
  • Without sentry-trace, there's no parent span to continue, so the local SDK should be the trace head
  • This can lead to unexpected sampling behavior where traces are sampled at rates not configured locally

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions