Package codes.grow.packages.skywalking
Class Sw8
java.lang.Object
codes.grow.packages.skywalking.Sw8
SkyWalking cross-process propagation headers
sw8 (v3) and sw8-correlation:
encoding, decoding and the context helpers used by Sw8Propagator.
sw8 = sample-b64(traceId)-b64(parentSegment)-parentSpanId-b64(service)-
b64(instance)-b64(endpoint)-b64(peer) (8 fields, standard Base64 with padding);
sw8-correlation = b64(key):b64(value),....
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionattributes(Sw8Context sw8) Span attributes describing an extracted parent (sw8.parent.*,sw8.peer).static Optional<Sw8Context> Decodes answ8header value.decodeCorrelation(String header) Decodessw8-correlation; malformed entries are skipped.static Stringencode(Sw8Context ctx) Encodes answ8header value.static StringencodeCorrelation(Map<String, String> entries) Encodessw8-correlationin map order.static Optional<Sw8Context> fromContext(io.opentelemetry.context.Context ctx) Thesw8context extracted from an incoming request bySw8Propagator.static io.opentelemetry.context.ContextwithContext(io.opentelemetry.context.Context ctx, Sw8Context sw8) Returns a context whose outgoing requests carry this native metadata assw8.static io.opentelemetry.context.ContextwithContext(io.opentelemetry.context.Context ctx, Sw8Context sw8, Map<String, String> correlation) LikewithContext(Context, Sw8Context), also writingsw8-correlation.
-
Field Details
-
HEADER
Header name of the SkyWalking v3 trace context.- See Also:
-
CORRELATION_HEADER
Header name of the SkyWalking correlation context.- See Also:
-
PROPAGATOR
Propagator name forTracingConfigpropagators.- See Also:
-
-
Method Details
-
encode
Encodes answ8header value.- Parameters:
ctx- context- Returns:
- the header value
-
decode
Decodes answ8header value.- Parameters:
header- header value (may be null)- Returns:
- the context, or empty when the header is malformed (wrong field count, bad Base64, sample not 0/1, non-integer span id, empty trace or segment id)
-
encodeCorrelation
Encodessw8-correlationin map order.- Parameters:
entries- key/value pairs- Returns:
- the header value
-
decodeCorrelation
Decodessw8-correlation; malformed entries are skipped.- Parameters:
header- header value (may be null)- Returns:
- the entries in header order
-
fromContext
Thesw8context extracted from an incoming request bySw8Propagator.- Parameters:
ctx- OpenTelemetry context- Returns:
- the extracted context, or empty
-
withContext
public static io.opentelemetry.context.Context withContext(io.opentelemetry.context.Context ctx, Sw8Context sw8) Returns a context whose outgoing requests carry this native metadata assw8. The SDK cannot derive native metadata from an OpenTelemetry span; supply it only when you bridge to SkyWalking agents.- Parameters:
ctx- OpenTelemetry contextsw8- native metadata- Returns:
- the new context
-
withContext
public static io.opentelemetry.context.Context withContext(io.opentelemetry.context.Context ctx, Sw8Context sw8, Map<String, String> correlation) LikewithContext(Context, Sw8Context), also writingsw8-correlation.- Parameters:
ctx- OpenTelemetry contextsw8- native metadatacorrelation- correlation entries (written assw8-correlation)- Returns:
- the new context
-
attributes
Span attributes describing an extracted parent (sw8.parent.*,sw8.peer).- Parameters:
sw8- context- Returns:
- the attributes
-