|
| 1 | +.. _pymongo-monitoring: |
| 2 | + |
| 3 | +========== |
| 4 | +Monitoring |
| 5 | +========== |
| 6 | + |
| 7 | +.. facet:: |
| 8 | + :name: genre |
| 9 | + :values: reference |
| 10 | + |
| 11 | +.. meta:: |
| 12 | + :keywords: event, subscribe, listener |
| 13 | + |
| 14 | +.. contents:: On this page |
| 15 | + :local: |
| 16 | + :backlinks: none |
| 17 | + :depth: 2 |
| 18 | + :class: singlecol |
| 19 | + |
| 20 | +Overview |
| 21 | +-------- |
| 22 | + |
| 23 | +In this guide, you can learn how to configure **monitoring** in {+driver-short+}. |
| 24 | +Monitoring is the process of gathering information about your |
| 25 | +application's performance and resource usage as it runs. |
| 26 | +This can help you make informed decisions when designing and debugging your application. |
| 27 | + |
| 28 | +The driver provides information about your application by emitting events. You can |
| 29 | +listen for driver events to monitor your application. |
| 30 | + |
| 31 | +.. note:: Event Logging |
| 32 | + |
| 33 | + This page explains how to monitor your application in code. To learn how to record |
| 34 | + this information to an external log, see :ref:`Logging. <pymongo-logging>` |
| 35 | + |
| 36 | +Event Types |
| 37 | +----------- |
| 38 | + |
| 39 | +The type of event that the driver emits depends on the operation being performed. |
| 40 | +The following table describes the types of events that the driver emits: |
| 41 | + |
| 42 | +.. list-table:: |
| 43 | + :header-rows: 1 |
| 44 | + :widths: 30 70 |
| 45 | + |
| 46 | + * - Event Type |
| 47 | + - Description |
| 48 | + * - Command Events |
| 49 | + - Events related to MongoDB database commands, such as ``find``, ``insert``, |
| 50 | + ``delete``, and ``count``. To learn how to use the {+driver-short+} to run a |
| 51 | + database command, see :ref:`<pymongo-run-command>`. For more information about |
| 52 | + MongoDB database commands, see :manual:`Database Commands </reference/command/>` |
| 53 | + in the {+mdb-server+} manual. |
| 54 | + |
| 55 | + As a security measure, the driver redacts the contents of some |
| 56 | + command events. This protects the sensitive information contained in these command |
| 57 | + events. |
| 58 | + |
| 59 | + * - Server Discovery and Monitoring (SDAM) Events |
| 60 | + - Events related to changes in the state of the MongoDB deployment. |
| 61 | + |
| 62 | + * - Connection Pool Events |
| 63 | + - Events related to the connection pool held by the driver. |
| 64 | + |
| 65 | +For a copmlete list of events the driver emits, see the |
| 66 | +`pymongo.monitoring <{+api-root+}pymongo/monitoring.html>`__ API documentation. |
| 67 | + |
| 68 | +Listening for Events |
| 69 | +-------------------- |
| 70 | + |
| 71 | +To monitor an event, you must |
0 commit comments