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 a Span
should be traced.
-
Method Summary
Modifier and TypeMethodDescriptionbyte
asByte()
Returns the byte representation of thisTraceFlags
.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
Returns the default (with all flag bits off) byte representation of theTraceFlags
.static int
Returns the length of the lowercase hex (base16) representation of theTraceFlags
.static TraceFlags
Returns the lowercase hex (base16) representation of theTraceFlags
with the sampling flag bit on.boolean
-
Method Details
-
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
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
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
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
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
.
-