Spans and across process boundaries. It contains the identifiers (a trace_id and span_id) associated with the Span and a set of options
(currently only whether the context is sampled or not), as well as the traceState and the remote flag.
Implementations of this interface *must* be immutable and have well-defined value-based
equals/hashCode implementations. If an implementation does not strictly conform to these
requirements, behavior of the OpenTelemetry APIs and default SDK cannot be guaranteed. It is
strongly suggested that you use the implementation that is provided here via create(String, String, TraceFlags, TraceState) or createFromRemoteParent(String,
String, TraceFlags, TraceState).
| Modifier and Type | Method and Description |
|---|---|
| public static SpanContext | Returns: a newSpanContext with the given identifiers and options.the trace identifier of the traceIdHex, String SpanContext.the span identifier of the spanIdHex, TraceFlags SpanContext.the trace flags of the traceFlags, TraceState SpanContext.the trace state for the traceState)SpanContext.Creates a new |
| public static SpanContext | Returns: a newSpanContext with the given identifiers and options.the trace identifier of the traceIdHex, String SpanContext.the span identifier of the spanIdHex, TraceFlags SpanContext.the trace flags of the traceFlags, TraceState SpanContext.the trace state for the traceState)SpanContext.Creates a new |
| public static SpanContext | Returns: the invalidSpanContext.Returns the invalid |
| public String | Returns: the span identifier associated with thisSpanContext as 16 character lowercase
hex (base16) String.Returns the span identifier associated with this |
| public default byte[] | Returns: the span identifier associated with thisSpanContext as 8-byte array.Returns the span identifier associated with this |
| public TraceFlags | Returns: the trace flags associated with thisSpanContext.Returns the trace flags associated with this |
| public String | Returns: the trace identifier associated with thisSpanContext as lowercase hex.Returns the trace identifier associated with this |
| public default byte[] | Returns: the trace identifier associated with thisSpanContext as 16-byte array.Returns the trace identifier associated with this |
| public TraceState | Returns: theTraceState associated with this SpanContext.Returns the |
| public boolean | Returns: true if the SpanContext was propagated from a remote parent.Returns |
| public default boolean | |
| public default boolean |
| create | back to summary |
|---|---|
| public static SpanContext create(String traceIdHex, String spanIdHex, TraceFlags traceFlags, TraceState traceState) Creates a new 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
| |
| createFromRemoteParent | back to summary |
|---|---|
| public static SpanContext createFromRemoteParent(String traceIdHex, String spanIdHex, TraceFlags traceFlags, TraceState traceState) Creates a new 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
| |
| getInvalid | back to summary |
|---|---|
| public static SpanContext getInvalid() Returns the invalid
| |
| getSpanId | back to summary |
|---|---|
| public String getSpanId() Returns the span identifier associated with this
| |
| getSpanIdBytes | back to summary |
|---|---|
| public default byte[] getSpanIdBytes() Returns the span identifier associated with this
| |
| getTraceFlags | back to summary |
|---|---|
| public TraceFlags getTraceFlags() Returns the trace flags associated with this
| |
| getTraceId | back to summary |
|---|---|
| public String getTraceId() Returns the trace identifier associated with this
| |
| getTraceIdBytes | back to summary |
|---|---|
| public default byte[] getTraceIdBytes() Returns the trace identifier associated with this
| |
| getTraceState | back to summary |
|---|---|
| public TraceState getTraceState() Returns the
| |
| isRemote | back to summary |
|---|---|
| public boolean isRemote() Returns
| |
| isSampled | back to summary |
|---|---|
| public default boolean isSampled() Whether the span in this context is sampled. | |
| isValid | back to summary |
|---|---|
| public default boolean isValid() Returns
| |