@Immutable public final class TraceOptions extends Object
spans
. These determine features such as whether a Span
should
be traced. It is implemented as a bitmask.Modifier and Type | Class and Description |
---|---|
static class |
TraceOptions.Builder
Builder class for
TraceOptions . |
Modifier and Type | Field and Description |
---|---|
static TraceOptions |
DEFAULT
The default
TraceOptions . |
static int |
SIZE
The size in bytes of the
TraceOptions . |
Modifier and Type | Method and Description |
---|---|
static TraceOptions.Builder |
builder()
Returns a new
TraceOptions.Builder with default options. |
static TraceOptions.Builder |
builder(TraceOptions traceOptions)
Returns a new
TraceOptions.Builder with all given options set. |
void |
copyBytesTo(byte[] dest,
int destOffset)
Copies the byte representations of the
TraceOptions into the dest beginning at
the destOffset offset. |
void |
copyLowerBase16To(char[] dest,
int destOffset)
Copies the lowercase base16 representations of the
TraceId into the dest
beginning at the destOffset offset. |
boolean |
equals(Object obj) |
static TraceOptions |
fromByte(byte src)
Returns a
TraceOptions whose representation is src . |
static TraceOptions |
fromBytes(byte[] buffer)
Deprecated.
use
fromByte(byte) . |
static TraceOptions |
fromBytes(byte[] src,
int srcOffset)
Deprecated.
use
fromByte(byte) . |
static TraceOptions |
fromLowerBase16(CharSequence src,
int srcOffset)
Returns a
TraceOption built from a lowercase base16 representation. |
byte |
getByte()
Returns the one byte representation of the
TraceOptions . |
byte[] |
getBytes()
Deprecated.
use
getByte() . |
int |
hashCode() |
boolean |
isSampled()
Returns a boolean indicating whether this
Span is part of a sampled trace and data
should be exported to a persistent store. |
String |
toLowerBase16()
Returns the lowercase base16 encoding of this
TraceOptions . |
String |
toString() |
public static final int SIZE
TraceOptions
.public static final TraceOptions DEFAULT
TraceOptions
.@Deprecated public static TraceOptions fromBytes(byte[] buffer)
fromByte(byte)
.TraceOptions
built from a byte representation.
Equivalent with:
TraceOptions.fromBytes(buffer, 0);
buffer
- the representation of the TraceOptions
.TraceOptions
whose representation is given by the buffer
parameter.NullPointerException
- if buffer
is null.IllegalArgumentException
- if buffer.length
is not SIZE
.@Deprecated public static TraceOptions fromBytes(byte[] src, int srcOffset)
fromByte(byte)
.TraceOptions
whose representation is copied from the src
beginning at
the srcOffset
offset.src
- the buffer where the representation of the TraceOptions
is copied.srcOffset
- the offset in the buffer where the representation of the TraceOptions
begins.TraceOptions
whose representation is copied from the buffer.NullPointerException
- if src
is null.IndexOutOfBoundsException
- if srcOffset+TraceOptions.SIZE
is greater than src.length
.public static TraceOptions fromByte(byte src)
TraceOptions
whose representation is src
.src
- the byte representation of the TraceOptions
.TraceOptions
whose representation is src
.public static TraceOptions fromLowerBase16(CharSequence src, int srcOffset)
TraceOption
built from a lowercase base16 representation.src
- the lowercase base16 representation.srcOffset
- the offset in the buffer where the representation of the TraceOptions
begins.TraceOption
built from a lowercase base16 representation.NullPointerException
- if src
is null.IllegalArgumentException
- if src.length
is not 2 * TraceOption.SIZE
OR
if the str
has invalid characters.public byte getByte()
TraceOptions
.TraceOptions
.@Deprecated public byte[] getBytes()
getByte()
.TraceOptions
.TraceOptions
.public void copyBytesTo(byte[] dest, int destOffset)
TraceOptions
into the dest
beginning at
the destOffset
offset.
Equivalent with (but faster because it avoids any new allocations):
System.arraycopy(getBytes(), 0, dest, destOffset, TraceOptions.SIZE);
dest
- the destination buffer.destOffset
- the starting offset in the destination buffer.NullPointerException
- if dest
is null.IndexOutOfBoundsException
- if destOffset+TraceOptions.SIZE
is greater than
dest.length
.public void copyLowerBase16To(char[] dest, int destOffset)
TraceId
into the dest
beginning at the destOffset
offset.dest
- the destination buffer.destOffset
- the starting offset in the destination buffer.IndexOutOfBoundsException
- if destOffset + 2
is greater than dest.length
.public String toLowerBase16()
TraceOptions
.TraceOptions
.public static TraceOptions.Builder builder()
TraceOptions.Builder
with default options.Builder
with default options.public static TraceOptions.Builder builder(TraceOptions traceOptions)
TraceOptions.Builder
with all given options set.traceOptions
- the given options set.Builder
with all given options set.public boolean isSampled()
Span
is part of a sampled trace and data
should be exported to a persistent store.