Skip to content

Commit 5fa7e28

Browse files
committed
DOCSP-47042 Monitoring
1 parent 52989b6 commit 5fa7e28

File tree

1 file changed

+51
-43
lines changed

1 file changed

+51
-43
lines changed

source/logging-monitoring/monitoring.txt

Lines changed: 51 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
Monitoring
33
==========
44

5-
6-
75
.. contents:: On this page
86
:local:
97
:backlinks: none
@@ -13,31 +11,26 @@ Monitoring
1311
Overview
1412
--------
1513

16-
.. What is on this page?
17-
1814
In this guide, you can learn how to set up and configure **monitoring** in the
19-
MongoDB Java driver.
20-
21-
.. What do any new terms mean?
15+
{+driver-long+}.
2216

23-
Monitoring is the process of getting information about the activities a running
24-
program performs for use in an application or an application performance
17+
Monitoring is the process of getting information about the activities a
18+
running program performs for use in an application or an application performance
2519
management library.
2620

27-
Monitoring the MongoDB Java driver lets you understand the
28-
driver's resource usage and performance, and can help you make informed
21+
Monitoring your application lets you understand the driver's resource usage
22+
and performance and can help you make informed
2923
decisions when designing and debugging your application.
3024

31-
.. What can you expect to see on this page?
32-
3325
In this guide you will learn how to perform these tasks:
3426

35-
- :ref:`Monitor different types of events in the MongoDB Java Driver <monitoring-monitor-events>`
36-
- :ref:`Monitor connection pool events with Java Management Extensions (JMX) and JConsole <monitoring-jmx>`
27+
- :ref:`Monitor Events <monitoring-monitor-events>`
28+
- :ref:`Monitor Connection Pool Events with Java Management Extensions (JMX)
29+
and JConsole <monitoring-jmx>`
3730

3831
This guide shows how to use information about the activity of the driver in code.
3932
If you would like to learn how to record events in the driver,
40-
consider reading our :doc:`guide on logging </logging>`.
33+
see the {+driver-short+}'s :ref:`Logging <logging>` guide.
4134

4235
.. _monitoring-monitor-events:
4336

@@ -65,8 +58,10 @@ The MongoDB Java driver organizes the events it defines into three categories:
6558

6659
The following sections show how to monitor each event category.
6760

68-
For a full list of the events you can monitor,
69-
`see the event package of the MongoDB Java Driver <{+api+}/apidocs/mongodb-driver-core/com/mongodb/event/package-summary.html>`__.
61+
To learn more about the events you can monitor, `see the event package of the
62+
MongoDB Java Driver <{+api+}/apidocs/mongodb-driver-core/com/mongodb/event/package-summary.html>`__.
63+
64+
.. fix this link text^
7065

7166
.. _command-events-java:
7267

@@ -81,13 +76,16 @@ To monitor command events, write a class that implements the
8176
``CommandListener`` interface and register an instance of that class with your
8277
``MongoClient`` instance.
8378

84-
For more information about MongoDB database commands, see the
85-
:manual:`MongoDB manual entry on database commands </reference/command/>`.
79+
To learn more about MongoDB database commands, see the
80+
:manual:`MongoDB manual entry on database commands </reference/command/>` in the
81+
Server (or MongoDB?) Manual.
82+
83+
.. fix this link ^
8684

8785
.. note:: Internal Commands
8886

89-
The driver does not publish events for commands it calls internally. This
90-
includes database commands the driver uses to monitor your cluster and
87+
The {+driver-short+} does not publish events for commands it calls internally.
88+
This includes database commands the driver uses to monitor your cluster and
9189
commands related to connection establishment (such as the initial ``hello``
9290
command).
9391

@@ -98,6 +96,8 @@ For more information about MongoDB database commands, see the
9896
full list of redacted command events, see the
9997
:spec:`MongoDB command logging and monitoring specification </command-logging-and-monitoring/command-logging-and-monitoring.rst#security>`.
10098

99+
.. ^fix this link
100+
101101
Example
102102
^^^^^^^
103103

@@ -109,7 +109,7 @@ To make a counter, do the following:
109109

110110
#. Make a class with counter functionality that implements the ``CommandListener`` interface.
111111
#. Add an instance of the new class that implements ``CommandListener`` to a ``MongoClientSettings`` object.
112-
#. Configure a ``MongoClient`` instance with the ``MongoClientSettings`` object.
112+
#. Configure a ``MongoClient`` instance by using the ``MongoClientSettings`` object.
113113

