feat(tracing): Record lost spans in client reports
Resolves https://github.com/getsentry/sentry-python/issues/3229
Marked as draft, still need to test this
We need to keep track of the amount of spans prior before_send_transaction and any event processors and calculate the delta afterwards, so we can report eventually dropped spans as well.
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 79.38%. Comparing base (
ee84c81) to head (f33be4a).
Additional details and impacted files
@@ Coverage Diff @@
## szokeasaurusrex/use-capture_record_lost_event_calls-fixture #3244 +/- ##
===============================================================================================
+ Coverage 79.35% 79.38% +0.03%
===============================================================================================
Files 132 132
Lines 14227 14243 +16
Branches 2987 2991 +4
===============================================================================================
+ Hits 11290 11307 +17
+ Misses 2092 2091 -1
Partials 845 845
| Files | Coverage Δ | |
|---|---|---|
| sentry_sdk/client.py | 79.85% <100.00%> (+0.53%) |
:arrow_up: |
| sentry_sdk/tracing.py | 73.60% <100.00%> (+0.05%) |
:arrow_up: |
| sentry_sdk/transport.py | 81.31% <100.00%> (+0.58%) |
:arrow_up: |
We need to keep track of the amount of spans prior before_send_transaction and any event processors and calculate the delta afterwards, so we can report eventually dropped spans as well.
@cleptric, does this mean that we also need to report dropped spans in the before_send_transaction even if the transaction gets sent to Sentry?
For example, in the situation below, do we report any dropped spans to Sentry?
And for clarity, in the following situation where the transaction gets dropped after before_send/before_send_transaction, e.g. in the Transport, how many spans do we report as dropped, 4 or 6?
The first example reports two dropped spans, the second example reports six dropped spans and one dropped transaction.