diff --git a/Common/Http/Psr/Client/Discovery/Guzzle.php b/Common/Http/Psr/Client/Discovery/Guzzle.php index 8d013c9..d873674 100644 --- a/Common/Http/Psr/Client/Discovery/Guzzle.php +++ b/Common/Http/Psr/Client/Discovery/Guzzle.php @@ -11,7 +11,7 @@ class Guzzle implements DiscoveryInterface { public function available(): bool { - return class_exists(Client::class); + return class_exists(Client::class) && is_a(Client::class, ClientInterface::class, true); } public function create(mixed $options): ClientInterface diff --git a/Trace/AutoRootSpan.php b/Trace/AutoRootSpan.php index ed4f6eb..69790cd 100644 --- a/Trace/AutoRootSpan.php +++ b/Trace/AutoRootSpan.php @@ -8,6 +8,7 @@ use Http\Discovery\Psr17FactoryDiscovery; use Nyholm\Psr7Server\ServerRequestCreator; use OpenTelemetry\API\Behavior\LogsMessagesTrait; +use OpenTelemetry\API\Common\Time\ClockInterface; use OpenTelemetry\API\Globals; use OpenTelemetry\API\Trace\Span; use OpenTelemetry\API\Trace\SpanKind; @@ -47,7 +48,7 @@ public static function create(ServerRequestInterface $request): void : (int) microtime(true); $span = $tracer->spanBuilder($request->getMethod()) ->setSpanKind(SpanKind::KIND_SERVER) - ->setStartTimestamp((int) ($startTime*1_000_000)) + ->setStartTimestamp((int) ($startTime*ClockInterface::NANOS_PER_SECOND)) ->setParent($parent) ->setAttribute(TraceAttributes::URL_FULL, (string) $request->getUri()) ->setAttribute(TraceAttributes::HTTP_REQUEST_METHOD, $request->getMethod())