File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed
dd-trace-core/src/main/java/datadog/trace/core/propagation Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change 1212 */
1313public final class W3CTraceParent {
1414
15+ private static final int TRACE_PARENT_LENGTH = 55 ;
16+
1517 private W3CTraceParent () {}
1618
1719 /**
@@ -25,11 +27,14 @@ private W3CTraceParent() {}
2527 * @return the W3C traceparent header value
2628 */
2729 public static String from (DDTraceId traceId , long spanId , int samplingPriority ) {
28- return "00-"
29- + traceId .toHexString ()
30- + '-'
31- + DDSpanId .toHexStringPadded (spanId )
32- + (samplingPriority > 0 ? "-01" : "-00" );
30+ StringBuilder sb = new StringBuilder (TRACE_PARENT_LENGTH );
31+ sb .append ("00-" );
32+ sb .append (traceId .toHexString ());
33+ sb .append ('-' );
34+ sb .append (DDSpanId .toHexStringPadded (spanId ));
35+ sb .append (samplingPriority > 0 ? "-01" : "-00" );
36+
37+ return sb .toString ();
3338 }
3439
3540 public static String from (AgentSpan span ) {
You can’t perform that action at this time.
0 commit comments