Skip to content

Conversation

@sentrivana
Copy link
Contributor

@sentrivana sentrivana commented Nov 19, 2025

Description

WIP: Draft implementation of span first/span streaming in the Python SDK. Uses the existing start_span API, but batches spans and sends them independently of the transaction/segment span.

Enables to run the SDK in two modes: static and streaming. Static mode is the current status quo where spans are sent together with their transaction (segment) as the transaction finishes. Streaming mode makes two major changes to the behavior of the start_span API:

  • Spans are added to the streaming buffer on finish and they may be sent in an envelope without their segment.
  • start_span without a running segment will be promoted to a segment span.

TODOs:

  • ignore_spans
  • envelope headers
  • start_span should start a segment span if there is no active segment span

Issues

Reminders

@codecov
Copy link

codecov bot commented Nov 19, 2025

Codecov Report

❌ Patch coverage is 32.77311% with 80 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.66%. Comparing base (17284be) to head (7066f69).
⚠️ Report is 14 commits behind head on master.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
sentry_sdk/_span_batcher.py 28.57% 60 Missing ⚠️
sentry_sdk/utils.py 10.00% 9 Missing ⚠️
sentry_sdk/tracing.py 53.84% 3 Missing and 3 partials ⚠️
sentry_sdk/client.py 60.00% 1 Missing and 1 partial ⚠️
sentry_sdk/tracing_utils.py 50.00% 1 Missing and 1 partial ⚠️
sentry_sdk/scope.py 66.66% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5119      +/-   ##
==========================================
- Coverage   83.94%   83.66%   -0.29%     
==========================================
  Files         180      181       +1     
  Lines       18023    18196     +173     
  Branches     3205     3244      +39     
==========================================
+ Hits        15129    15223      +94     
- Misses       1917     1987      +70     
- Partials      977      986       +9     
Files with missing lines Coverage Δ
sentry_sdk/consts.py 99.41% <ø> (+<0.01%) ⬆️
sentry_sdk/scope.py 88.40% <66.66%> (-0.12%) ⬇️
sentry_sdk/client.py 83.48% <60.00%> (-0.32%) ⬇️
sentry_sdk/tracing_utils.py 87.63% <50.00%> (+0.27%) ⬆️
sentry_sdk/tracing.py 85.33% <53.84%> (-0.93%) ⬇️
sentry_sdk/utils.py 85.44% <10.00%> (-0.87%) ⬇️
sentry_sdk/_span_batcher.py 28.57% <28.57%> (ø)

... and 14 files with indirect coverage changes

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.

2 participants