Package io.opentelemetry.api.trace
Interface TraceFlags
-
@Immutable public interface TraceFlagsA valid trace flags is a byte or 2 character lowercase hex (base16) String.These options are propagated to all child
spans. These determine features such as whether aSpanshould be traced.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description byteasByte()Returns the byte representation of thisTraceFlags.StringasHex()Returns the lowercase hex (base16) representation of thisTraceFlags.static TraceFlagsfromByte(byte traceFlagsByte)Returns theTraceFlagsconverted from the given byte representation.static TraceFlagsfromHex(CharSequence src, int srcOffset)Returns theTraceFlagsconverted from the given lowercase hex (base16) representation.static TraceFlagsgetDefault()Returns the default (with all flag bits off) byte representation of theTraceFlags.static intgetLength()Returns the length of the lowercase hex (base16) representation of theTraceFlags.static TraceFlagsgetSampled()Returns the lowercase hex (base16) representation of theTraceFlagswith the sampling flag bit on.booleanisSampled()
-
-
-
Method Detail
-
getLength
static int getLength()
Returns the length of the lowercase hex (base16) representation of theTraceFlags.- Returns:
- the length of the lowercase hex (base16) representation of the
TraceFlags.
-
getDefault
static TraceFlags getDefault()
Returns the default (with all flag bits off) byte representation of theTraceFlags.- Returns:
- the default (with all flag bits off) byte representation of the
TraceFlags.
-
getSampled
static TraceFlags getSampled()
Returns the lowercase hex (base16) representation of theTraceFlagswith the sampling flag bit on.- Returns:
- the lowercase hex (base16) representation of the
TraceFlagswith the sampling flag bit on.
-
fromHex
static TraceFlags fromHex(CharSequence src, int srcOffset)
Returns theTraceFlagsconverted from the given lowercase hex (base16) representation.- Parameters:
src- the buffer where the hex (base16) representation of theTraceFlagsis.srcOffset- the offset int buffer.- Returns:
- the
TraceFlagsconverted from the given lowercase hex (base16) representation. - Throws:
NullPointerException- ifsrcis null.IndexOutOfBoundsException- ifsrcis too short.IllegalArgumentException- if invalid characters in thesrc.
-
fromByte
static TraceFlags fromByte(byte traceFlagsByte)
Returns theTraceFlagsconverted from the given byte representation.- Parameters:
traceFlagsByte- the byte representation of theTraceFlags.- Returns:
- the
TraceFlagsconverted from the given byte representation.
-
isSampled
boolean isSampled()
- Returns:
trueif the sampling bit is on for thisTraceFlags, otherwise* false.
-
asHex
String asHex()
Returns the lowercase hex (base16) representation of thisTraceFlags.- Returns:
- the byte representation of the
TraceFlags.
-
asByte
byte asByte()
Returns the byte representation of thisTraceFlags.- Returns:
- the byte representation of the
TraceFlags.
-
-