Skip to content

Commit bcccadf

Browse files
committed
more naming
1 parent ae9a14d commit bcccadf

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

tests/integrations/celery/test_celery.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -126,14 +126,14 @@ def dummy_task(x, y):
126126
foo = 42 # noqa
127127
return x / y
128128

129-
with sentry_sdk.start_span(op="unit test transaction") as span:
129+
with sentry_sdk.start_span(op="unit test transaction") as root_span:
130130
celery_invocation(dummy_task, 1, 2)
131131
_, expected_context = celery_invocation(dummy_task, 1, 0)
132132

133133
(_, error_event, _, _) = events
134134

135-
assert error_event["contexts"]["trace"]["trace_id"] == span.trace_id
136-
assert error_event["contexts"]["trace"]["span_id"] != span.span_id
135+
assert error_event["contexts"]["trace"]["trace_id"] == root_span.trace_id
136+
assert error_event["contexts"]["trace"]["span_id"] != root_span.span_id
137137
assert error_event["transaction"] == "dummy_task"
138138
assert "celery_task_id" in error_event["tags"]
139139
assert error_event["extra"]["celery-job"] == dict(
@@ -195,12 +195,12 @@ def dummy_task(x, y):
195195

196196
events = capture_events()
197197

198-
with sentry_sdk.start_span(name="submission") as span:
198+
with sentry_sdk.start_span(name="submission") as root_span:
199199
celery_invocation(dummy_task, 1, 0 if task_fails else 1)
200200

201201
if task_fails:
202202
error_event = events.pop(0)
203-
assert error_event["contexts"]["trace"]["trace_id"] == span.trace_id
203+
assert error_event["contexts"]["trace"]["trace_id"] == root_span.trace_id
204204
assert error_event["exception"]["values"][0]["type"] == "ZeroDivisionError"
205205

206206
execution_event, submission_event = events
@@ -211,8 +211,8 @@ def dummy_task(x, y):
211211
assert submission_event["transaction_info"] == {"source": "custom"}
212212

213213
assert execution_event["type"] == submission_event["type"] == "transaction"
214-
assert execution_event["contexts"]["trace"]["trace_id"] == span.trace_id
215-
assert submission_event["contexts"]["trace"]["trace_id"] == span.trace_id
214+
assert execution_event["contexts"]["trace"]["trace_id"] == root_span.trace_id
215+
assert submission_event["contexts"]["trace"]["trace_id"] == root_span.trace_id
216216

217217
if task_fails:
218218
assert execution_event["contexts"]["trace"]["status"] == "internal_error"
@@ -221,7 +221,7 @@ def dummy_task(x, y):
221221

222222
assert len(execution_event["spans"]) == 1
223223
assert execution_event["spans"][0] == ApproxDict({
224-
"trace_id": str(span.trace_id),
224+
"trace_id": str(root_span.trace_id),
225225
"op": "queue.process",
226226
"description": "dummy_task",
227227
})
@@ -235,7 +235,7 @@ def dummy_task(x, y):
235235
"span_id": submission_event["spans"][0]["span_id"],
236236
"start_timestamp": submission_event["spans"][0]["start_timestamp"],
237237
"timestamp": submission_event["spans"][0]["timestamp"],
238-
"trace_id": str(span.trace_id),
238+
"trace_id": str(root_span.trace_id),
239239
"status": "ok",
240240
"tags": {
241241
"status": "ok",

0 commit comments

Comments
 (0)