/**
  * @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]);
 }
Esempio n. 2
0
 /**
  * @param PostResponseEvent $event
  */
 public function onKernelTerminate(PostResponseEvent $event)
 {
     if (!$event->isMasterRequest()) {
         return;
     }
     if ($span = $this->spanStack->pop()) {
         $this->tracer->trace([$this->httpFoundationSpanFactory->fromOutgoingResponse($event->getResponse(), $span)]);
     }
 }
 function it_traces_the_response_and_pop_the_stack(HttpFoundationSpanFactory $httpFoundationSpanFactory, Tracer $tracer, SpanStack $spanStack, Span $span, PostResponseEvent $event)
 {
     $response = new Response();
     $event->isMasterRequest()->willReturn(true);
     $event->getResponse()->willReturn($response);
     $spanStack->pop()->shouldBeCalled()->willReturn($span);
     $httpFoundationSpanFactory->fromOutgoingResponse($response, $span)->shouldBeCalled()->willReturn($span);
     $tracer->trace([$span])->shouldBeCalled();
     $this->onKernelTerminate($event);
 }
 function it_traces_and_add_a_span_to_the_stack(SpanStack $spanStack, Tracer $tracer, HttpFoundationSpanFactory $httpFoundationSpanFactory, GetResponseEvent $event, Span $span)
 {
     $request = Request::create('/');
     $event->getRequest()->willReturn($request);
     $event->isMasterRequest()->willReturn(true);
     $httpFoundationSpanFactory->fromIncomingRequest($request)->willReturn($span);
     $spanStack->push($span)->shouldBeCalled();
     $tracer->trace([$span])->shouldBeCalled();
     $this->onKernelRequest($event);
 }