TextMapCodec implements Codec<TextMap> { public static String contextAsString(JaegerSpanContext context) { int intFlag = context.getFlags() & 0xFF; return new StringBuilder() .append(context.getTraceId()).append(":") .append(Utils.to16HexString(context.getSpanId())).append(":") .append(context.getParentId() == 0 ? "0" : Utils.to16HexString(context.getParentId())).append(":") .append(Integer.toHexString(intFlag)) .toString(); } TextMapCodec(boolean urlEncoding); private  TextMapCodec(Builder builder); static String contextAsString(JaegerSpanContext context); @Override void inject(JaegerSpanContext spanContext, TextMap carrier); @Override JaegerSpanContext extract(TextMap carrier); @Override String toString(); static Builder builder();  }
@Test public void testContextAsStringWith128BitTraceId() { long traceIdLow = 1L; long traceIdHigh = 2L; long spanId = 3L; long parentId = 4L; byte flags = (byte) 5; JaegerSpanContext context = new JaegerSpanContext(traceIdHigh, traceIdLow, spanId, parentId, flags); assertEquals( "00000000000000020000000000000001:0000000000000003:0000000000000004:5", TextMapCodec.contextAsString(context)); }