Results of 1 - 1 of about 1 for QueryTimeCollector (0.000 sec.)
- Application Performance Monitoring (APM) | PHP 8.3 9414
- Application Performance Monitoring (APM) The extension contains an event subscriber API, which allows applications to monitor commands and internal activity pertaining to the » Server Discovery and Monitoring Specification . This tutorial w
... s and the average time they took. Subscriber Class Scaffolding We start with the framework for our subscriber: <?php class QueryTimeCollector implements \MongoDB\Driver\Monitoring\CommandSubscriber { public function commandStarted ( \MongoDB\Driver\Monitoring\Comm ... ter the subscriber globally or with a specific Manager, respectively. <?php \MongoDB\Driver\Monitoring\addSubscriber ( new QueryTimeCollector () ); ?> Implementing the Logic With the object registered, the only thing left is to implement the logic in the subscribe ... corresponding commandFailed event is encountered, we just remove the entry from the pendingCommands property. <?php class QueryTimeCollector implements \MongoDB\Driver\Monitoring\CommandSubscriber { private $pendingCommands = []; private $queryShapeStats = []; /* ...
-
https://man.mtool.work/php/8.3/mongodb.tutorial.apm.html
PREV
1
NEXT