-
Notifications
You must be signed in to change notification settings - Fork 615
Expand file tree
/
Copy pathtest_propagation.py
More file actions
40 lines (28 loc) · 1.26 KB
/
test_propagation.py
File metadata and controls
40 lines (28 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import sentry_sdk
import pytest
def test_standalone_span_iter_headers(sentry_init):
sentry_init(traces_sample_rate=1.0)
with sentry_sdk.start_span(op="test") as span:
with pytest.raises(StopIteration):
# We should not have any propagation headers
next(span.iter_headers())
def test_span_in_span_iter_headers(sentry_init):
sentry_init(traces_sample_rate=1.0)
with sentry_sdk.start_span(op="test"):
with sentry_sdk.start_span(op="test2") as span_inner:
with pytest.raises(StopIteration):
# We should not have any propagation headers
next(span_inner.iter_headers())
def test_span_in_transaction(sentry_init):
sentry_init(traces_sample_rate=1.0)
with sentry_sdk.start_transaction(op="test"):
with sentry_sdk.start_span(op="test2") as span:
# Ensure the headers are there
next(span.iter_headers())
def test_span_in_span_in_transaction(sentry_init):
sentry_init(traces_sample_rate=1.0)
with sentry_sdk.start_transaction(op="test"):
with sentry_sdk.start_span(op="test2"):
with sentry_sdk.start_span(op="test3") as span_inner:
# Ensure the headers are there
next(span_inner.iter_headers())