X Tutup
Skip to content

ref: Add sampling to span first (11)#5617

Open
sentrivana wants to merge 79 commits intomasterfrom
ivana/span-first-11-sampling
Open

ref: Add sampling to span first (11)#5617
sentrivana wants to merge 79 commits intomasterfrom
ivana/span-first-11-sampling

Conversation

@sentrivana
Copy link
Contributor

@sentrivana sentrivana commented Mar 9, 2026

Add sampling to span first.

  • In span first, we make a sampling decision BEFORE a span is actually created. Based on the sampling decision (and potentially other filtering mechanisms like ignore_spans -- coming soon) we either create a StreamedSpan or a NoopStreamedSpan.
  • No-op spans will remember why they were unsampled and will emit a client report accordingly when finished.
  • The logic that makes the sampling decision has been ported from _set_initial_sampling_decision.
  • The effective sampling rate, which might potentially differ from the incoming baggage (because e.g. backpressure handling is active and lowers the effective sample rate), is then updated in the propagation context (ported from here).

@github-actions
Copy link
Contributor

github-actions bot commented Mar 9, 2026

Semver Impact of This PR

🟢 Patch (bug fixes)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


This PR will not appear in the changelog.


🤖 This preview updates automatically when you update the PR.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 9, 2026

Codecov Results 📊

13 passed | Total: 13 | Pass Rate: 100% | Execution Time: 12.61s

All tests are passing successfully.

❌ Patch coverage is 4.48%. Project has 14005 uncovered lines.

Files with missing lines (3)
File Patch % Lines
tracing_utils.py 40.96% ⚠️ 392 Missing and 28 partials
scope.py 68.92% ⚠️ 262 Missing and 66 partials
traces.py 38.62% ⚠️ 151 Missing

Generated by Codecov Action

Base automatically changed from ivana/span-first-10-random-improvements to master March 10, 2026 11:16
@sentrivana sentrivana marked this pull request as ready for review March 10, 2026 12:19
@sentrivana sentrivana requested a review from a team as a code owner March 10, 2026 12:19
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

@sentrivana sentrivana marked this pull request as draft March 10, 2026 12:25
@sentrivana sentrivana marked this pull request as ready for review March 10, 2026 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

X Tutup