@@ -5,26 +5,25 @@ import datadog.trace.test.util.DDSpecification
55
66class W3CTraceParentTest extends DDSpecification {
77
8- def " build produces correct format with samplingPriority=#samplingPriority " () {
8+ def " build produces correct format with isSampled=#isSampled " () {
99 when :
10- def result = W3CTraceParent . from(traceId, spanId, samplingPriority )
10+ def result = W3CTraceParent . from(traceId, spanId, isSampled )
1111
1212 then :
1313 result == expected
1414
1515 where :
16- traceId | spanId | samplingPriority | expected
17- DDTraceId . from(1 ) | 2 | 1 | " 00-00000000000000000000000000000001-0000000000000002-01"
18- DDTraceId . from(1 ) | 2 | 0 | " 00-00000000000000000000000000000001-0000000000000002-00"
19- DDTraceId . from(1 ) | 2 | -1 | " 00-00000000000000000000000000000001-0000000000000002-00"
20- DDTraceId . from(1 ) | 2 | 2 | " 00-00000000000000000000000000000001-0000000000000002-01"
21- DDTraceId . fromHex(" 0af7651916cd43dd8448eb211c80319c" ) | 0x00f067aa0ba902b7L | 1 | " 00-0af7651916cd43dd8448eb211c80319c-00f067aa0ba902b7-01"
22- DDTraceId . from(Long . MAX_VALUE ) | Long . MAX_VALUE | 1 | " 00-00000000000000007fffffffffffffff-7fffffffffffffff-01"
16+ traceId | spanId | isSampled | expected
17+ DDTraceId . from(1 ) | 2 | true | " 00-00000000000000000000000000000001-0000000000000002-01"
18+ DDTraceId . from(1 ) | 2 | false | " 00-00000000000000000000000000000001-0000000000000002-00"
19+ DDTraceId . from(1 ) | 2 | true | " 00-00000000000000000000000000000001-0000000000000002-01"
20+ DDTraceId . fromHex(" 0af7651916cd43dd8448eb211c80319c" ) | 0x00f067aa0ba902b7L | true | " 00-0af7651916cd43dd8448eb211c80319c-00f067aa0ba902b7-01"
21+ DDTraceId . from(Long . MAX_VALUE ) | Long . MAX_VALUE | true | " 00-00000000000000007fffffffffffffff-7fffffffffffffff-01"
2322 }
2423
2524 def " build matches W3C traceparent format" () {
2625 when :
27- def result = W3CTraceParent . from(DDTraceId . from(123456789L ), 987654321L , 1 )
26+ def result = W3CTraceParent . from(DDTraceId . from(123456789L ), 987654321L , true )
2827
2928 then :
3029 // W3C format: version-traceId(32 hex)-spanId(16 hex)-flags(2 hex)
0 commit comments