@@ -23,26 +23,26 @@ private W3CTraceParent() {}
2323 *
2424 * @param traceId the trace id
2525 * @param spanId the span id
26- * @param samplingPriority the sampling priority (positive values result in sampled flag set)
26+ * @param isSampled whether the trace was sampled or not
2727 * @return the W3C traceparent header value
2828 */
29- public static String from (DDTraceId traceId , long spanId , int samplingPriority ) {
29+ public static String from (DDTraceId traceId , long spanId , boolean isSampled ) {
3030 StringBuilder sb = new StringBuilder (TRACE_PARENT_LENGTH );
3131 sb .append ("00-" );
3232 sb .append (traceId .toHexString ());
3333 sb .append ('-' );
3434 sb .append (DDSpanId .toHexStringPadded (spanId ));
35- sb .append (samplingPriority > 0 ? "-01" : "-00" );
35+ sb .append (isSampled ? "-01" : "-00" );
3636
3737 return sb .toString ();
3838 }
3939
4040 public static String from (AgentSpan span ) {
41- return from (span .getTraceId (), span .getSpanId (), span .context ().getSamplingPriority ());
41+ return from (span .getTraceId (), span .getSpanId (), span .context ().getSamplingPriority () > 0 );
4242 }
4343
4444 public static String from (DDSpanContext spanContext ) {
4545 return from (
46- spanContext .getTraceId (), spanContext .getSpanId (), spanContext .getSamplingPriority ());
46+ spanContext .getTraceId (), spanContext .getSpanId (), spanContext .getSamplingPriority () > 0 );
4747 }
4848}
0 commit comments