Package org.microproxy.otel
Class Propagators
java.lang.Object
org.microproxy.otel.Propagators
The propagators, by the names
OTEL_PROPAGATORS uses: tracecontext (W3C Trace
Context: traceparent and tracestate), b3 (B3's single b3
header), b3multi (B3's X-B3-* headers) and jaeger (
uber-trace-id). baggage is accepted and leaves the baggage header as it is.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final PropagatorB3 in one header:b3: {trace-id}-{span-id}-{sampled}.static final PropagatorB3 in several headers:X-B3-TraceId,X-B3-SpanId,X-B3-Sampled.static final PropagatorJaeger'suber-trace-id: {trace-id}:{span-id}:{parent-span-id}:{flags}.static final PropagatorW3C Trace Context (traceparent,tracestate), version00. -
Method Summary
Modifier and TypeMethodDescriptionstatic StringformatTraceparent(SpanContext context) Formats atraceparentvalue, version00, with only the sampled flag.static List<Propagator> The propagators named inlist, a comma-separated list as inOTEL_PROPAGATORS:tracecontext,b3,b3multi,jaeger;baggageadds none (baggage passes through untouched), andnonemeans none at all.static SpanContextparseTraceparent(String value) Parses atraceparentvalue as W3C Trace Context says: version00exactly (00-<32 hex>-<16 hex>-<2 hex>, lower-case), or a later version that starts the same way and continues only after a-; never versionff, an all-zero trace id or an all-zero parent id.static StringparseTracestate(List<String> values) Parses thetracestateheader's values (several are joined with commas, as HTTP does): up to 32 list memberskey=value, separated by commas with optional spaces and tabs around them, empty members ignored.
-
Field Details
-
TRACE_CONTEXT
W3C Trace Context (traceparent,tracestate), version00. -
B3
B3 in one header:b3: {trace-id}-{span-id}-{sampled}. -
B3_MULTI
B3 in several headers:X-B3-TraceId,X-B3-SpanId,X-B3-Sampled. -
JAEGER
Jaeger'suber-trace-id: {trace-id}:{span-id}:{parent-span-id}:{flags}.
-
-
Method Details
-
parse
The propagators named inlist, a comma-separated list as inOTEL_PROPAGATORS:tracecontext,b3,b3multi,jaeger;baggageadds none (baggage passes through untouched), andnonemeans none at all.- Parameters:
list- the names- Returns:
- the propagators, in order, without duplicates
- Throws:
IllegalArgumentException- for a name this module does not know
-
parseTraceparent
Parses atraceparentvalue as W3C Trace Context says: version00exactly (00-<32 hex>-<16 hex>-<2 hex>, lower-case), or a later version that starts the same way and continues only after a-; never versionff, an all-zero trace id or an all-zero parent id.- Parameters:
value- the header's value- Returns:
- the remote context, without
tracestate, ornullwhen it is not valid
-
formatTraceparent
Formats atraceparentvalue, version00, with only the sampled flag.- Parameters:
context- the context- Returns:
00-<trace-id>-<span-id>-<flags>
-
parseTracestate
Parses thetracestateheader's values (several are joined with commas, as HTTP does): up to 32 list memberskey=value, separated by commas with optional spaces and tabs around them, empty members ignored. A key is a simple key (a lower-case letter, then up to 255 lower-case letters, digits,_,-,*and/) or a multi-tenant one (tenant@system); a value is 1 to 256 printable characters but,and=, not ending in a space.- Parameters:
values- the header's values- Returns:
- the members joined with commas, an empty string for none, or
nullwhen the list is not valid (a malformed member, a duplicate key, too many members) and must be dropped
-