Tolerance\Tracer\SpanFactory\HttpFoundation\HttpFoundationSpanFactory::fromIncomingRequest PHP Method

fromIncomingRequest() public method

public fromIncomingRequest ( Request $request ) : Span
$request Symfony\Component\HttpFoundation\Request
return Tolerance\Tracer\Span\Span
    public function fromIncomingRequest(Request $request)
    {
        return new Span($this->getOrGenerateIdentifier($request, 'X-B3-SpanId'), $this->getName($request), $this->getOrGenerateIdentifier($request, 'X-B3-TraceId'), [new Annotation(Annotation::SERVER_RECEIVE, $this->clock->microseconds(), $this->endpointResolver->resolve())], [new BinaryAnnotation('http.host', $request->getHost(), BinaryAnnotation::TYPE_STRING), new BinaryAnnotation('http.scheme', $request->getScheme(), BinaryAnnotation::TYPE_STRING), new BinaryAnnotation('http.path', $request->getPathInfo(), BinaryAnnotation::TYPE_STRING)], $this->getIdentifier($request, 'X-B3-ParentSpanId'), $request->headers->get('X-B3-Flags') == '1', $this->clock->microseconds());
    }

Usage Example

 /**
  * @param GetResponseEvent $event
  */
 public function onKernelRequest(GetResponseEvent $event)
 {
     if (!$event->isMasterRequest()) {
         return;
     }
     $span = $this->httpFoundationSpanFactory->fromIncomingRequest($event->getRequest());
     $this->stack->push($span);
     $this->tracer->trace([$span]);
 }
All Usage Examples Of Tolerance\Tracer\SpanFactory\HttpFoundation\HttpFoundationSpanFactory::fromIncomingRequest