Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
cdaguerre committed Nov 6, 2022
1 parent 692dc64 commit ccf4bb7
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,28 @@

use Instrumentation\Tracing\Sampling\TogglableSampler;
use Instrumentation\Tracing\Sampling\Voter\VoterInterface;
use Symfony\Component\Console\Event\ConsoleCommandEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpKernel\Event\RequestEvent;
use Symfony\Component\Messenger\Event\WorkerMessageReceivedEvent;

abstract class AbstractEventSubscriber implements EventSubscriberInterface
{
public static function getSubscribedEvents(): array
{
return [
static::getEventClass() => [['onRequest', 8092]],
static::getEventClass() => [['onEvent', 8092]],
];
}

public function __construct(private TogglableSampler $sampler, private VoterInterface $voter)
{
}

public function onRequest(RequestEvent $event): void
/**
* @param RequestEvent|ConsoleCommandEvent|WorkerMessageReceivedEvent $event
*/
public function onEvent(object $event): void
{
$vote = $this->voter->vote($event);

Expand Down

0 comments on commit ccf4bb7

Please sign in to comment.