Skip to content

Commit fd69f64

Browse files
committed
better span names
1 parent 0e92608 commit fd69f64

File tree

1 file changed

+17
-20
lines changed

1 file changed

+17
-20
lines changed

tests/integrations/threading/test_threading.py

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import sentry_sdk
99
from sentry_sdk import capture_message
1010
from sentry_sdk.integrations.threading import ThreadingIntegration
11-
from sentry_sdk.utils import get_current_thread_meta
1211

1312
original_start = Thread.start
1413
original_run = Thread.run
@@ -227,8 +226,7 @@ def test_spans_from_multiple_threads(
227226

228227
def do_some_work(number):
229228
with sentry_sdk.start_span(
230-
op=f"inner-run-{number}",
231-
name=f"Thread: {get_current_thread_meta()[1]}",
229+
op=f"inner-run-{number}", name=f"Thread: child-{number}"
232230
):
233231
pass
234232

@@ -237,8 +235,7 @@ def do_some_work(number):
237235
with sentry_sdk.start_transaction(op="outer-trx"):
238236
for number in range(5):
239237
with sentry_sdk.start_span(
240-
op=f"outer-submit-{number}",
241-
name=f"Thread: {get_current_thread_meta()[1]}",
238+
op=f"outer-submit-{number}", name="Thread: main"
242239
):
243240
t = Thread(target=do_some_work, args=(number,))
244241
t.start()
@@ -252,27 +249,27 @@ def do_some_work(number):
252249
assert render_span_tree(event) == dedent(
253250
"""\
254251
- op="outer-trx": description=null
255-
- op="outer-submit-0": description="Thread: MainThread"
256-
- op="inner-run-0": description="Thread: Thread-1 (do_some_work)"
257-
- op="outer-submit-1": description="Thread: MainThread"
258-
- op="inner-run-1": description="Thread: Thread-2 (do_some_work)"
259-
- op="outer-submit-2": description="Thread: MainThread"
260-
- op="inner-run-2": description="Thread: Thread-3 (do_some_work)"
261-
- op="outer-submit-3": description="Thread: MainThread"
262-
- op="inner-run-3": description="Thread: Thread-4 (do_some_work)"
263-
- op="outer-submit-4": description="Thread: MainThread"
264-
- op="inner-run-4": description="Thread: Thread-5 (do_some_work)"\
252+
- op="outer-submit-0": description="Thread: main"
253+
- op="inner-run-0": description="Thread: child-0"
254+
- op="outer-submit-1": description="Thread: main"
255+
- op="inner-run-1": description="Thread: child-1"
256+
- op="outer-submit-2": description="Thread: main"
257+
- op="inner-run-2": description="Thread: child-2"
258+
- op="outer-submit-3": description="Thread: main"
259+
- op="inner-run-3": description="Thread: child-3"
260+
- op="outer-submit-4": description="Thread: main"
261+
- op="inner-run-4": description="Thread: child-4"\
265262
"""
266263
)
267264

268265
elif not propagate_scope:
269266
assert render_span_tree(event) == dedent(
270267
"""\
271268
- op="outer-trx": description=null
272-
- op="outer-submit-0": description="Thread: MainThread"
273-
- op="outer-submit-1": description="Thread: MainThread"
274-
- op="outer-submit-2": description="Thread: MainThread"
275-
- op="outer-submit-3": description="Thread: MainThread"
276-
- op="outer-submit-4": description="Thread: MainThread"\
269+
- op="outer-submit-0": description="Thread: main"
270+
- op="outer-submit-1": description="Thread: main"
271+
- op="outer-submit-2": description="Thread: main"
272+
- op="outer-submit-3": description="Thread: main"
273+
- op="outer-submit-4": description="Thread: main"\
277274
"""
278275
)

0 commit comments

Comments
 (0)