Class TraceContext
java.lang.Object
com.soklet.TraceContext
Parsed W3C trace context from
traceparent and tracestate HTTP header values.
This type models the normalized trace context understood by Soklet. Future-version extension fields are ignored and not preserved.
- Author:
- Mark Allen
-
Method Summary
Modifier and TypeMethodDescriptionbooleanstatic @NonNull Optional<TraceContext> fromHeaderValues(@Nullable Collection<@NonNull String> traceparentHeaderValues, @Nullable List<@NonNull String> tracestateHeaderValues) Parses W3C trace context from physical HTTP header values.Returns the 16-character lowercase hexadecimal parent identifier.Returns the trace flags as an unsigned 8-bit value represented by anInteger.Returns the 32-character lowercase hexadecimal trace identifier.Returns the normalized W3Ctracestateentries.inthashCode()Is the W3C sampled flag set?toString()Returns this context in W3Ctraceparentheader value form.Returns this context's normalized W3Ctracestateheader value.
-
Method Details
-
fromHeaderValues
public static @NonNull Optional<TraceContext> fromHeaderValues(@Nullable Collection<@NonNull String> traceparentHeaderValues, @Nullable List<@NonNull String> tracestateHeaderValues) Parses W3C trace context from physical HTTP header values.- Parameters:
traceparentHeaderValues- the physicaltraceparentheader valuestracestateHeaderValues- the physicaltracestateheader values, in arrival order- Returns:
- the parsed trace context, or
Optional.empty()if no validtraceparentis available
-
getTraceId
Returns the 32-character lowercase hexadecimal trace identifier.- Returns:
- the trace identifier
-
getParentId
Returns the 16-character lowercase hexadecimal parent identifier.- Returns:
- the parent identifier
-
getTraceFlags
Returns the trace flags as an unsigned 8-bit value represented by anInteger.- Returns:
- the trace flags, in the range
0..255
-
isSampled
-
getTraceStateEntries
Returns the normalized W3Ctracestateentries.- Returns:
- the trace-state entries, or an empty list if none are present
-
toTraceparentHeaderValue
Returns this context in W3Ctraceparentheader value form.- Returns:
- the
traceparentheader value
-
toTracestateHeaderValue
Returns this context's normalized W3Ctracestateheader value.- Returns:
- the
tracestateheader value, orOptional.empty()if none is present
-
toString
-
equals
-
hashCode
-