114114
The following code defines the ``CommandCounter`` class which implements the
115115
``CommandListener`` interface:
@@ -121,8 +121,8 @@ The following code defines the ``CommandCounter`` class which implements the
121121
:end-before: end command-listener-impl
122122

123123
The following code adds an instance of the ``CommandCounter`` class to a
124-
``MongoClientSettings`` object, and configures a ``MongoClient`` instance with the
125-
``MongoClientSettings`` object. The code then runs some database commands to test the
124+
``MongoClientSettings`` object, and configures a ``MongoClient`` instance by using the
125+
``MongoClientSettings`` object. The code then runs sample ``find()`` commands to test the
126126
counter.
127127

128128
.. _listener-mongo-client-settings-example:
@@ -142,7 +142,7 @@ The preceding code snippet produces output that resembles the following:
142142
{find=2}
143143
{find=2, endSessions=1}
144144

145-
For more information about the classes and methods mentioned in this section, see
145+
To learn more about the classes and methods mentioned in this section, see
146146
the following API Documentation:
147147

148148
- `CommandListener <{+api+}/apidocs/mongodb-driver-core/com/mongodb/event/CommandListener.html>`__
@@ -159,8 +159,8 @@ A server discovery and monitoring (SDAM) event is an event related to a change
159159
in the state of the MongoDB instance or cluster you have connected the driver to.
160160

161161
The driver defines nine SDAM events. The driver divides these nine events
162-
between three separate listener interfaces which each listen for three of the
163-
nine events. Here are the three interfaces and the events they listen for:
162+
between three separate listener interfaces. The following are the three interfaces
163+
and the events they listen for:
164164

165165
- ``ClusterListener``: :spec:`topology </server-discovery-and-monitoring/server-discovery-and-monitoring.md#topology>`
166166
related events
@@ -172,11 +172,14 @@ implements one of the three preceding interfaces and register an instance of tha
172172
class with your ``MongoClient`` instance.
173173

174174
For a detailed description of each SDAM event in the driver, see the
175-
:spec:`MongoDB SDAM Logging and Monitoring Specification </server-discovery-and-monitoring/server-discovery-and-monitoring-logging-and-monitoring.md#events-api>`.
175+
:spec:`MongoDB SDAM Logging and Monitoring Specification
176+
</server-discovery-and-monitoring/server-discovery-and-monitoring-logging-and-monitoring.md#events-api>`.
176177

177178
.. note:: Load Balanced Mode
178179

179-
The driver doesn't emit heartbeat related events when in load balanced mode. For more details about SDAM events with load balancing, see :spec:`MongoDB Load Balancer Support Specification </load-balancers/load-balancers.md#server-discovery-logging-and-monitoring>`.
180+
The driver doesn't emit heartbeat related events when in load balanced mode.
181+
To learn more about SDAM events with load balancing, see
182+
:spec:`MongoDB Load Balancer Support Specification </load-balancers/load-balancers.md#server-discovery-logging-and-monitoring>`.
180183

181184
Example
182185
^^^^^^^
@@ -203,7 +206,8 @@ The following code adds an instance of the ``IsWritable`` class to a
203206
:start-after: start monitor-cluster-example
204207
:end-before: end monitor-cluster-example
205208

206-
The preceding code snippet produces output that resembles the following:
209+
The preceding code snippet produces a confirmation message that resembles the
210+
following:
207211

208212
.. code-block:: none
209213
:copyable: false
@@ -226,8 +230,12 @@ Connection Pool Events
226230
A connection pool event is an event related to a **connection pool** held by the driver.
227231
A connection pool is a set of open TCP connections your driver maintains with
228232
a MongoDB instance. Connection pools help reduce the number of network handshakes
229-
your application needs to perform with a MongoDB instance, and can help your
230-
application run faster.
233+
your application needs to perform with a MongoDB instance and can help your
234+
application run faster.
235+
236+
.. Add when page is ready: To learn more about connection pools, see the {+driver-short+}'s
237+
.. :ref:`Connection Pools <connection-pools>` guide.
238+
231239

