Skip to content

Commit bd6b38c

Browse files
committed
Rename connectionId and add extra fields to EventCollector logs
This renames connectionId to server, to avoid ambiguity with serverConnectionId. Additional fields have also been added to the output. Since PHPC 1.19, database name is available on all APM events.
1 parent c2680d2 commit bd6b38c

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

tests/UnifiedSpecTests/EventCollector.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -119,18 +119,17 @@ private function handleCommandMonitoringEvent($event): void
119119
'name' => self::getEventName($event),
120120
'observedAt' => microtime(true),
121121
'commandName' => $event->getCommandName(),
122-
'connectionId' => $event->getHost() . ':' . $event->getPort(),
123-
'requestId' => $event->getRequestId(),
122+
'databaseName' => $event->getDatabaseName(),
124123
'operationId' => $event->getOperationId(),
124+
'requestId' => $event->getRequestId(),
125+
'server' => $event->getHost() . ':' . $event->getPort(),
126+
'serverConnectionId' => $event->getServerConnectionId(),
127+
'serviceId' => $event->getServiceId(),
125128
];
126129

127130
/* Note: CommandStartedEvent.command and CommandSucceededEvent.reply can
128131
* be omitted from logged events. */
129132

130-
if ($event instanceof CommandStartedEvent) {
131-
$log['databaseName'] = $event->getDatabaseName();
132-
}
133-
134133
if ($event instanceof CommandSucceededEvent) {
135134
$log['duration'] = $event->getDurationMicros();
136135
}

0 commit comments

Comments
 (0)