/** * Encode context into a string. * @param context Span context to encode. * @return Encoded string representing span context. */ public static String contextAsString(JaegerSpanContext context) { int intFlag = context.getFlags() & 0xFF; return new StringBuilder() .append(context.getTraceId()).append(":") .append(Long.toHexString(context.getSpanId())).append(":") .append(Long.toHexString(context.getParentId())).append(":") .append(Integer.toHexString(intFlag)) .toString(); }