/**
  * @param Request $request
  * @param string  $header
  *
  * @return Identifier
  */
 private function getOrGenerateIdentifier(Request $request, $header)
 {
     if (null === ($identifier = $this->getIdentifier($request, $header))) {
         $identifier = $this->identifierGenerator->generate();
     }
     return $identifier;
 }
Example #2
0
 /**
  * @param AMQPMessage $message
  * @param string      $header
  *
  * @return Identifier
  */
 private function getIdentifierOrGenerate(AMQPMessage $message, $header)
 {
     if (null === ($identifier = $this->getIdentifier($message, $header))) {
         $identifier = $this->identifierGenerator->generate();
     }
     return $identifier;
 }
Example #3
0
 function let(IdentifierGenerator $identifierGenerator, Clock $clock, SpanStack $spanStack, EndpointResolver $endpointResolver)
 {
     $identifierGenerator->generate()->willReturn(Identifier::fromString('1234'));
     $this->beConstructedWith($identifierGenerator, $clock, $spanStack, $endpointResolver);
 }
Example #4
0
 /**
  * @param RequestInterface $request
  *
  * @return Span
  */
 public function fromOutgoingRequest(RequestInterface $request)
 {
     $currentSpan = $this->spanStack->current();
     return new Span($this->identifierGenerator->generate(), $this->getName($request), null !== $currentSpan ? $currentSpan->getTraceIdentifier() : $this->identifierGenerator->generate(), [new Annotation(Annotation::CLIENT_SEND, $this->clock->microseconds(), $this->endpointResolver->resolve())], [new BinaryAnnotation('http.host', $request->getUri()->getHost(), BinaryAnnotation::TYPE_STRING), new BinaryAnnotation('http.path', $request->getUri()->getPath(), BinaryAnnotation::TYPE_STRING), new BinaryAnnotation('http.method', $request->getMethod(), BinaryAnnotation::TYPE_STRING)], $currentSpan !== null ? $currentSpan->getIdentifier() : null, $currentSpan !== null ? $currentSpan->getDebug() : null);
 }