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 SpanContextcreate(String traceIdHex, String spanIdHex, TraceFlags traceFlags, TraceState traceState, boolean remote, boolean skipIdValidation) Creates a newSpanContextwith the given identifiers and options.private static AutoValue_ImmutableSpanContextcreateInternal(String traceId, String spanId, TraceFlags traceFlags, TraceState traceState, boolean remote, boolean valid) abstract booleanisValid()Returnstrueif thisSpanContextis valid.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface 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 newSpanContextwith 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
SpanContextwith the given identifiers and options.
-
isValid
public abstract boolean isValid()Description copied from interface:SpanContextReturnstrueif thisSpanContextis valid.- Specified by:
isValidin interfaceSpanContext- Returns:
trueif thisSpanContextis valid.
-