push() public méthode

Push a span in the stack.
public push ( Span $span ) : Span
$span Tolerance\Tracer\Span\Span
Résultat Tolerance\Tracer\Span\Span
 /**
  * @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]);
 }
Exemple #2
0
 /**
  * {@inheritdoc}
  */
 public function execute(AMQPMessage $msg)
 {
     $span = $this->amqpSpanFactory->fromReceivedMessage($msg);
     $this->tracer->trace([$span]);
     $this->spanStack->push($span);
     $result = $this->decoratedConsumer->execute($msg);
     $this->tracer->trace([$this->amqpSpanFactory->fromConsumedMessage($msg)]);
     $this->spanStack->pop();
     return $result;
 }
 function it_adds_the_span_in_the_stack_during_the_execution(ConsumerInterface $decoratedConsumer, SpanStack $spanStack)
 {
     $message = new AMQPMessage('');
     $spanStack->push(Argument::type(Span::class))->shouldBeCalled();
     $decoratedConsumer->execute($message)->shouldBeCalled();
     $spanStack->pop()->shouldBeCalled();
     $this->execute($message);
 }
 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);
 }