B3MultiPropagator
in package
implements
TextMapPropagatorInterface
B3Multi is a propagator that supports the specification for multiple "b3" http headers used for trace context propagation across service boundaries.
(https://github.com/openzipkin/b3-propagation#multiple-headers)
Table of Contents
Interfaces
Constants
- DEBUG_FLAG = 'X-B3-Flags'
- Debug is encoded as X-B3-Flags: 1.
- FIELDS = [self::TRACE_ID, self::SPAN_ID, self::PARENT_SPAN_ID, self::SAMPLED, self::DEBUG_FLAG]
- IS_NOT_SAMPLED = '0'
- IS_SAMPLED = '1'
- PARENT_SPAN_ID = 'X-B3-ParentSpanId'
- The X-B3-ParentSpanId header must be present on a child span and absent on the root span.
- SAMPLED = 'X-B3-Sampled'
- An accept sampling decision is encoded as X-B3-Sampled: 1 and a deny as X-B3-Sampled: 0.
- SPAN_ID = 'X-B3-SpanId'
- The X-B3-SpanId header is required and is encoded as 16 lower-hex characters.
- TRACE_ID = 'X-B3-TraceId'
- The X-B3-TraceId header is required and is encoded as 32 or 16 lower-hex characters.
- VALID_NON_SAMPLED = [self::IS_NOT_SAMPLED, 'false']
- VALID_SAMPLED = [self::IS_SAMPLED, 'true']
Properties
- $instance : self|null
Methods
- extract() : ContextInterface
- Extracts specific values from the provided carrier into the provided {@see ContextInterface} via an {@see PropagationGetterInterface}.
- fields() : array<int, string>
- Returns list of fields that will be used by this propagator.
- getInstance() : self
- inject() : void
- Injects specific values from the provided {@see ContextInterface} into the provided carrier via an {@see PropagationSetterInterface}.
- extractImpl() : SpanContextInterface
- getSampledValue() : int|null
Constants
DEBUG_FLAG
Debug is encoded as X-B3-Flags: 1.
private
mixed
DEBUG_FLAG
= 'X-B3-Flags'
Absent or any other value can be ignored. Debug implies an accept decision, so don't also send the X-B3-Sampled header.
Tags
FIELDS
private
mixed
FIELDS
= [self::TRACE_ID, self::SPAN_ID, self::PARENT_SPAN_ID, self::SAMPLED, self::DEBUG_FLAG]
IS_NOT_SAMPLED
private
mixed
IS_NOT_SAMPLED
= '0'
IS_SAMPLED
private
mixed
IS_SAMPLED
= '1'
PARENT_SPAN_ID
The X-B3-ParentSpanId header must be present on a child span and absent on the root span.
private
mixed
PARENT_SPAN_ID
= 'X-B3-ParentSpanId'
It is encoded as 16 lower-hex characters. For example, a ParentSpanId header might look like: X-B3-ParentSpanId: 0020000000000001
Tags
SAMPLED
An accept sampling decision is encoded as X-B3-Sampled: 1 and a deny as X-B3-Sampled: 0.
private
mixed
SAMPLED
= 'X-B3-Sampled'
Absent means defer the decision to the receiver of this header. For example, a Sampled header might look like: X-B3-Sampled: 1
Note: Before this specification was written, some tracers propagated X-B3-Sampled as true or false as opposed to 1 or 0. While you shouldn't encode X-B3-Sampled as true or false, a lenient implementation may accept them.
Tags
SPAN_ID
The X-B3-SpanId header is required and is encoded as 16 lower-hex characters.
private
mixed
SPAN_ID
= 'X-B3-SpanId'
For example, a SpanId header might look like: X-B3-SpanId: a2fb4a1d1a96d312 . Unless propagating only the Sampling State, the X-B3-SpanId header is required.
Tags
TRACE_ID
The X-B3-TraceId header is required and is encoded as 32 or 16 lower-hex characters.
private
mixed
TRACE_ID
= 'X-B3-TraceId'
For example, a 128-bit TraceId header might look like: X-B3-TraceId: 463ac35c9f6413ad48485a3953bb6124 . Unless propagating only the Sampling State, the X-B3-TraceId header is required.
Tags
VALID_NON_SAMPLED
private
mixed
VALID_NON_SAMPLED
= [self::IS_NOT_SAMPLED, 'false']
VALID_SAMPLED
private
mixed
VALID_SAMPLED
= [self::IS_SAMPLED, 'true']
Properties
$instance
private
static self|null
$instance
= null
Methods
extract()
Extracts specific values from the provided carrier into the provided {@see ContextInterface} via an {@see PropagationGetterInterface}.
public
extract(mixed $carrier[, PropagationGetterInterface|null $getter = null ][, ContextInterface|null $context = null ]) : ContextInterface
Parameters
- $carrier : mixed
- $getter : PropagationGetterInterface|null = null
- $context : ContextInterface|null = null
Return values
ContextInterfacefields()
Returns list of fields that will be used by this propagator.
public
fields() : array<int, string>
Return values
array<int, string>getInstance()
public
static getInstance() : self
Return values
selfinject()
Injects specific values from the provided {@see ContextInterface} into the provided carrier via an {@see PropagationSetterInterface}.
public
inject(mixed &$carrier[, PropagationSetterInterface|null $setter = null ][, ContextInterface|null $context = null ]) : void
Parameters
- $carrier : mixed
- $setter : PropagationSetterInterface|null = null
- $context : ContextInterface|null = null
extractImpl()
private
static extractImpl(mixed $carrier, PropagationGetterInterface $getter, ContextInterface &$context) : SpanContextInterface
Parameters
- $carrier : mixed
- $getter : PropagationGetterInterface
- $context : ContextInterface
Return values
SpanContextInterfacegetSampledValue()
private
static getSampledValue(mixed $carrier, PropagationGetterInterface $getter) : int|null
Parameters
- $carrier : mixed
- $getter : PropagationGetterInterface