1414
1515from instana .propagators .http_propagator import HTTPPropagator
1616from instana .span_context import SpanContext
17- from instana .util .ids import header_to_id
17+ from instana .util .ids import header_to_long_id , internal_id
1818
1919
2020class TestHTTPPropagator :
@@ -62,7 +62,6 @@ def test_extract_carrier_dict(
6262 span_id : int ,
6363 _instana_long_tracer_id : str ,
6464 _instana_span_id : str ,
65- _long_tracer_id : int ,
6665 _trace_id : int ,
6766 _span_id : int ,
6867 _traceparent : str ,
@@ -82,7 +81,7 @@ def test_extract_carrier_dict(
8281 assert ctx .correlation_type == "web"
8382 assert not ctx .instana_ancestor
8483 assert ctx .level == 1
85- assert ctx .long_trace_id == header_to_id (_instana_long_tracer_id )
84+ assert ctx .long_trace_id == header_to_long_id (_instana_long_tracer_id )
8685 assert ctx .span_id == _span_id
8786 assert not ctx .synthetic
8887 assert ctx .trace_id == _trace_id
@@ -92,8 +91,8 @@ def test_extract_carrier_dict(
9291
9392 def test_extract_carrier_list (
9493 self ,
95- trace_id : int ,
96- span_id : int ,
94+ _trace_id : int ,
95+ _span_id : int ,
9796 _instana_long_tracer_id : str ,
9897 _instana_span_id : str ,
9998 _traceparent : str ,
@@ -106,8 +105,8 @@ def test_extract_carrier_list(
106105 ("connection" , "keep-alive" ),
107106 ("traceparent" , _traceparent ),
108107 ("tracestate" , _tracestate ),
109- ("X-INSTANA-T" , f"{ trace_id } " ),
110- ("X-INSTANA-S" , f"{ span_id } " ),
108+ ("X-INSTANA-T" , f"{ _trace_id } " ),
109+ ("X-INSTANA-S" , f"{ _span_id } " ),
111110 ("X-INSTANA-L" , "1" ),
112111 ]
113112
@@ -118,9 +117,9 @@ def test_extract_carrier_list(
118117 assert not ctx .instana_ancestor
119118 assert ctx .level == 1
120119 assert not ctx .long_trace_id
121- assert ctx .span_id == span_id
120+ assert ctx .span_id == _span_id
122121 assert not ctx .synthetic
123- assert ctx .trace_id == trace_id
122+ assert ctx .trace_id == internal_id ( _trace_id )
124123 assert not ctx .trace_parent
125124 assert ctx .traceparent == f"00-{ _instana_long_tracer_id } -{ _instana_span_id } -01"
126125 assert ctx .tracestate == _tracestate
@@ -199,7 +198,7 @@ def test_extract_carrier_dict_corrupted_level_header(
199198 assert ctx .correlation_type == "web"
200199 assert not ctx .instana_ancestor
201200 assert ctx .level == 1
202- assert ctx .long_trace_id == header_to_id (_instana_long_tracer_id )
201+ assert ctx .long_trace_id == header_to_long_id (_instana_long_tracer_id )
203202 assert ctx .span_id == _span_id
204203 assert not ctx .synthetic
205204 assert ctx .trace_id == _trace_id
@@ -209,16 +208,16 @@ def test_extract_carrier_dict_corrupted_level_header(
209208
210209 def test_extract_carrier_dict_level_header_not_splitable (
211210 self ,
212- trace_id : int ,
213- span_id : int ,
211+ _trace_id : int ,
212+ _span_id : int ,
214213 _traceparent : str ,
215214 _tracestate : str ,
216215 ) -> None :
217216 carrier = {
218217 "traceparent" : _traceparent ,
219218 "tracestate" : _tracestate ,
220- "X-INSTANA-T" : f"{ trace_id } " ,
221- "X-INSTANA-S" : f"{ span_id } " ,
219+ "X-INSTANA-T" : f"{ _trace_id } " ,
220+ "X-INSTANA-S" : f"{ _span_id } " ,
222221 "X-INSTANA-L" : ["1" ],
223222 }
224223
@@ -229,9 +228,9 @@ def test_extract_carrier_dict_level_header_not_splitable(
229228 assert not ctx .instana_ancestor
230229 assert ctx .level == 1
231230 assert not ctx .long_trace_id
232- assert ctx .span_id == span_id
231+ assert ctx .span_id == _span_id
233232 assert not ctx .synthetic
234- assert ctx .trace_id == trace_id
233+ assert ctx .trace_id == internal_id ( _trace_id )
235234 assert not ctx .trace_parent
236235 assert ctx .traceparent == _traceparent
237236 assert ctx .tracestate == _tracestate
@@ -304,7 +303,7 @@ def test_w3c_off_x_instana_l_0(
304303 # Assert that the traceparent is propagated when it is enabled
305304 if "traceparent" in carrier_header .keys ():
306305 assert ctx .traceparent
307- tp_trace_id = header_to_id (carrier_header ["traceparent" ].split ("-" )[1 ])
306+ tp_trace_id = header_to_long_id (carrier_header ["traceparent" ].split ("-" )[1 ])
308307 else :
309308 assert not ctx .traceparent
310309 tp_trace_id = ctx .trace_id
0 commit comments