66import static datadog .trace .bootstrap .instrumentation .api .Tags .SPAN_KIND_PRODUCER ;
77import static datadog .trace .bootstrap .instrumentation .api .Tags .SPAN_KIND_SERVER ;
88import static java .util .Arrays .asList ;
9+ import static java .util .Arrays .copyOfRange ;
910import static java .util .Collections .emptyList ;
1011import static org .junit .jupiter .api .Assertions .assertEquals ;
1112import static org .junit .jupiter .api .Assertions .assertFalse ;
@@ -131,6 +132,9 @@ static final class SpanSpec {
131132 */
132133 boolean use128BitTraceId ;
133134
135+ /** Trace origin carried in the extracted parent context; {@code null} = no origin. */
136+ String origin ;
137+
134138 SpanSpec (
135139 String resourceName ,
136140 String operationName ,
@@ -183,9 +187,6 @@ SpanSpec origin(String origin) {
183187 this .origin = origin ;
184188 return this ;
185189 }
186-
187- /** Trace origin carried in the extracted parent context; {@code null} = no origin. */
188- String origin ;
189190 }
190191
191192 /**
@@ -219,6 +220,13 @@ static final class LinkSpec {
219220 private static final long BASE_MICROS = 1_700_000_000_000_000L ;
220221 private static final long DURATION_MICROS = 500_000L ; // 500 ms
221222
223+ /**
224+ * A known 128-bit trace ID used by {@link SpanSpec#use128BitTraceId} test cases. High-order bits
225+ * are non-zero so the test can assert the proto encodes them correctly.
226+ */
227+ static final DD128bTraceId TRACE_ID_128BIT =
228+ DD128bTraceId .from (0x0123456789abcdefL , 0xfedcba9876543210L );
229+
222230 private static SpanSpec span (String resourceName , String operationName , String spanType ) {
223231 return new SpanSpec (
224232 resourceName ,
@@ -353,10 +361,6 @@ private static SpanSpec linkedSpan(String resourceName, int... targetIndices) {
353361 links );
354362 }
355363
356- /**
357- * A span with one {@link SpanLink} pointing to the span at {@code targetIndex}, carrying the
358- * given {@link SpanAttributes}.
359- */
360364 /**
361365 * A span with one {@link SpanLink} pointing to the span at {@code targetIndex}, carrying the
362366 * given {@link SpanAttributes}.
@@ -617,13 +621,6 @@ void testCollectSpans(String caseName, List<SpanSpec> specs) throws IOException
617621
618622 // ── span construction ─────────────────────────────────────────────────────
619623
620- /**
621- * A known 128-bit trace ID used by {@link SpanSpec#use128BitTraceId} test cases. High-order bits
622- * are non-zero so the test can assert the proto encodes them correctly.
623- */
624- static final DD128bTraceId TRACE_ID_128BIT =
625- DD128bTraceId .from (0x0123456789abcdefL , 0xfedcba9876543210L );
626-
627624 /** Builds {@link DDSpan} instances from the given specs, collecting them in order. */
628625 private static List <DDSpan > buildSpans (List <SpanSpec > specs ) {
629626 List <DDSpan > spans = new ArrayList <>(specs .size ());
@@ -642,7 +639,7 @@ private static List<DDSpan> buildSpans(List<SpanSpec> specs) {
642639 } else if (spec .origin != null ) {
643640 ExtractedContext parentWithOrigin =
644641 new ExtractedContext (
645- DDTraceId .from ( 1L ) ,
642+ DDTraceId .ONE ,
646643 0L ,
647644 PrioritySampling .UNSET ,
648645 spec .origin ,
@@ -848,8 +845,7 @@ private static void verifySpan(CodedInputStream sp, DDSpan span, SpanSpec spec,
848845 assertEquals (16 , parsedTraceId .length , "trace_id must be 16 bytes [" + caseName + "]" );
849846 if (spec .use128BitTraceId ) {
850847 // high-order bytes occupy parsedTraceId[8..15] (little-endian in the wire format)
851- long highOrderBytes =
852- readLittleEndianLong (java .util .Arrays .copyOfRange (parsedTraceId , 8 , 16 ));
848+ long highOrderBytes = readLittleEndianLong (copyOfRange (parsedTraceId , 8 , 16 ));
853849 assertNotEquals (
854850 0L ,
855851 highOrderBytes ,
0 commit comments