Skip to content

Commit d6daf15

Browse files
committed
fix: Fix CI
1 parent 270ff43 commit d6daf15

2 files changed

Lines changed: 9 additions & 13 deletions

File tree

sentry_sdk/tracing.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,12 @@ def __init__(
6161
self.timestamp = None
6262

6363
def __repr__(self):
64-
return "<%s(transaction=%r, trace_id=%r, span_id=%r, ref=%r)>" % (
64+
return "<%s(transaction=%r, trace_id=%r, span_id=%r, parent_span_id=%r)>" % (
6565
self.__class__.__name__,
6666
self.transaction,
6767
self.trace_id,
6868
self.span_id,
69-
self.ref,
69+
self.parent_span_id,
7070
)
7171

7272
@classmethod
@@ -112,9 +112,9 @@ def from_traceparent(cls, traceparent):
112112
trace_id, span_id, sampled = match.groups()
113113

114114
if trace_id is not None:
115-
trace_id = int(trace_id, 16)
115+
trace_id = "%x" % (int(trace_id, 16),)
116116
if span_id is not None:
117-
span_id = int(span_id, 16)
117+
span_id = "%x" % (int(span_id, 16),)
118118
if sampled is not None:
119119
sampled = sampled != "0"
120120

tests/integrations/celery/test_celery.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -63,16 +63,14 @@ def dummy_task(x, y):
6363
foo = 42 # noqa
6464
return x / y
6565

66-
span_context = Span.start_trace()
67-
with configure_scope() as scope:
68-
scope.set_span_context(span_context)
66+
span = Hub.current.start_trace()
6967

7068
invocation(dummy_task, 1, 2)
7169
invocation(dummy_task, 1, 0)
7270

7371
event, = events
74-
assert event["contexts"]["trace"]["trace_id"] == span_context.trace_id
75-
assert event["contexts"]["trace"]["span_id"] != span_context.span_id
72+
assert event["contexts"]["trace"]["trace_id"] == span.trace_id
73+
assert event["contexts"]["trace"]["span_id"] != span.span_id
7674
assert event["transaction"] == "dummy_task"
7775
assert event["extra"]["celery-job"] == dict(
7876
task_name="dummy_task", **expected_context
@@ -92,13 +90,11 @@ def test_simple_no_propagation(capture_events, init_celery):
9290
def dummy_task():
9391
1 / 0
9492

95-
span_context = Span.start_trace()
96-
with configure_scope() as scope:
97-
scope.set_span_context(span_context)
93+
span = Hub.current.start_trace()
9894
dummy_task.delay()
9995

10096
event, = events
101-
assert event["contexts"]["trace"]["trace_id"] != span_context.trace_id
97+
assert event["contexts"]["trace"]["trace_id"] != span.trace_id
10298
assert event["transaction"] == "dummy_task"
10399
exception, = event["exception"]["values"]
104100
assert exception["type"] == "ZeroDivisionError"

0 commit comments

Comments
 (0)