Skip to content

Commit b91a1cf

Browse files
committed
another test
1 parent 7d0705c commit b91a1cf

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

tests/tracing/test_span_streaming.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -536,6 +536,31 @@ def test_continue_trace_unsampled(sentry_init, capture_envelopes):
536536
assert len(spans) == 0
537537

538538

539+
def test_outgoing_traceparent_and_baggage(sentry_init, capture_envelopes):
540+
sentry_init(
541+
traces_sample_rate=1.0,
542+
_experiments={"trace_lifecycle": "stream"},
543+
)
544+
545+
sentry_sdk.traces.new_trace()
546+
547+
with sentry_sdk.traces.start_span(name="span") as span:
548+
assert span.sampled is True
549+
550+
trace_id = span._trace_id
551+
span_id = span._span_id
552+
553+
traceparent = sentry_sdk.get_traceparent()
554+
assert traceparent == f"{trace_id}-{span_id}-1"
555+
556+
baggage = sentry_sdk.get_baggage()
557+
baggage_items = dict(tuple(item.split("=")) for item in baggage.split(","))
558+
assert "sentry-trace_id" in baggage_items
559+
assert baggage_items["sentry-trace_id"] == trace_id
560+
assert "sentry-sampled" in baggage_items
561+
assert baggage_items["sentry-sampled"] == "true"
562+
563+
539564
def test_trace_decorator(sentry_init, capture_envelopes):
540565
sentry_init(
541566
traces_sample_rate=1.0,

0 commit comments

Comments
 (0)