Skip to content

Commit dbb0c52

Browse files
authored
test: Add streaming propagation tests (getsentry#6782)
### Description Some tests in this file were testing the unsupported case of using a top-level `start_span` (instead of `start_transaction`) and checking that the resulting span then doesn't produce propagation headers. As this case now has no counterpart in span streaming, I didn't port those tests. #### Issues Part of getsentry#5395 #### Reminders - Please add tests to validate your changes, and lint your code using `uv run ruff`. - Add GH Issue ID _&_ Linear ID (if applicable) - PR title should use [conventional commit](https://develop.sentry.dev/engineering-practices/commit-messages/#type) style (`feat:`, `fix:`, `ref:`, `meta:`) - For external contributors: [CONTRIBUTING.md](https://github.com/getsentry/sentry-python/blob/master/CONTRIBUTING.md), [Sentry SDK development docs](https://develop.sentry.dev/sdk/), [Discord community](https://discord.gg/Ww9hbqr)
1 parent 59d643d commit dbb0c52

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

tests/tracing/test_propagation.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,15 @@ def test_span_in_transaction(sentry_init):
3131
next(span.iter_headers())
3232

3333

34+
def test_span_in_transaction_span_streaming(sentry_init):
35+
sentry_init(traces_sample_rate=1.0, _experiments={"trace_lifecycle": "stream"})
36+
37+
with sentry_sdk.traces.start_span(name="test"):
38+
with sentry_sdk.traces.start_span(name="test2") as span:
39+
# Ensure the headers are there
40+
next(span._iter_headers())
41+
42+
3443
def test_span_in_span_in_transaction(sentry_init):
3544
sentry_init(traces_sample_rate=1.0)
3645

@@ -39,3 +48,13 @@ def test_span_in_span_in_transaction(sentry_init):
3948
with sentry_sdk.start_span(op="test3") as span_inner:
4049
# Ensure the headers are there
4150
next(span_inner.iter_headers())
51+
52+
53+
def test_span_in_span_in_transaction_span_streaming(sentry_init):
54+
sentry_init(traces_sample_rate=1.0, _experiments={"trace_lifecycle": "stream"})
55+
56+
with sentry_sdk.traces.start_span(name="test"):
57+
with sentry_sdk.traces.start_span(name="test2"):
58+
with sentry_sdk.traces.start_span(name="test3") as span_inner:
59+
# Ensure the headers are there
60+
next(span_inner._iter_headers())

0 commit comments

Comments
 (0)