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.
  • [Later] start_span without a running segment will be promoted to a segment span. (For the POC, this is not the case; we just use the existing start_transaction.)

TODOs:

  • ignore_spans
  • 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 26.42487% with 142 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.36%. Comparing base (71afdf9) to head (7c9de72).
⚠️ Report is 1 commits behind head on master.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
sentry_sdk/_span_batcher.py 25.84% 66 Missing ⚠️
sentry_sdk/utils.py 6.52% 43 Missing ⚠️
sentry_sdk/tracing.py 50.00% 12 Missing and 4 partials ⚠️
sentry_sdk/client.py 29.41% 11 Missing and 1 partial ⚠️
sentry_sdk/envelope.py 0.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.36%   -0.59%     
==========================================
  Files         181      182       +1     
  Lines       18343    18526     +183     
  Branches     3261     3307      +46     
==========================================
+ Hits        15398    15444      +46     
- Misses       1938     2070     +132     
- Partials     1007     1012       +5     
Files with missing lines Coverage Δ
sentry_sdk/consts.py 99.41% <ø> (ø)
sentry_sdk/scope.py 88.28% <66.66%> (-0.12%) ⬇️
sentry_sdk/envelope.py 87.37% <0.00%> (-0.90%) ⬇️
sentry_sdk/tracing_utils.py 86.51% <50.00%> (+0.27%) ⬆️
sentry_sdk/client.py 82.03% <29.41%> (-1.68%) ⬇️
sentry_sdk/tracing.py 82.66% <50.00%> (-2.42%) ⬇️
sentry_sdk/utils.py 82.41% <6.52%> (-3.97%) ⬇️
sentry_sdk/_span_batcher.py 25.84% <25.84%> (ø)

... and 1 file 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