microseconds() public method

Returns the current time in micro-seconds.
public microseconds ( ) : integer
return integer
 /**
  * @param RequestInterface $originalRequest
  * @param ResponseInterface|null $response
  *
  * @return Span
  */
 public function fromIncomingResponse(RequestInterface $originalRequest, ResponseInterface $response = null)
 {
     $span = $originalRequest->getHeader('X-B3-SpanId');
     $trace = $originalRequest->getHeader('X-B3-TraceId');
     if (empty($span) || empty($trace)) {
         throw new \InvalidArgumentException('Unable to find the original request properties');
     }
     return new Span(Identifier::fromString($span), $this->getName($originalRequest), Identifier::fromString($trace), [new Annotation(Annotation::CLIENT_RECEIVE, $this->clock->microseconds(), $this->endpointResolver->resolve())], [new BinaryAnnotation('http.status', $response !== null ? $response->getStatusCode() : 0, BinaryAnnotation::TYPE_INTEGER_16)]);
 }
Esempio n. 2
0
 /**
  * @param AMQPMessage $message
  *
  * @return Span
  */
 public function fromConsumedMessage(AMQPMessage $message)
 {
     return new Span($this->getIdentifierOrGenerate($message, 'X-B3-SpanId'), $this->getMessageName($message), $this->getIdentifierOrGenerate($message, 'X-B3-TraceId'), [new Annotation(Annotation::SERVER_SEND, $this->clock->microseconds(), $this->endpointResolver->resolve())], [], $this->getIdentifier($message, 'X-B3-ParentSpanId'), $this->getMessageHeader($message, 'X-B3-Flags') == '1');
 }
 /**
  * @param Response $response
  * @param Span     $originalSpan
  *
  * @return Span
  */
 public function fromOutgoingResponse(Response $response, Span $originalSpan)
 {
     $timestamp = $this->clock->microseconds();
     return new Span($originalSpan->getIdentifier(), $originalSpan->getName(), $originalSpan->getTraceIdentifier(), [new Annotation(Annotation::SERVER_SEND, $timestamp, $this->endpointResolver->resolve())], [new BinaryAnnotation('http.status', $response->getStatusCode(), BinaryAnnotation::TYPE_INTEGER_16)], $originalSpan->getParentIdentifier(), $originalSpan->getDebug(), $originalSpan->getTimestamp(), $timestamp - $originalSpan->getTimestamp());
 }
Esempio n. 4
0
 /**
  * @param ResponseInterface $response
  * @param Span              $originalSpan
  *
  * @return Span
  */
 public function fromIncomingResponse(Span $originalSpan, ResponseInterface $response = null)
 {
     return new Span($originalSpan->getIdentifier(), $originalSpan->getName(), $originalSpan->getTraceIdentifier(), [new Annotation(Annotation::CLIENT_RECEIVE, $this->clock->microseconds(), $this->endpointResolver->resolve())], [new BinaryAnnotation('http.status', $response !== null ? $response->getStatusCode() : 0, BinaryAnnotation::TYPE_INTEGER_16)], $originalSpan->getParentIdentifier(), $originalSpan->getDebug());
 }