Skip to content

Commit 4415469

Browse files
committed
.
1 parent b5db56f commit 4415469

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

sentry_sdk/tracing.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,16 +183,22 @@ def __init__(
183183
only_if_parent=False, # type: bool
184184
parent_span=None, # type: Optional[Span]
185185
otel_span=None, # type: Optional[OtelSpan]
186+
span=None, # type: Optional[Span]
186187
):
187188
# type: (...) -> None
188189
"""
189190
If otel_span is passed explicitly, just acts as a proxy.
190191
192+
If span is passed explicitly, use it. The only purpose of this param
193+
if backwards compatibility with start_transaction(transaction=...).
194+
191195
If only_if_parent is True, just return an INVALID_SPAN
192196
and avoid instrumentation if there's no active parent span.
193197
"""
194198
if otel_span is not None:
195199
self._otel_span = otel_span
200+
elif span is not None:
201+
self._otel_span = span._otel_span
196202
else:
197203
skip_span = False
198204
if only_if_parent and parent_span is None:

tests/integrations/threading/test_threading.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ def double(number):
104104
assert len(event["spans"]) == 0
105105

106106

107-
@pytest.mark.skip(reason="Temporarily disable to release SDK 2.0a1.")
108107
def test_circular_references(sentry_init, request):
109108
sentry_init(default_integrations=False, integrations=[ThreadingIntegration()])
110109

@@ -232,7 +231,7 @@ def do_some_work(number):
232231

233232
threads = []
234233

235-
with sentry_sdk.start_transaction(op="outer-trx"):
234+
with sentry_sdk.start_span(op="outer-trx"):
236235
for number in range(5):
237236
with sentry_sdk.start_span(
238237
op=f"outer-submit-{number}", name="Thread: main"

0 commit comments

Comments
 (0)