Package io.opentelemetry.api.internal
Class ImmutableSpanContext
- java.lang.Object
-
- io.opentelemetry.api.internal.ImmutableSpanContext
-
- All Implemented Interfaces:
SpanContext
- Direct Known Subclasses:
AutoValue_ImmutableSpanContext
@Immutable public abstract class ImmutableSpanContext extends java.lang.Object implements SpanContext
This class is internal and is hence not for public use. Its APIs are unstable and can change at any time.
-
-
Field Summary
Fields Modifier and Type Field Description static SpanContext
INVALID
-
Constructor Summary
Constructors Constructor Description ImmutableSpanContext()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static SpanContext
create(java.lang.String traceIdHex, java.lang.String spanIdHex, TraceFlags traceFlags, TraceState traceState, boolean remote, boolean skipIdValidation)
Creates a newSpanContext
with the given identifiers and options.private static AutoValue_ImmutableSpanContext
createInternal(java.lang.String traceId, java.lang.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 Detail
-
INVALID
public static final SpanContext INVALID
-
-
Method Detail
-
createInternal
private static AutoValue_ImmutableSpanContext createInternal(java.lang.String traceId, java.lang.String spanId, TraceFlags traceFlags, TraceState traceState, boolean remote, boolean valid)
-
create
public static SpanContext create(java.lang.String traceIdHex, java.lang.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.
-
-