Package io.opentelemetry.api.trace
Interface TraceFlags
-
@Immutable public interface TraceFlags
A 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 aSpan
should be traced.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description byte
asByte()
Returns the byte representation of thisTraceFlags
.String
asHex()
Returns the lowercase hex (base16) representation of thisTraceFlags
.static TraceFlags
fromByte(byte traceFlagsByte)
Returns theTraceFlags
converted from the given byte representation.static TraceFlags
fromHex(CharSequence src, int srcOffset)
Returns theTraceFlags
converted from the given lowercase hex (base16) representation.static TraceFlags
getDefault()
Returns the default (with all flag bits off) byte representation of theTraceFlags
.static int
getLength()
Returns the length of the lowercase hex (base16) representation of theTraceFlags
.static TraceFlags
getSampled()
Returns the lowercase hex (base16) representation of theTraceFlags
with the sampling flag bit on.boolean
isSampled()
-
-
-
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 theTraceFlags
with the sampling flag bit on.- Returns:
- the lowercase hex (base16) representation of the
TraceFlags
with the sampling flag bit on.
-
fromHex
static TraceFlags fromHex(CharSequence src, int srcOffset)
Returns theTraceFlags
converted from the given lowercase hex (base16) representation.This may throw runtime exceptions if the input is invalid.
- Parameters:
src
- the buffer where the hex (base16) representation of theTraceFlags
is.srcOffset
- the offset int buffer.- Returns:
- the
TraceFlags
converted from the given lowercase hex (base16) representation.
-
fromByte
static TraceFlags fromByte(byte traceFlagsByte)
Returns theTraceFlags
converted from the given byte representation.- Parameters:
traceFlagsByte
- the byte representation of theTraceFlags
.- Returns:
- the
TraceFlags
converted from the given byte representation.
-
isSampled
boolean isSampled()
- Returns:
true
if 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
.
-
-