|
28 | 28 | use Symfony\Component\HttpFoundation\Response; |
29 | 29 | use Symfony\Component\HttpKernel\DataCollector\DataCollector; |
30 | 30 |
|
| 31 | +/** @internal */ |
31 | 32 | final class MongoDBDataCollector extends DataCollector |
32 | 33 | { |
33 | 34 | /** |
@@ -63,23 +64,20 @@ public function collect(Request $request, Response $response, ?\Throwable $excep |
63 | 64 | 'startedAt' => hrtime(true), |
64 | 65 | 'commandName' => $event->getCommandName(), |
65 | 66 | 'command' => $command, |
66 | | - // 'server' => $event->getServer()->getInfo(), |
67 | 67 | 'operationId' => $event->getOperationId(), |
68 | 68 | 'database' => $event->getDatabaseName(), |
69 | 69 | 'serviceId' => $event->getServiceId(), |
70 | 70 | ]; |
71 | 71 | ++$requestCount; |
72 | 72 | } elseif ($event instanceof CommandSucceededEvent) { |
73 | 73 | $requests[$requestId] += [ |
74 | | - // 'reply' => Document::fromPHP($event->getReply()), |
75 | 74 | 'duration' => $event->getDurationMicros(), |
76 | 75 | 'endedAt' => hrtime(true), |
77 | 76 | 'success' => true, |
78 | 77 | ]; |
79 | 78 | $totalTime += $event->getDurationMicros(); |
80 | 79 | } elseif ($event instanceof CommandFailedEvent) { |
81 | 80 | $requests[$requestId] += [ |
82 | | - // 'reply' => Document::fromPHP($event->getReply()), |
83 | 81 | 'duration' => $event->getDurationMicros(), |
84 | 82 | 'error' => $event->getError(), |
85 | 83 | 'success' => false, |
@@ -127,6 +125,10 @@ public function getName(): string |
127 | 125 |
|
128 | 126 | public function reset(): void |
129 | 127 | { |
130 | | - // TODO: Implement reset() method. |
| 128 | + $this->data = []; |
| 129 | + |
| 130 | + foreach ($this->clients as ['subscriber' => $subscriber]) { |
| 131 | + $subscriber->reset(); |
| 132 | + } |
131 | 133 | } |
132 | 134 | } |
0 commit comments