9
9
get_current_span ,
10
10
get_traceparent ,
11
11
is_initialized ,
12
- start_transaction ,
12
+ start_span ,
13
13
set_tags ,
14
14
get_global_scope ,
15
15
get_current_scope ,
@@ -43,23 +43,23 @@ def test_get_current_span_current_scope(sentry_init):
43
43
44
44
45
45
@pytest .mark .forked
46
- def test_get_current_span_current_scope_with_transaction (sentry_init ):
46
+ def test_get_current_span_current_scope_with_span (sentry_init ):
47
47
sentry_init ()
48
48
49
49
assert get_current_span () is None
50
50
51
- with start_transaction () as new_transaction :
52
- assert get_current_span () == new_transaction
51
+ with start_span () as new_span :
52
+ assert get_current_span () == new_span
53
53
54
54
55
55
@pytest .mark .forked
56
56
def test_traceparent_with_tracing_enabled (sentry_init ):
57
57
sentry_init (traces_sample_rate = 1.0 )
58
58
59
- with start_transaction () as transaction :
59
+ with start_span () as span :
60
60
expected_traceparent = "%s-%s-1" % (
61
- transaction .trace_id ,
62
- transaction .span_id ,
61
+ span .trace_id ,
62
+ span .span_id ,
63
63
)
64
64
assert get_traceparent () == expected_traceparent
65
65
@@ -77,51 +77,51 @@ def test_traceparent_with_tracing_disabled(sentry_init):
77
77
78
78
79
79
@pytest .mark .forked
80
- def test_baggage_with_tracing_disabled (sentry_init ):
80
+ def test_baggage_with_tracing_disabled (sentry_init , SortedBaggage ):
81
81
sentry_init (release = "1.0.0" , environment = "dev" )
82
82
propagation_context = get_isolation_scope ()._propagation_context
83
83
expected_baggage = (
84
84
"sentry-trace_id={},sentry-environment=dev,sentry-release=1.0.0" .format (
85
85
propagation_context .trace_id
86
86
)
87
87
)
88
- assert get_baggage () == expected_baggage
88
+ assert get_baggage () == SortedBaggage ( expected_baggage )
89
89
90
90
91
91
@pytest .mark .forked
92
- def test_baggage_with_tracing_enabled (sentry_init ):
92
+ def test_baggage_with_tracing_enabled (sentry_init , SortedBaggage ):
93
93
sentry_init (traces_sample_rate = 1.0 , release = "1.0.0" , environment = "dev" )
94
- with start_transaction () as transaction :
94
+ with start_span () as span :
95
95
expected_baggage = "sentry-trace_id={},sentry-environment=dev,sentry-release=1.0.0,sentry-sample_rate=1.0,sentry-sampled={}" .format (
96
- transaction .trace_id , "true" if transaction .sampled else "false"
96
+ span .trace_id , "true" if span .sampled else "false"
97
97
)
98
- assert get_baggage () == expected_baggage
98
+ assert get_baggage () == SortedBaggage ( expected_baggage )
99
99
100
100
101
101
@pytest .mark .forked
102
102
def test_continue_trace (sentry_init ):
103
- sentry_init ()
103
+ sentry_init (traces_sample_rate = 1.0 )
104
104
105
105
trace_id = "471a43a4192642f0b136d5159a501701"
106
106
parent_span_id = "6e8f22c393e68f19"
107
107
parent_sampled = 1
108
- transaction = continue_trace (
108
+
109
+ with continue_trace (
109
110
{
110
111
"sentry-trace" : "{}-{}-{}" .format (trace_id , parent_span_id , parent_sampled ),
111
112
"baggage" : "sentry-trace_id=566e3688a61d4bc888951642d6f14a19" ,
112
113
},
113
- name = "some name" ,
114
- )
115
- with start_transaction (transaction ):
116
- assert transaction .name == "some name"
117
-
118
- propagation_context = get_isolation_scope ()._propagation_context
119
- assert propagation_context .trace_id == transaction .trace_id == trace_id
120
- assert propagation_context .parent_span_id == parent_span_id
121
- assert propagation_context .parent_sampled == parent_sampled
122
- assert propagation_context .dynamic_sampling_context == {
123
- "trace_id" : "566e3688a61d4bc888951642d6f14a19"
124
- }
114
+ ):
115
+ with start_span (name = "some name" ) as span :
116
+ assert span .name == "some name"
117
+
118
+ propagation_context = get_isolation_scope ()._propagation_context
119
+ assert propagation_context .trace_id == span .trace_id == trace_id
120
+ assert propagation_context .parent_span_id == parent_span_id
121
+ assert propagation_context .parent_sampled == parent_sampled
122
+ assert propagation_context .dynamic_sampling_context == {
123
+ "trace_id" : "566e3688a61d4bc888951642d6f14a19"
124
+ }
125
125
126
126
127
127
@pytest .mark .forked
0 commit comments