sentry-python icon indicating copy to clipboard operation
sentry-python copied to clipboard

feat(tracing): Record lost spans in client reports

Open szokeasaurusrex opened this issue 1 year ago • 2 comments

Resolves https://github.com/getsentry/sentry-python/issues/3229

szokeasaurusrex avatar Jul 03 '24 16:07 szokeasaurusrex

Marked as draft, still need to test this

szokeasaurusrex avatar Jul 03 '24 16:07 szokeasaurusrex

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 avatar Jul 03 '24 16:07 cleptric

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:

codecov[bot] avatar Jul 03 '24 22:07 codecov[bot]

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?

Transaction diagram

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?

Transaction diagram-2

szokeasaurusrex avatar Jul 04 '24 08:07 szokeasaurusrex

The first example reports two dropped spans, the second example reports six dropped spans and one dropped transaction.

cleptric avatar Jul 04 '24 09:07 cleptric