Skip to content

Commit 989628e

Browse files
authored
Merge pull request #10 from andrew-demb/simplify-check-master-request
Simplify check for master request
2 parents 250ca15 + f6fa2d0 commit 989628e

File tree

3 files changed

+4
-7
lines changed

3 files changed

+4
-7
lines changed

src/Bridge/AppStartSpanListener.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
use Jaeger\Tracer\TracerInterface;
1010
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
1111
use Symfony\Component\HttpKernel\Event\RequestEvent;
12-
use Symfony\Component\HttpKernel\HttpKernelInterface;
1312

1413
class AppStartSpanListener implements EventSubscriberInterface
1514
{
@@ -28,7 +27,7 @@ public static function getSubscribedEvents(): array
2827
public function onRequest(RequestEvent $event)
2928
{
3029
$request = $event->getRequest();
31-
if (HttpKernelInterface::MASTER_REQUEST !== $event->getRequestType()) {
30+
if (false === $event->isMasterRequest()) {
3231
return $this;
3332
}
3433
$this->tracer

src/Bridge/GlobalSpanListener.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
77
use Symfony\Component\HttpKernel\Event\RequestEvent;
88
use Symfony\Component\HttpKernel\Event\TerminateEvent;
9-
use Symfony\Component\HttpKernel\HttpKernelInterface;
109

1110
class GlobalSpanListener implements EventSubscriberInterface
1211
{
@@ -34,7 +33,7 @@ public function onTerminate()
3433

3534
public function onRequest(RequestEvent $event)
3635
{
37-
if (HttpKernelInterface::MASTER_REQUEST !== $event->getRequestType()) {
36+
if (false === $event->isMasterRequest()) {
3837
return $this;
3938
}
4039
$this->handler->start($event->getRequest());

src/Bridge/RequestSpanListener.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
use Symfony\Component\HttpKernel\Event\ExceptionEvent;
1818
use Symfony\Component\HttpKernel\Event\RequestEvent;
1919
use Symfony\Component\HttpKernel\Event\ResponseEvent;
20-
use Symfony\Component\HttpKernel\HttpKernelInterface;
2120

2221
class RequestSpanListener implements EventSubscriberInterface
2322
{
@@ -45,7 +44,7 @@ public static function getSubscribedEvents(): array
4544

4645
public function onResponse(ResponseEvent $event): void
4746
{
48-
if (HttpKernelInterface::MASTER_REQUEST === $event->getRequestType()) {
47+
if ($event->isMasterRequest()) {
4948
return;
5049
}
5150
if ($this->spans->isEmpty()) {
@@ -56,7 +55,7 @@ public function onResponse(ResponseEvent $event): void
5655

5756
public function onRequest(RequestEvent $event): void
5857
{
59-
if (HttpKernelInterface::MASTER_REQUEST === $event->getRequestType()) {
58+
if ($event->isMasterRequest()) {
6059
return;
6160
}
6261
$request = $event->getRequest();

0 commit comments

Comments
 (0)