Skip to content

Commit 6364173

Browse files
committed
Log serverConnectionId instead of a pseudo connection string as Event::getServer is deprecated
1 parent 8c0ff42 commit 6364173

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

tests/UnifiedSpecTests/EventCollector.php

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ private function handleCommandMonitoringEvent($event): void
120120
'name' => self::getEventName($event),
121121
'observedAt' => microtime(true),
122122
'commandName' => $event->getCommandName(),
123-
'connectionId' => self::getConnectionId($event),
123+
'connectionId' => $event->getServerConnectionId(),
124124
'requestId' => $event->getRequestId(),
125125
'operationId' => $event->getOperationId(),
126126
];
@@ -144,14 +144,6 @@ private function handleCommandMonitoringEvent($event): void
144144
$this->eventList[] = $log;
145145
}
146146

147-
/** @param CommandStartedEvent|CommandSucceededEvent|CommandFailedEvent $event */
148-
private static function getConnectionId($event): string
149-
{
150-
$server = $event->getServer();
151-
152-
return sprintf('%s:%d', $server->getHost(), $server->getPort());
153-
}
154-
155147
private static function getEventName(object $event): string
156148
{
157149
static $eventNamesByClass = null;

0 commit comments

Comments
 (0)