/** * Writes all B3 defined fields in the trace context, except {@link TraceContext#parentIdAsLong() * parent ID}, to a hyphen delimited string. * * <p>This is appropriate for receivers who understand "b3" single header format, and always do * work in a child span. For example, message consumers always do work in child spans, so message * producers can use this format to save bytes on the wire. On the other hand, RPC clients should * use {@link #writeB3SingleFormat(TraceContext)} instead, as RPC servers often share a span ID * with the client. */ public static String writeB3SingleFormatWithoutParentId(TraceContext context) { char[] buffer = getCharBuffer(); int length = writeB3SingleFormat(context, 0L, buffer); return new String(buffer, 0, length); }
/** * Like {@link #writeB3SingleFormatWithoutParentId(TraceContext)}, but for carriers with byte * array or byte buffer values. For example, {@link ByteBuffer#wrap(byte[])} can wrap the result. */ public static byte[] writeB3SingleFormatWithoutParentIdAsBytes(TraceContext context) { char[] buffer = getCharBuffer(); int length = writeB3SingleFormat(context, 0L, buffer); return asciiToNewByteArray(buffer, length); }
/** * Writes all B3 defined fields in the trace context to a hyphen delimited string. This is * appropriate for receivers who understand "b3" single header format. * * <p>The {@link TraceContext#parentIdAsLong() parent ID} is serialized in case the receiver is * an RPC server. When downstream is known to be a messaging consumer, or a server that never * reuses a client's span ID, prefer {@link #writeB3SingleFormatWithoutParentId(TraceContext)}. */ public static String writeB3SingleFormat(TraceContext context) { char[] buffer = getCharBuffer(); int length = writeB3SingleFormat(context, context.parentIdAsLong(), buffer); return new String(buffer, 0, length); }
/** * Like {@link #writeB3SingleFormatAsBytes(TraceContext)}, but for carriers with byte array or * byte buffer values. For example, {@link ByteBuffer#wrap(byte[])} can wrap the result. */ public static byte[] writeB3SingleFormatAsBytes(TraceContext context) { char[] buffer = getCharBuffer(); int length = writeB3SingleFormat(context, context.parentIdAsLong(), buffer); return asciiToNewByteArray(buffer, length); }
/** * Writes all B3 defined fields in the trace context, except {@link TraceContext#parentIdAsLong() * parent ID}, to a hyphen delimited string. * * <p>This is appropriate for receivers who understand "b3" single header format, and always do * work in a child span. For example, message consumers always do work in child spans, so message * producers can use this format to save bytes on the wire. On the other hand, RPC clients should * use {@link #writeB3SingleFormat(TraceContext)} instead, as RPC servers often share a span ID * with the client. */ public static String writeB3SingleFormatWithoutParentId(TraceContext context) { char[] buffer = getCharBuffer(); int length = writeB3SingleFormat(context, 0L, buffer); return new String(buffer, 0, length); }
/** * Writes all B3 defined fields in the trace context to a hyphen delimited string. This is * appropriate for receivers who understand "b3" single header format. * * <p>The {@link TraceContext#parentIdAsLong() parent ID} is serialized in case the receiver is * an RPC server. When downstream is known to be a messaging consumer, or a server that never * reuses a client's span ID, prefer {@link #writeB3SingleFormatWithoutParentId(TraceContext)}. */ public static String writeB3SingleFormat(TraceContext context) { char[] buffer = getCharBuffer(); int length = writeB3SingleFormat(context, context.parentIdAsLong(), buffer); return new String(buffer, 0, length); }
/** * Like {@link #writeB3SingleFormatWithoutParentId(TraceContext)}, but for carriers with byte * array or byte buffer values. For example, {@link ByteBuffer#wrap(byte[])} can wrap the result. */ public static byte[] writeB3SingleFormatWithoutParentIdAsBytes(TraceContext context) { char[] buffer = getCharBuffer(); int length = writeB3SingleFormat(context, 0L, buffer); return asciiToNewByteArray(buffer, length); }
/** * Like {@link #writeB3SingleFormatAsBytes(TraceContext)}, but for carriers with byte array or * byte buffer values. For example, {@link ByteBuffer#wrap(byte[])} can wrap the result. */ public static byte[] writeB3SingleFormatAsBytes(TraceContext context) { char[] buffer = getCharBuffer(); int length = writeB3SingleFormat(context, context.parentIdAsLong(), buffer); return asciiToNewByteArray(buffer, length); }