/** Returns {@code $traceId.$spanId<:$parentId} */ @Override public String toString() { char[] result = new char[(3 * 16) + 3]; // 3 ids and the constant delimiters writeHexLong(result, 0, traceId); result[16] = '.'; writeHexLong(result, 17, spanId); result[33] = '<'; result[34] = ':'; writeHexLong(result, 35, parentId); return new String(result); }
/** Returns {@code $traceId.$spanId<:$parentId} */ @Override public String toString() { boolean traceHi = traceIdHigh != 0; char[] result = new char[((traceHi ? 4 : 3) * 16) + 3]; // 3 ids and the constant delimiters int pos = 0; if (traceHi) { writeHexLong(result, pos, traceIdHigh); pos += 16; } writeHexLong(result, pos, traceId); pos += 16; result[pos++] = '.'; writeHexLong(result, pos, spanId); pos += 16; result[pos++] = '<'; result[pos++] = ':'; writeHexLong(result, pos, parentId); return new String(result); }
/** * Returns the hex representation of the span's trace ID * * @since 3.15 */ public String traceIdString() { if (traceIdHigh != 0) { char[] result = new char[32]; writeHexLong(result, 0, traceIdHigh); writeHexLong(result, 16, traceId); return new String(result); } char[] result = new char[16]; writeHexLong(result, 0, traceId); return new String(result); }