public function onBefore(BeforeEvent $event)
    {
        $request = $event->getRequest();
        $context = Tracer::spanContext();
        if ($context->enabled()) {
            $request->setHeader($this->propagator->key(), $this->propagator->formatter()->serialize($context));
        }
        $span = Tracer::startSpan([
            'name' => 'GuzzleHttp::request',
            'attributes' => [
                'method' => $request->getMethod(),
                'uri' => $request->getUrl()
            ],
            'kind' => Span::KIND_CLIENT
        ]);
        $this->scope = Tracer::withSpan($span);
    }
public function onBefore(BeforeEvent $event)
    {
        $request = $event->getRequest();
        $context = Tracer::spanContext();
        if ($context->enabled()) {
            $request->setHeader($this->propagator->key(), $this->propagator->formatter()->serialize($context));
        }
        $span = Tracer::startSpan([
            'name' => 'GuzzleHttp::request',
            'attributes' => [
                'method' => $request->getMethod(),
                'uri' => $request->getUrl()
            ],
            'kind' => Span::KIND_CLIENT
        ]);
        $this->scope = Tracer::withSpan($span);
    }
public function onBefore ( BeforeEvent $ event ) { $ request = $ event -> getRequest ( ) ; $ context = Tracer :: spanContext ( ) ; if ( $ context -> enabled ( ) ) { $ request -> setHeader ( $ this -> propagator -> key ( ) , $ this -> propagator -> formatter ( ) -> serialize ( $ context ) ) ; } $ span = Tracer :: startSpan ( [ 'name' => 'GuzzleHttp::request' , 'attributes' => [ 'method' => $ request -> getMethod ( ) , 'uri' => $ request -> getUrl ( ) ] , 'kind' => Span :: KIND_CLIENT ] ) ; $ this -> scope = Tracer :: withSpan ( $ span ) ; }
Handler for the BeforeEvent request lifecycle event. Adds the current trace context
as the trace context header. Also starts a span representing this outgoing http request.

@param BeforeEvent $event Event object emitted before a request is sent
Handler for the BeforeEvent request lifecycle event . Adds the current trace context as the trace context header . Also starts a span representing this outgoing http request .