[do not merge] Span first
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_spanwithout a running segment will be promoted to a segment span. (For the POC, this is not the case; we just use the existingstart_transaction.)
TODOs:
-
ignore_spans -
start_spanshould start a segment span if there is no active segment span
Issues
- Project: https://linear.app/getsentry/project/span-first-sdk-python-727da28dd037/overview
Reminders
- Please add tests to validate your changes, and lint your code using
tox -e linters. - Add GH Issue ID & Linear ID (if applicable)
- PR title should use conventional commit style (
feat:,fix:,ref:,meta:) - For external contributors: CONTRIBUTING.md, Sentry SDK development docs, Discord community
Codecov Report
:x: Patch coverage is 26.42487% with 142 lines in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 83.36%. Comparing base (71afdf9) to head (7c9de72).
:warning: Report is 1 commits behind head on master.
:white_check_mark: All tests successful. No failed tests found.
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%) |
:arrow_down: |
| sentry_sdk/envelope.py | 87.37% <0.00%> (-0.90%) |
:arrow_down: |
| sentry_sdk/tracing_utils.py | 86.51% <50.00%> (+0.27%) |
:arrow_up: |
| sentry_sdk/client.py | 82.03% <29.41%> (-1.68%) |
:arrow_down: |
| sentry_sdk/tracing.py | 82.66% <50.00%> (-2.42%) |
:arrow_down: |
| sentry_sdk/utils.py | 82.41% <6.52%> (-3.97%) |
:arrow_down: |
| sentry_sdk/_span_batcher.py | 25.84% <25.84%> (ø) |