Registers a new monitoring event subscriber

# MongoDB\Driver\Monitoring\addSubscriber

(mongodb >=1.3.0)

MongoDB\Driver\Monitoring\addSubscriber — Registers a new monitoring event subscriber

### Descrierea

MongoDB\Driver\Monitoring\addSubscriber ( MongoDB\Driver\Monitoring\Subscriber `$subscriber` ) : void

Registers a new monitoring event subscriber with the driver. Registered subscribers will be notified of monitoring events through specific methods.

> Notă: If the object is already registered, this function is a no-op.

### Parametri

`subscriber` (MongoDB\Driver\Monitoring\Subscriber)

  A monitoring event subscriber object to register.

### Valorile întoarse

Nu este întoarsă nici o valoare.

### Erori/Excepții

- Emite MongoDB\Driver\Exception\InvalidArgumentException în cazul erorilor la interpretarea argumentelor.

### A se vedea și

- MongoDB\Driver\Monitoring\Subscriber
- MongoDB\Driver\Monitoring\CommandSubscriber
- MongoDB\Driver\Monitoring\removeSubscriber() - Unregisters an existing monitoring event subscriber
- Application Performance Monitoring (APM)