src/Event/Listener/Metric/SendMetricOnMessageConsumed.php
public function handle(EventInterface $event)
    {
        if ($event instanceof MessageReceived) {
            $this->messageReceivedAt = $this->clock->timestampInMs();
            return;
        }

        if (!($event instanceof MessageConsumed)) {
            throw ListenerException::badEventGiven($event);
        }

        $this->metricService->increment(
            'daemon.message_consumed'
        );

        $this->metricService->timing(
            'daemon.message_processing_time',
            $this->clock->timestampInMs() - $this->messageReceivedAt
        );
    }
public function handle(EventInterface $event)
    {
        if ($event instanceof MessageReceived) {
            $this->messageReceivedAt = $this->clock->timestampInMs();
            return;
        }

        if (!($event instanceof MessageConsumed)) {
            throw ListenerException::badEventGiven($event);
        }

        $this->metricService->increment(
            'daemon.message_consumed'
        );

        $this->metricService->timing(
            'daemon.message_processing_time',
            $this->clock->timestampInMs() - $this->messageReceivedAt
        );
    }
@param EventInterface | MessageConsumed $event

@throws ListenerException