File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -586,7 +586,7 @@ def finish(self, hub=None):
586586 # recorder -> span -> containing transaction (which is where we started)
587587 # before either the spans or the transaction goes out of scope and has
588588 # to be garbage collected
589- del self ._span_recorder
589+ self ._span_recorder = None
590590
591591 return hub .capture_event (
592592 {
Original file line number Diff line number Diff line change 1010 start_span ,
1111 start_transaction ,
1212)
13+ from sentry_sdk .transport import Transport
1314from sentry_sdk .tracing import Transaction
1415
1516
@@ -147,3 +148,22 @@ def before_send(event, hint):
147148 pass
148149
149150 assert len (events ) == 1
151+
152+
153+ def test_start_span_after_finish (sentry_init , capture_events ):
154+ class CustomTransport (Transport ):
155+ def capture_envelope (self , envelope ):
156+ pass
157+
158+ def capture_event (self , event ):
159+ start_span (op = "toolate" , description = "justdont" )
160+ pass
161+
162+ sentry_init (traces_sample_rate = 1 , transport = CustomTransport ())
163+ events = capture_events ()
164+
165+ with start_transaction (name = "hi" ):
166+ with start_span (op = "bar" , description = "bardesc" ):
167+ pass
168+
169+ assert len (events ) == 1
You can’t perform that action at this time.
0 commit comments