Package io.opentelemetry.api.internal
Class ImmutableSpanContext
java.lang.Object
io.opentelemetry.api.internal.ImmutableSpanContext
- All Implemented Interfaces:
SpanContext
- Direct Known Subclasses:
AutoValue_ImmutableSpanContext
This class is internal and is hence not for public use. Its APIs are unstable and can change at
any time.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic SpanContext
create
(String traceIdHex, String spanIdHex, TraceFlags traceFlags, TraceState traceState, boolean remote, boolean skipIdValidation) Creates a newSpanContext
with the given identifiers and options.private static AutoValue_ImmutableSpanContext
createInternal
(String traceId, String spanId, TraceFlags traceFlags, TraceState traceState, boolean remote, boolean valid) abstract boolean
isValid()
Returnstrue
if thisSpanContext
is valid.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.opentelemetry.api.trace.SpanContext
getSpanId, getSpanIdBytes, getTraceFlags, getTraceId, getTraceIdBytes, getTraceState, isRemote, isSampled
-
Field Details
-
INVALID
-
-
Constructor Details
-
ImmutableSpanContext
public ImmutableSpanContext()
-
-
Method Details
-
createInternal
private static AutoValue_ImmutableSpanContext createInternal(String traceId, String spanId, TraceFlags traceFlags, TraceState traceState, boolean remote, boolean valid) -
create
public static SpanContext create(String traceIdHex, String spanIdHex, TraceFlags traceFlags, TraceState traceState, boolean remote, boolean skipIdValidation) Creates a newSpanContext
with the given identifiers and options.If the traceId or the spanId are invalid (ie. do not conform to the requirements for hexadecimal ids of the appropriate lengths), both will be replaced with the standard "invalid" versions (i.e. all '0's). See
SpanId.isValid(CharSequence)
andTraceId.isValid(CharSequence)
for details.- Parameters:
traceIdHex
- the trace identifier of theSpanContext
.spanIdHex
- the span identifier of theSpanContext
.traceFlags
- the trace flags of theSpanContext
.traceState
- the trace state for theSpanContext
.remote
- the remote flag for theSpanContext
.skipIdValidation
- pass true to skip validation of trace ID and span ID as an optimization in cases where they are known to have been already validated.- Returns:
- a new
SpanContext
with the given identifiers and options.
-
isValid
public abstract boolean isValid()Description copied from interface:SpanContext
Returnstrue
if thisSpanContext
is valid.- Specified by:
isValid
in interfaceSpanContext
- Returns:
true
if thisSpanContext
is valid.
-