File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,27 @@ def test_to_traceparent(sampled):
2929 assert parts [2 ] == "1" if sampled is True else "0" # sampled
3030
3131
32+ @pytest .mark .parametrize ("sampled" , [True , False , None ])
33+ def test_to_w3c_traceparent (sampled ):
34+ transaction = Transaction (
35+ name = "/interactions/other-dogs/new-dog" ,
36+ op = "greeting.sniff" ,
37+ trace_id = "4a77088e323f137c4d96381f35b92cf6" ,
38+ sampled = sampled ,
39+ )
40+
41+ traceparent = transaction .to_w3c_traceparent ()
42+
43+ parts = traceparent .split ("-" )
44+ assert parts [0 ] == "00" # version
45+ assert parts [1 ] == "4a77088e323f137c4d96381f35b92cf6" # trace_id
46+ assert parts [2 ] == transaction .span_id # parent_span_id
47+ if sampled is not True :
48+ assert parts [3 ] == "00" # trace-flags
49+ else :
50+ assert parts [3 ] == "01" # trace-flags
51+
52+
3253@pytest .mark .parametrize ("sampling_decision" , [True , False ])
3354def test_sentrytrace_extraction (sampling_decision ):
3455 sentrytrace_header = "12312012123120121231201212312012-0415201309082013-{}" .format (
You can’t perform that action at this time.
0 commit comments