pop() public method

Pop a span from the stack.
public pop ( ) : Span | null
return Tolerance\Tracer\Span\Span | null
示例#1
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)]);
     }
 }
示例#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_do_not_trace_if_no_request_in_stack(Tracer $tracer, SpanStack $spanStack, Span $span, PostResponseEvent $event)
 {
     $event->isMasterRequest()->willReturn(true);
     $spanStack->pop()->willReturn(null);
     $tracer->trace(Argument::any())->shouldNotBeCalled();
     $this->onKernelTerminate($event);
 }
示例#4
0
 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);
 }