@@ -31,6 +31,137 @@ To view a list of all metrics produced by MongoDB source and sink
31
31
connectors, see the :ref:`<kafka-monitoring-all-attributes>` section.
32
32
33
33
.. _kafka-monitoring-information:
34
+ .. _kafka-monitoring-use-cases:
35
+
36
+ Use Cases
37
+ ---------
38
+
39
+ This section describes use cases for monitoring MongoDB source and sink
40
+ connectors, and how you can use the metrics your connector provides
41
+ to satisfy those use cases.
42
+
43
+ .. tip:: Computed Values
44
+
45
+ To learn what types of metrics the connector provides and when
46
+ you must implement logic to compute a value, see
47
+ :ref:`<kafka-monitoring-types-of-metrics>`.
48
+
49
+ Sink Connector
50
+ ~~~~~~~~~~~~~~
51
+
52
+ The following table describes some use cases for monitoring the MongoDB
53
+ sink connector and the metrics the sink connector provides
54
+ to satisfy those use cases:
55
+
56
+ .. list-table::
57
+ :header-rows: 1
58
+ :widths: 40 60
59
+
60
+ * - Use Case
61
+ - Metrics to Use
62
+
63
+ * - You need to know if a component of your pipeline is falling behind.
64
+ - Use the ``latest-kafka-time-difference-ms``
65
+ metric. This metric indicates the interval of time between
66
+ when a record arrived in a Kafka topic and when your connector
67
+ received that record. If the value of this metric is increasing,
68
+ it signals that there may be a problem with {+ak+} or MongoDB.
69
+
70
+ * - You need to know the total number of records your connector
71
+ wrote to MongoDB.
72
+ - Use the ``records`` metric.
73
+
74
+ * - You need to know the total number of write errors your connector
75
+ encountered when attempting to write to MongoDB.
76
+ - Use the ``batch-writes-failed`` metric.
77
+
78
+ * - You need to know if your MongoDB performance is getting slower
79
+ over time.
80
+ - Use the ``in-task-put-duration-ms`` metric to initally diagnose
81
+ a slowdown.
82
+
83
+ Use the following metrics to further diagnose any issues:
84
+
85
+ - ``batch-writes-successful-duration-over-<number>-ms``
86
+ - ``batch-writes-failed-duration-over-<number>-ms``
87
+ - ``processing-phase-duration-over-<number>-ms``
88
+
89
+ * - You need to find a bottleneck in how {+kc+} and your MongoDB sink
90
+ connector write {+ak+} records to MongoDB.
91
+ - Compare the values of the following metrics:
92
+
93
+ - ``in-task-put-duration-ms``
94
+ - ``in-connect-framework-duration-ms``
95
+
96
+ You can find descriptions of all MongoDB sink connector metrics in the
97
+ :ref:`<kafka-monitoring-sink-attributes>` section.
98
+
99
+ Source Connector
100
+ ~~~~~~~~~~~~~~~~
101
+
102
+ The following table describes some use cases for monitoring the MongoDB
103
+ source connector and the metrics the source connector provides
104
+ to satisfy those use cases:
105
+
106
+ .. list-table::
107
+ :header-rows: 1
108
+ :widths: 40 60
109
+
110
+ * - Use Case
111
+ - Metrics to Use
112
+
113
+ * - You need to know if a component of your pipeline is falling behind.
114
+ - Use the ``latest-mongodb-time-difference-secs``
115
+ metric. This metric indicates how old the most recent change
116
+ stream event your connector processed is. If this metric is increasing,
117
+ it signals that there may be a problem with {+ak+} or MongoDB.
118
+
119
+ * - You need to know the total number of change stream events your source connector
120
+ has processed.
121
+ - Use the ``records`` metric.
122
+
123
+ * - You need to know the percentage of records your connector
124
+ received but failed to write to {+ak+}.
125
+ - Perform the following calculation with the ``records``,
126
+ ``records-filtered``, and ``records-acknowledged`` metrics:
127
+
128
+ .. code-block:: text
129
+
130
+ (records - (records-acknowledged + records-filtered)) / records
131
+
132
+ * - You need to know the average size of the documents your connector
133
+ has processed.
134
+ - Perform the following calculation with the ``mongodb-bytes-read`` and
135
+ ``records`` metrics:
136
+
137
+ .. code-block:: text
138
+
139
+ mongodb-bytes-read / records
140
+
141
+ To learn how to calculate the average size of records over a span of
142
+ time, see :ref:`mongodb-bytes-read <kafka-monitoring-averge-record-size-span>`.
143
+
144
+ * - You need to find a bottleneck in how {+kc+} and your MongoDB source
145
+ connector write MongoDB documents to {+ak+}.
146
+ - Compare the values of the following metrics:
147
+
148
+ - ``in-task-poll-duration-ms``
149
+ - ``in-connect-framework-duration-ms``
150
+
151
+ * - You need to know if your MongoDB performance is getting slower
152
+ over time.
153
+ - Use the ``in-task-poll-duration-ms`` metric to initially diagnose
154
+ a slowdown.
155
+
156
+ Use the following metrics to further diagnose any issues:
157
+
158
+ - ``initial-commands-successful-duration-over-<number>-ms``
159
+ - ``initial-commands-failed-duration-over-<number>-ms``
160
+ - ``getmore-commands-successful-duration-over-<number>-ms``
161
+ - ``getmore-commands-failed-duration-over-<number>-ms``
162
+
163
+ You can find descriptions of all MongoDB source connector metrics in the
164
+ :ref:`<kafka-monitoring-source-attributes>` section.
34
165
35
166
Monitor the Connector
36
167
---------------------
@@ -79,6 +210,28 @@ To learn how to enable JMX for a containerized {+kc+}
79
210
deployment, see
80
211
`Kafka Monitoring and Metrics Using JMX with Docker <https://docs.confluent.io/platform/current/installation/docker/operations/monitoring.html>`__.
81
212
213
+ .. _kafka-monitoring-types-of-metrics:
214
+
215
+ Types of Metrics
216
+ ~~~~~~~~~~~~~~~~
217
+
218
+ The connector provides metrics related to the following
219
+ types of quantities:
220
+
221
+ - The number of times an event has occurred in total for a connector task
222
+ - The value related to the most recent occurrence of an event
223
+
224
+ For some use cases, you must perform extra computations with the
225
+ metrics the connector provides. For example, you must compute the
226
+ following values from provided metrics:
227
+
228
+ - The rate of change of a metric
229
+ - The value of a metric over a span of time
230
+ - The difference between one metric and another metric
231
+
232
+ To view some examples of computed metrics, see the
233
+ :ref:`<kafka-monitoring-use-cases>` section.
234
+
82
235
JMX Paths
83
236
~~~~~~~~~
84
237
@@ -454,7 +607,9 @@ Source Connector JMX Metrics
454
607
- The total number of bytes a MongoDB source task read from the
455
608
MongoDB server.
456
609
457
- .. tip:: Average Record size
610
+ .. _kafka-monitoring-averge-record-size-span:
611
+
612
+ .. tip:: Average Record Size Over a Span of Time
458
613
459
614
To calculate the average size of the records your sink connector
460
615
processed over a span of time, perform the following actions:
0 commit comments