@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. |
boolean |
equals(Object obj) |
static TraceOptions |
fromBytes(byte[] buffer)
Returns a
TraceOptions built from a byte representation. |
static TraceOptions |
fromBytes(byte[] src,
int srcOffset)
Returns a
TraceOptions whose representation is copied from the src beginning at
the srcOffset offset. |
byte[] |
getBytes()
Returns the 1-byte array representation of the
TraceOptions . |
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 |
toString() |
public static final int SIZE
TraceOptions
.public static final TraceOptions DEFAULT
TraceOptions
.public static TraceOptions fromBytes(byte[] buffer)
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
.public static TraceOptions fromBytes(byte[] src, int srcOffset)
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 byte[] getBytes()
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 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.