Skip to content

Commit

Permalink
Log serverConnectionId instead of a pseudo connection string as Event…
Browse files Browse the repository at this point in the history
…::getServer is deprecated
  • Loading branch information
GromNaN committed Sep 19, 2024
1 parent 8c0ff42 commit 6364173
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions tests/UnifiedSpecTests/EventCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ private function handleCommandMonitoringEvent($event): void
'name' => self::getEventName($event),
'observedAt' => microtime(true),
'commandName' => $event->getCommandName(),
'connectionId' => self::getConnectionId($event),
'connectionId' => $event->getServerConnectionId(),
'requestId' => $event->getRequestId(),
'operationId' => $event->getOperationId(),
];
Expand All @@ -144,14 +144,6 @@ private function handleCommandMonitoringEvent($event): void
$this->eventList[] = $log;
}

/** @param CommandStartedEvent|CommandSucceededEvent|CommandFailedEvent $event */
private static function getConnectionId($event): string
{
$server = $event->getServer();

return sprintf('%s:%d', $server->getHost(), $server->getPort());
}

private static function getEventName(object $event): string
{
static $eventNamesByClass = null;
Expand Down

0 comments on commit 6364173

Please sign in to comment.