Skip to content

Commit

Permalink
fix start timestamp in auto root span (#1413)
Browse files Browse the repository at this point in the history
  • Loading branch information
znerol authored Oct 18, 2024
1 parent fd654b9 commit 93f2068
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/SDK/Trace/AutoRootSpan.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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())
Expand Down

0 comments on commit 93f2068

Please sign in to comment.