Skip to content

Commit 9c42ada

Browse files
committed
JAVA-2662: Document how to enable JMX connection pool monitoring
1 parent 3f715cd commit 9c42ada

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

docs/reference/content/driver-async/reference/monitoring.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,16 @@ application has multiple `MongoClient` instances connected to the same MongoDB s
3333
- `waitQueueSize`: the current size of the wait queue for a connection from this pool
3434
- `checkedOutCount`: the current count of connections that are currently in use
3535

36+
JMX connection pool monitoring is disabled by default. To enable it add a `com.mongodb.management.JMXConnectionPoolListener` instance via
37+
`MongoClientSettings`:
38+
39+
```java
40+
MongoClientSettings settings =
41+
MongoClientSettings.builder()
42+
.applyToConnectionPoolSettings(builder -> builder.addConnectionPoolListener(new JMXConnectionPoolListener()))
43+
.build();
44+
```
45+
3646
# Command Monitoring
3747

3848
The driver implements the

docs/reference/content/driver/reference/monitoring.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,19 @@ application has multiple `MongoClient` instances connected to the same MongoDB s
3333
- `waitQueueSize`: the current size of the wait queue for a connection from this pool
3434
- `checkedOutCount`: the current count of connections that are currently in use
3535

36+
37+
JMX connection pool monitoring is disabled by default. To enable it add a `com.mongodb.management.JMXConnectionPoolListener` instance via
38+
`MongoClientOptions`:
39+
40+
```java
41+
MongoClientOptions options =
42+
MongoClientOptions.builder()
43+
.addConnectionPoolListener(new JMXConnectionPoolListener())
44+
.build();
45+
46+
47+
```
48+
3649
# Command Monitoring
3750

3851
The driver implements the

0 commit comments

Comments
 (0)