Flow PHP

W3CTraceContext implements Propagator

Read onlyYes
FinalYes

W3C Trace Context propagator for distributed tracing.

Implements the W3C Trace Context specification for propagating trace context across service boundaries using HTTP headers.

Headers used:

  • traceparent: {version}-{trace-id}-{parent-id}-{trace-flags}
  • tracestate: Vendor-specific key-value pairs

Example usage:

$propagator = new W3CTraceContext();

// Extract from incoming request
$carrier = new ArrayCarrier($headers);
$ctx = $propagator->extract($carrier);
$spanContext = $ctx->spanContext;

// Inject into outgoing request
$carrier = new ArrayCarrier();
$propagator->inject(new PropagationContext($spanContext), $carrier);
$headers = $carrier->toArray();
Tags
see
https://www.w3.org/TR/trace-context/

Interfaces

Propagator
Interface for propagating context across process boundaries.

Constants

HEADER_TRACEPARENT  = 'traceparent'
HEADER_TRACESTATE  = 'tracestate'

Methods

extract()  : PropagationContext
Extract context from a carrier.
fields()  : array<string|int, string>
Get the list of header/field names this propagator uses.
inject()  : void
Inject context into a carrier.

Constants

Methods

fields()

Get the list of header/field names this propagator uses.

public fields() : array<string|int, string>
Return values
array<string|int, string>

        
On this page

Search results