Skip to content

Commit dc9c6e1

Browse files
committed
Fixed event priorities
1 parent 315c226 commit dc9c6e1

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

src/Bridge/ContextInjector.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use Jaeger\Tracer\InjectableInterface;
88
use Symfony\Component\Console\ConsoleEvents;
99
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
10+
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
1011
use Symfony\Component\HttpKernel\KernelEvents;
1112

1213
class ContextInjector implements EventSubscriberInterface
@@ -26,8 +27,8 @@ public function __construct(
2627
public static function getSubscribedEvents()
2728
{
2829
return [
29-
ConsoleEvents::COMMAND => ['onCommand', 1024],
30-
KernelEvents::REQUEST => ['onRequest', 1024],
30+
ConsoleEvents::COMMAND => ['onCommand', 4096],
31+
KernelEvents::REQUEST => ['onRequest', 4096],
3132
];
3233
}
3334

@@ -46,8 +47,12 @@ public function inject(): ContextInjector
4647
return $this;
4748
}
4849

49-
public function onRequest()
50+
public function onRequest(GetResponseEvent $event)
5051
{
52+
if (false === $event->isMasterRequest()) {
53+
return $this;
54+
}
55+
5156
return $this->inject();
5257
}
5358
}

src/Context/Extractor/EnvContextExtractor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function __construct(CodecRegistry $registry, string $format, string $env
3232
public static function getSubscribedEvents()
3333
{
3434
return [
35-
ConsoleEvents::COMMAND => ['onCommand', 2048],
35+
ConsoleEvents::COMMAND => ['onCommand', 8192],
3636
];
3737
}
3838

src/Context/Extractor/HeaderContextExtractor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function __construct(CodecRegistry $registry, string $format, string $hea
3434
public static function getSubscribedEvents()
3535
{
3636
return [
37-
KernelEvents::REQUEST => ['onRequest', 2048],
37+
KernelEvents::REQUEST => ['onRequest', 8192],
3838
];
3939
}
4040

0 commit comments

Comments
 (0)