-
Type: Improvement
-
Resolution: Unresolved
-
Priority: Minor - P4
-
None
-
Affects Version/s: None
-
Component/s: APM
-
None
-
PHP Drivers
Add 3 traits in the library to implement the methods of the 3 monitoring interfaces:
- MongoDB\Driver\Monitoring\CommandSubscriber
MongoDB\Driver\Monitoring\LogSubscriber(not for this interface because it has only 1 method)- MongoDB\Driver\Monitoring\SDAMSubscriber
The methods will have an empty body (no-op).
Benefit : the developers can write only the method they need instead of having many no-method in their code.
Trait names:
- MongoDB\Monitoring\CommandEvents
MongoDB\Monitoring\LogEvents- MongoDB\Monitoring\SDAMEvents
Usage:
use MongoDB\Driver\Monitoring\CommandSubscriber; use MongoDB\Driver\Monitoring\CommandStartedEvent; use MongoDB\Monitoring\CommandEvents; class MyCommandSubscriber { use CommandEvents; public commandStarted(CommandStartedEvent $event): void { // Do stuff for this event only } }