Conditions | 2 |
Paths | 2 |
Total Lines | 17 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
22 | public function create( |
||
23 | string $operationName, |
||
24 | ?string $traceIdHeader = null, |
||
25 | ?string $traceStateHeader = null |
||
26 | ): SpanInterface { |
||
27 | $spanBuilder = $this->tracer->spanBuilder($operationName); |
||
28 | |||
29 | if ($traceIdHeader) { |
||
30 | $fields = [ |
||
31 | TraceContextPropagator::TRACEPARENT => $traceIdHeader, |
||
32 | TraceContextPropagator::TRACESTATE => $traceStateHeader ?? null, |
||
33 | ]; |
||
34 | $context = $this->contextPropagator->extract($fields); |
||
35 | $spanBuilder->setParent($context); |
||
36 | } |
||
37 | |||
38 | return $spanBuilder->startSpan(); |
||
39 | } |
||
41 |