232240
To monitor connection pool events, write a class that implements the
233241
``ConnectionPoolListener`` interface and register an instance of that class with your
@@ -240,7 +248,7 @@ This example shows how to make a listener class that prints a message each time
240248
you check out a connection from your connection pool.
241249

242250
The following code defines the ``ConnectionPoolLibrarian`` class which implements the
243-
``ConnectionPoolListener`` interface.
251+
``ConnectionPoolListener`` interface:
244252

245253
.. literalinclude:: /includes/fundamentals/code-snippets/Monitoring.java
246254
:language: java
@@ -250,7 +258,7 @@ The following code defines the ``ConnectionPoolLibrarian`` class which implement
250258

251259
The following code adds an instance of the ``ConnectionPoolLibrarian`` class to a
252260
``MongoClient`` object. The code then runs a database command to test the
253-
librarian.
261+
librarian:
254262

255263
.. literalinclude:: /includes/fundamentals/code-snippets/Monitoring.java
256264
:language: java
@@ -282,8 +290,8 @@ Monitor Connection Pool Events with JMX
282290
You can monitor connection pool events using **Java Management Extensions (JMX)**.
283291
JMX provides tools to monitor applications and devices.
284292

285-
For more information about JMX, see
286-
`the official Oracle JMX documentation <https://docs.oracle.com/javase/tutorial/jmx/index.html>`__.
293+
To learn more information about JMX, see the official
294+
`Oracle JMX documentation <https://docs.oracle.com/javase/tutorial/jmx/index.html>`__.
287295

288296
JMX Support
289297
~~~~~~~~~~~
@@ -333,7 +341,7 @@ MXBeans registered on the platform MBean server have the following properties:
333341
All MXBean instances created by the driver are under the domain
334342
``"org.mongodb.driver"``.
335343

336-
For more information about the topics discussed in this subsection, see the
344+
To learn more about the topics discussed in this subsection, see the
337345
following resources from Oracle:
338346

339347
- `Platform MBean Server Reference Documentation <https://docs.oracle.com/en/java/javase/16/management/overview-java-se-monitoring-and-management.html#GUID-F7B9AB8A-F5A8-472A-AEC6-93B5B7FBE7CE>`__
@@ -358,7 +366,7 @@ the Java Platform.
358366

359367
The following code snippet adds a ``JMXConnectionPoolListener`` to a
360368
``MongoClient`` instance. The code then pauses execution so you can
361-
navigate to JConsole and inspect your connection pools.
369+
navigate to JConsole and inspect your connection pools:
362370

363371
.. literalinclude:: /includes/fundamentals/code-snippets/JMXMonitoring.java
364372
:language: java
@@ -393,13 +401,13 @@ following:
393401
- Exit JConsole by closing the JConsole window
394402
- Stop the Java program running the preceding code snippet
395403

396-
For more information about JMX and JConsole, see the following resources from
404+
To learn more about JMX and JConsole, see the following resources from
397405
Oracle:
398406

399407
- `JConsole Documentation <https://www.oracle.com/technical-resources/articles/java/jconsole.html>`__.
400408
- `Monitoring and Management Guide <https://docs.oracle.com/en/java/javase/16/management/monitoring-and-management-using-jmx-technology.html>`__
401409

402-
For more information about the ``JMXConnectionPoolListener`` class, see
410+
To learn more about the ``JMXConnectionPoolListener`` class, see
403411
the API Documentation for
404412
`JMXConnectionPoolListener <{+api+}/apidocs/mongodb-driver-core/com/mongodb/management/JMXConnectionPoolListener.html>`__.
405413

@@ -418,8 +426,8 @@ include MongoDB event data in the
418426
`Zipkin <https://zipkin.io/>`__ distributed tracing system.
419427

420428
If you do not use Spring Cloud or need to include driver event data in a distributed
421-
tracing system other than Zipkin, you must write a command event listener that
422-
manages `spans <https://docs.spring.io/spring-cloud-sleuth/docs/current-SNAPSHOT/reference/html/getting-started.html#getting-started-terminology>`__
429+
tracing system other than Zipkin, you must write a command event listener that manages
430+
`spans <https://docs.spring.io/spring-cloud-sleuth/docs/current-SNAPSHOT/reference/html/getting-started.html#getting-started-terminology>`__
423431
for your desired distributed tracing system. To see an implementation of such a
424432
listener, see the
425433
:github:`TraceMongoCommandListener

0 commit comments

Comments
 (0)