Skip to content

Commit a4d21aa

Browse files
committed
Refactored inehritance and application start
1 parent ed46843 commit a4d21aa

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/Bridge/ContextInjector.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
1919
use Symfony\Component\HttpKernel\HttpKernelInterface;
2020
use Symfony\Component\HttpKernel\KernelEvents;
21+
use Symfony\Component\HttpKernel\KernelInterface;
2122
use Symfony\Component\Routing\RouterInterface;
2223

2324
class ContextInjector implements EventSubscriberInterface
@@ -122,12 +123,6 @@ public function onRequest(GetResponseEvent $event)
122123
&& $request->headers->has($this->headerName)
123124
&& ($context = $this->registry[$this->format]->decode($request->headers->get($this->headerName)))) {
124125
$this->injectable->assign($context);
125-
126-
if ($request->server->has('REQUEST_TIME_FLOAT')) {
127-
$span = $this->tracer->start('symfony.start')
128-
->start((int)($request->server->get('REQUEST_TIME_FLOAT') * 1000000));
129-
$this->tracer->finish($span);
130-
}
131126
}
132127

133128
$this->spans->push(
@@ -139,8 +134,16 @@ public function onRequest(GetResponseEvent $event)
139134
new HttpUriTag($request->getRequestUri()),
140135
]
141136
)
137+
->start((int)($request->server->get('REQUEST_TIME_FLOAT', time()) * 1000000))
142138
);
143139

140+
if (HttpKernelInterface::MASTER_REQUEST === $event->getRequestType()) {
141+
$span = $this->tracer
142+
->start('app.start')
143+
->start((int)($request->server->get('REQUEST_TIME_FLOAT', time()) * 1000000));
144+
$this->tracer->finish($span);
145+
}
146+
144147
return $this;
145148
}
146149
}

0 commit comments

Comments
 (0)