From 5dcbd1593b88377b3a638430b2f6a6625b1a46f7 Mon Sep 17 00:00:00 2001 From: rustagir Date: Tue, 17 Sep 2024 14:34:05 -0400 Subject: [PATCH 1/9] DOCSP-41982: cluster monitoring --- source/includes/monitoring/sdam.php | 44 ++++++++ source/index.txt | 1 + source/monitoring.txt | 21 ++++ source/monitoring/cluster-monitoring.txt | 134 +++++++++++++++++++++++ 4 files changed, 200 insertions(+) create mode 100644 source/includes/monitoring/sdam.php create mode 100644 source/monitoring.txt create mode 100644 source/monitoring/cluster-monitoring.txt diff --git a/source/includes/monitoring/sdam.php b/source/includes/monitoring/sdam.php new file mode 100644 index 00000000..02d17c91 --- /dev/null +++ b/source/includes/monitoring/sdam.php @@ -0,0 +1,44 @@ +stream = $stream; + } + public function serverOpening(MongoDB\Driver\Monitoring\ServerOpeningEvent $event): void + { + fwrite($this->stream, sprintf( + 'Server opening on %s:%s%s', + $event->getHost(), + $event->getPort(), + PHP_EOL, + )); + } + public function serverClosed(MongoDB\Driver\Monitoring\ServerClosedEvent $event): void {} + public function serverChanged(MongoDB\Driver\Monitoring\ServerChangedEvent $event): void {} + public function serverHeartbeatFailed(MongoDB\Driver\Monitoring\ServerHeartbeatFailedEvent $event): void {} + public function serverHeartbeatStarted(MongoDB\Driver\Monitoring\ServerHeartbeatStartedEvent $event): void {} + public function serverHeartbeatSucceeded(MongoDB\Driver\Monitoring\ServerHeartbeatSucceededEvent $event): void {} + public function topologyChanged(MongoDB\Driver\Monitoring\TopologyChangedEvent $event): void {} + public function topologyClosed(MongoDB\Driver\Monitoring\TopologyClosedEvent $event): void {} + public function topologyOpening(MongoDB\Driver\Monitoring\TopologyOpeningEvent $event): void {} +} +// end-mysubscriber + +$uri = getenv('MONGODB_URI') ?: throw new RuntimeException('Set the MONGODB_URI variable to your Atlas URI that connects to the sample dataset'); +$client = new MongoDB\Client($uri); + +$database = $client->db; +$collection = $database->my_coll; + +// start-add-sub +$subscriber = new MySubscriber(STDERR); +$client->addSubscriber($subscriber); +// end-add-sub + +$collection->insertOne(['x' => 100]); diff --git a/source/index.txt b/source/index.txt index 95e744a0..042021d3 100644 --- a/source/index.txt +++ b/source/index.txt @@ -16,6 +16,7 @@ MongoDB PHP Library /write /aggregation /indexes + /monitoring /security /tutorial /upgrade diff --git a/source/monitoring.txt b/source/monitoring.txt new file mode 100644 index 00000000..4a6d1191 --- /dev/null +++ b/source/monitoring.txt @@ -0,0 +1,21 @@ +.. _php-monitoring: + +======================== +Monitor Your Application +======================== + +.. toctree:: + :caption: Monitoring categories + + /monitoring/cluster-monitoring + +.. /monitoring/command-monitoring +.. /monitoring/connection-monitoring + +- :ref:`Cluster Monitoring `: monitor changes + in your cluster configuration + +.. TODO - :ref:`Command Monitoring `: monitor command +.. execution +.. - :ref:`Connection Pool Monitoring `: +.. monitor changes in the connection pool \ No newline at end of file diff --git a/source/monitoring/cluster-monitoring.txt b/source/monitoring/cluster-monitoring.txt new file mode 100644 index 00000000..fa503e06 --- /dev/null +++ b/source/monitoring/cluster-monitoring.txt @@ -0,0 +1,134 @@ +.. _php-cluster-monitoring: + +================== +Cluster Monitoring +================== + +.. facet:: + :name: genre + :values: reference + +.. meta:: + :keywords: code example, server, topology + +.. contents:: On this page + :local: + :backlinks: none + :depth: 2 + :class: singlecols + +Overview +-------- + +This guide shows you how to use the {+php-library+} to monitor topology +events in a MongoDB instance, replica set, or sharded cluster. The +driver creates topology events, also known as Server Discovery and +Monitoring (**SDAM**) events, when there are any changes in the state of the +MongoDB instance or cluster that you are connected to. + +You might use information about topology events in your +application to understand cluster changes, assess cluster health, or +perform capacity planning. + +Subscribe to Events +------------------- + +You can access details about SDAM events by subscribing to them +in your application. To subscribe to any event, create a class that +implements the ``MongoDB\Driver\Monitoring\SDAMSubscriber`` interface, +then use the ``MongoDB\Client::addSubscriber()`` method to register the +event subscriber with your ``MongoDB\Client`` instance. + +The following code creates the ``MySubscriber`` class that implements +``SDAMSubscriber`` to output a message when a ``ServerOpeningEvent`` is +generated by the server: + +.. literalinclude:: /includes/monitoring/sdam.php + :start-after: start-mysubscriber + :end-before: end-mysubscriber + :language: php + :copyable: + :dedent: + +.. note:: + + As shown in the preceding code, you must implement all of the methods + of ``SDAMSubscriber``, even for events you are not subscribing to. + You can implement these methods with empty bodies so that the library + does not generate any messages for these events. + +Then, the following code uses the ``addSubscriber()`` method to register +``MySubscriber`` with the client: + +.. literalinclude:: /includes/monitoring/sdam.php + :start-after: start-add-sub + :end-before: end-add-sub + :language: php + :copyable: + :dedent: + +When you run the application, your subscriber records the SDAM event and +outputs messages such as the following: + +.. code-block:: none + + Server opening on ac-rmuag0v-shard-00-00.gh0qg50.mongodb.net:27017 + Server opening on ac-rmuag0v-shard-00-01.gh0qg50.mongodb.net:27017 + Server opening on ac-rmuag0v-shard-00-02.gh0qg50.mongodb.net:27017 + +Event Descriptions +------------------ + +You can subscribe to the following SDAM events by implementing the +corresponding method from the ``SDAMSubscriber`` interface: + +.. list-table:: + :widths: 35 65 + :header-rows: 1 + + * - Event Name + - Description + + * - ``ServerChangedEvent`` + - Created when an instance state changes, such as from secondary to + primary. + + * - ``ServerOpeningEvent`` + - Created when the server is initialized. + + * - ``ServerClosedEvent`` + - Created when the server is closed. + + * - ``TopologyChangedEvent`` + - Created when the topology changes, such as an election of a new + primary or disconnection of a ``mongos`` proxy. + + * - ``TopologyOpeningEvent`` + - Created when the topology is initialized. + + * - ``TopologyClosedEvent`` + - Created when the topology is closed. + + * - ``ServerHeartbeatStartedEvent`` + - Created when the heartbeat is started. + + * - ``ServerHeartbeatSucceededEvent`` + - Created when the heartbeat succeeds. + + * - ``ServerHeartbeatFailedEvent`` + - Created when the heartbeat fails. + +API Documentation +----------------- + +To learn more about any of the classes or methods discussed in this guide, see the +following API documentation: + +- :phpmethod:`MongoDB\Client::addSubscriber()` +- :phpclass:`MongoDB\Client` + +To learn more about subscriber classes and methods, see the following +pages in the PHP manual: + +- :php:`mongodb-driver-monitoring-sdamsubscriber` +- :php:`mongodb-driver-monitoring-serveropeningevent` From 564dfe9337ac3b12a257d92978fcff9fccb837e4 Mon Sep 17 00:00:00 2001 From: rustagir Date: Tue, 17 Sep 2024 15:34:44 -0400 Subject: [PATCH 2/9] small fixes --- source/monitoring/cluster-monitoring.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/monitoring/cluster-monitoring.txt b/source/monitoring/cluster-monitoring.txt index fa503e06..02e23617 100644 --- a/source/monitoring/cluster-monitoring.txt +++ b/source/monitoring/cluster-monitoring.txt @@ -71,6 +71,7 @@ When you run the application, your subscriber records the SDAM event and outputs messages such as the following: .. code-block:: none + :copyable: false Server opening on ac-rmuag0v-shard-00-00.gh0qg50.mongodb.net:27017 Server opening on ac-rmuag0v-shard-00-01.gh0qg50.mongodb.net:27017 @@ -130,5 +131,5 @@ following API documentation: To learn more about subscriber classes and methods, see the following pages in the PHP manual: -- :php:`mongodb-driver-monitoring-sdamsubscriber` -- :php:`mongodb-driver-monitoring-serveropeningevent` +- :php:`MongoDB\Driver\Monitoring\SDAMSubscriber ` +- :php:`MongoDB\Driver\Monitoring\ServerOpeningEvent ` From fce89723c2998373421c916b35cc6f0a5db53a3c Mon Sep 17 00:00:00 2001 From: rustagir Date: Wed, 18 Sep 2024 09:33:35 -0400 Subject: [PATCH 3/9] MW PR fixes 1 --- source/monitoring.txt | 2 +- source/monitoring/cluster-monitoring.txt | 17 +++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/source/monitoring.txt b/source/monitoring.txt index 4a6d1191..5322004f 100644 --- a/source/monitoring.txt +++ b/source/monitoring.txt @@ -12,7 +12,7 @@ Monitor Your Application .. /monitoring/command-monitoring .. /monitoring/connection-monitoring -- :ref:`Cluster Monitoring `: monitor changes +- :ref:`Cluster Monitoring `: Monitor changes in your cluster configuration .. TODO - :ref:`Command Monitoring `: monitor command diff --git a/source/monitoring/cluster-monitoring.txt b/source/monitoring/cluster-monitoring.txt index 02e23617..04d291b4 100644 --- a/source/monitoring/cluster-monitoring.txt +++ b/source/monitoring/cluster-monitoring.txt @@ -23,7 +23,7 @@ Overview This guide shows you how to use the {+php-library+} to monitor topology events in a MongoDB instance, replica set, or sharded cluster. The driver creates topology events, also known as Server Discovery and -Monitoring (**SDAM**) events, when there are any changes in the state of the +Monitoring (SDAM) events, when there are any changes in the state of the MongoDB instance or cluster that you are connected to. You might use information about topology events in your @@ -34,14 +34,15 @@ Subscribe to Events ------------------- You can access details about SDAM events by subscribing to them -in your application. To subscribe to any event, create a class that +in your application. To subscribe to an event, create a class that implements the ``MongoDB\Driver\Monitoring\SDAMSubscriber`` interface, then use the ``MongoDB\Client::addSubscriber()`` method to register the event subscriber with your ``MongoDB\Client`` instance. -The following code creates the ``MySubscriber`` class that implements -``SDAMSubscriber`` to output a message when a ``ServerOpeningEvent`` is -generated by the server: +The following code creates the ``MySubscriber`` class, which implements +the ``SDAMSubscriber`` interface. The class is defined with a method to +output a message when a ``ServerOpeningEvent`` is generated by the +server: .. literalinclude:: /includes/monitoring/sdam.php :start-after: start-mysubscriber @@ -53,12 +54,12 @@ generated by the server: .. note:: As shown in the preceding code, you must implement all of the methods - of ``SDAMSubscriber``, even for events you are not subscribing to. + of the ``SDAMSubscriber`` interface, even for events you are not subscribing to. You can implement these methods with empty bodies so that the library does not generate any messages for these events. -Then, the following code uses the ``addSubscriber()`` method to register -``MySubscriber`` with the client: +Then, use the ``addSubscriber()`` method to register ``MySubscriber`` +with the client, as shown in the following code: .. literalinclude:: /includes/monitoring/sdam.php :start-after: start-add-sub From 9dfc72a66a17694788784e9f06a1f4ea0d557a5f Mon Sep 17 00:00:00 2001 From: rustagir Date: Thu, 19 Sep 2024 13:42:04 -0400 Subject: [PATCH 4/9] JM tech review 1 --- source/includes/monitoring/sdam.php | 27 +++++--- source/monitoring/cluster-monitoring.txt | 88 ++++++++++++++++-------- 2 files changed, 74 insertions(+), 41 deletions(-) diff --git a/source/includes/monitoring/sdam.php b/source/includes/monitoring/sdam.php index 02d17c91..8760ec5e 100644 --- a/source/includes/monitoring/sdam.php +++ b/source/includes/monitoring/sdam.php @@ -1,24 +1,26 @@ stream = $stream; } - public function serverOpening(MongoDB\Driver\Monitoring\ServerOpeningEvent $event): void - { - fwrite($this->stream, sprintf( - 'Server opening on %s:%s%s', + + public function serverOpening(MongoDB\Driver\Monitoring\ServerOpeningEvent $event): void { + fprintf( + $this->stream, + "Server opening on %s:%s\n", $event->getHost(), $event->getPort(), - PHP_EOL, - )); + ); } + public function serverClosed(MongoDB\Driver\Monitoring\ServerClosedEvent $event): void {} public function serverChanged(MongoDB\Driver\Monitoring\ServerChangedEvent $event): void {} public function serverHeartbeatFailed(MongoDB\Driver\Monitoring\ServerHeartbeatFailedEvent $event): void {} @@ -30,15 +32,18 @@ public function topologyOpening(MongoDB\Driver\Monitoring\TopologyOpeningEvent $ } // end-mysubscriber -$uri = getenv('MONGODB_URI') ?: throw new RuntimeException('Set the MONGODB_URI variable to your Atlas URI that connects to the sample dataset'); +$uri = getenv('MONGODB_URI') ?: throw new RuntimeException('Set the MONGODB_URI variable to your connection URI'); $client = new MongoDB\Client($uri); -$database = $client->db; -$collection = $database->my_coll; +$collection = $client->db->my_coll; // start-add-sub $subscriber = new MySubscriber(STDERR); $client->addSubscriber($subscriber); // end-add-sub -$collection->insertOne(['x' => 100]); +$collection->insertOne(["x" => 100]); + +// start-remove-sub +$client->removeSubscriber($subscriber); +// end-remove-sub \ No newline at end of file diff --git a/source/monitoring/cluster-monitoring.txt b/source/monitoring/cluster-monitoring.txt index 04d291b4..8c0aa8df 100644 --- a/source/monitoring/cluster-monitoring.txt +++ b/source/monitoring/cluster-monitoring.txt @@ -20,15 +20,17 @@ Cluster Monitoring Overview -------- -This guide shows you how to use the {+php-library+} to monitor topology -events in a MongoDB instance, replica set, or sharded cluster. The -driver creates topology events, also known as Server Discovery and -Monitoring (SDAM) events, when there are any changes in the state of the -MongoDB instance or cluster that you are connected to. +This guide shows you how to use the {+php-library+} to monitor server +discovery and monitoring (SDAM) events in a MongoDB instance, replica +set, or sharded cluster. These events occur when there +are any changes in the state of the MongoDB instance or cluster that you +are connected to. -You might use information about topology events in your -application to understand cluster changes, assess cluster health, or -perform capacity planning. +You might use information about SDAM events in your application to +understand cluster changes, assess cluster health, or perform capacity +planning. + +.. _php-subscribe-sdam: Subscribe to Events ------------------- @@ -55,8 +57,8 @@ server: As shown in the preceding code, you must implement all of the methods of the ``SDAMSubscriber`` interface, even for events you are not subscribing to. - You can implement these methods with empty bodies so that the library - does not generate any messages for these events. + The example defines the extra methods as empty so that the + application does not output any messages for those events. Then, use the ``addSubscriber()`` method to register ``MySubscriber`` with the client, as shown in the following code: @@ -81,45 +83,71 @@ outputs messages such as the following: Event Descriptions ------------------ -You can subscribe to the following SDAM events by implementing the -corresponding method from the ``SDAMSubscriber`` interface: +You can subscribe to SDAM events by implementing the corresponding +method from the ``SDAMSubscriber`` interface. The following table +provides the name of each SDAM event, linked to the class's API +documentation, and a description of when the event is published: .. list-table:: :widths: 35 65 :header-rows: 1 - * - Event Name + * - Event Type - Description - * - ``ServerChangedEvent`` - - Created when an instance state changes, such as from secondary to - primary. + * - :php:`ServerChangedEvent ` + - Created when the server description changes, such as the server's type + changing from secondary to primary. - * - ``ServerOpeningEvent`` - - Created when the server is initialized. + * - :php:`ServerOpeningEvent ` + - Created when the server description is instantiated with its + defaults. - * - ``ServerClosedEvent`` + * - :php:`ServerClosedEvent ` - Created when the server is closed. - * - ``TopologyChangedEvent`` - - Created when the topology changes, such as an election of a new - primary or disconnection of a ``mongos`` proxy. + * - :php:`TopologyChangedEvent ` + - Created when the topology description changes, such when there is + an election of a new primary or disconnection of a ``mongos`` proxy. - * - ``TopologyOpeningEvent`` - - Created when the topology is initialized. + * - :php:`TopologyOpeningEvent ` + - Created when the topology description is initialized. - * - ``TopologyClosedEvent`` + * - :php:`TopologyClosedEvent ` - Created when the topology is closed. - * - ``ServerHeartbeatStartedEvent`` - - Created when the heartbeat is started. + * - :php:`ServerHeartbeatStartedEvent ` + - Created when the server monitor sends a ``hello`` call to the server. + This action is called a heartbeat. - * - ``ServerHeartbeatSucceededEvent`` + * - :php:`ServerHeartbeatSucceededEvent ` - Created when the heartbeat succeeds. - * - ``ServerHeartbeatFailedEvent`` + * - :php:`ServerHeartbeatFailedEvent ` - Created when the heartbeat fails. +You can find a list of the monitoring subscriber classes and event +methods in the :php:`Monitoring classes and subscriber functions +` section of the PHP manual. + +Remove a Subscriber +------------------- + +Later in your application, you might not want to subscribe to +SDAM events. To unregister a subscriber from your client, use the +``MongoDB\Client::removeSubscriber()`` method. If you attempt to remove +a nonexistent subscriber, the method doesn't perform any action. + +The following code shows how to remove the subscriber that you +registered in the :ref:`php-subscribe-sdam` section: + +.. literalinclude:: /includes/monitoring/sdam.php + :start-after: start-remove-sub + :end-before: end-remove-sub + :language: php + :copyable: + :dedent: + API Documentation ----------------- @@ -127,7 +155,7 @@ To learn more about any of the classes or methods discussed in this guide, see t following API documentation: - :phpmethod:`MongoDB\Client::addSubscriber()` -- :phpclass:`MongoDB\Client` +- :phpmethod:`MongoDB\Client::removeSubscriber()` To learn more about subscriber classes and methods, see the following pages in the PHP manual: From 8cf4fc1bd31efd8d23ca33c9d0429f235fc01ad0 Mon Sep 17 00:00:00 2001 From: rustagir Date: Thu, 19 Sep 2024 13:43:46 -0400 Subject: [PATCH 5/9] single quotes --- source/includes/monitoring/sdam.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/includes/monitoring/sdam.php b/source/includes/monitoring/sdam.php index 8760ec5e..1647f9d9 100644 --- a/source/includes/monitoring/sdam.php +++ b/source/includes/monitoring/sdam.php @@ -1,6 +1,6 @@ stream, - "Server opening on %s:%s\n", + 'Server opening on %s:%s\n', $event->getHost(), $event->getPort(), ); @@ -42,7 +42,7 @@ public function topologyOpening(MongoDB\Driver\Monitoring\TopologyOpeningEvent $ $client->addSubscriber($subscriber); // end-add-sub -$collection->insertOne(["x" => 100]); +$collection->insertOne(['x' => 100]); // start-remove-sub $client->removeSubscriber($subscriber); From fc1506c33dda865b2d717ec090b112f57a3d9097 Mon Sep 17 00:00:00 2001 From: rustagir Date: Thu, 19 Sep 2024 13:48:39 -0400 Subject: [PATCH 6/9] links --- source/monitoring/cluster-monitoring.txt | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/source/monitoring/cluster-monitoring.txt b/source/monitoring/cluster-monitoring.txt index 8c0aa8df..6a9dfcb1 100644 --- a/source/monitoring/cluster-monitoring.txt +++ b/source/monitoring/cluster-monitoring.txt @@ -95,40 +95,40 @@ documentation, and a description of when the event is published: * - Event Type - Description - * - :php:`ServerChangedEvent ` + * - :php:`ServerChangedEvent ` - Created when the server description changes, such as the server's type changing from secondary to primary. - * - :php:`ServerOpeningEvent ` + * - :php:`ServerOpeningEvent ` - Created when the server description is instantiated with its defaults. - * - :php:`ServerClosedEvent ` + * - :php:`ServerClosedEvent ` - Created when the server is closed. - * - :php:`TopologyChangedEvent ` + * - :php:`TopologyChangedEvent ` - Created when the topology description changes, such when there is an election of a new primary or disconnection of a ``mongos`` proxy. - * - :php:`TopologyOpeningEvent ` + * - :php:`TopologyOpeningEvent ` - Created when the topology description is initialized. - * - :php:`TopologyClosedEvent ` + * - :php:`TopologyClosedEvent ` - Created when the topology is closed. - * - :php:`ServerHeartbeatStartedEvent ` + * - :php:`ServerHeartbeatStartedEvent ` - Created when the server monitor sends a ``hello`` call to the server. This action is called a heartbeat. - * - :php:`ServerHeartbeatSucceededEvent ` + * - :php:`ServerHeartbeatSucceededEvent ` - Created when the heartbeat succeeds. - * - :php:`ServerHeartbeatFailedEvent ` + * - :php:`ServerHeartbeatFailedEvent ` - Created when the heartbeat fails. You can find a list of the monitoring subscriber classes and event methods in the :php:`Monitoring classes and subscriber functions -` section of the PHP manual. +` section of the PHP manual. Remove a Subscriber ------------------- From 25d4f88e8e8882627e3f1839f4b8ddaea742d55e Mon Sep 17 00:00:00 2001 From: rustagir Date: Thu, 19 Sep 2024 13:50:56 -0400 Subject: [PATCH 7/9] vale --- .github/workflows/check-autobuilder.yml | 13 ------------- source/monitoring/cluster-monitoring.txt | 2 +- 2 files changed, 1 insertion(+), 14 deletions(-) delete mode 100644 .github/workflows/check-autobuilder.yml diff --git a/.github/workflows/check-autobuilder.yml b/.github/workflows/check-autobuilder.yml deleted file mode 100644 index 8495db96..00000000 --- a/.github/workflows/check-autobuilder.yml +++ /dev/null @@ -1,13 +0,0 @@ -name: Check Autobuilder for Errors - -on: - pull_request: - paths: - - "source/**" - -jobs: - check: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: cbush/snooty-autobuilder-check@main diff --git a/source/monitoring/cluster-monitoring.txt b/source/monitoring/cluster-monitoring.txt index 6a9dfcb1..5cdf97f5 100644 --- a/source/monitoring/cluster-monitoring.txt +++ b/source/monitoring/cluster-monitoring.txt @@ -55,7 +55,7 @@ server: .. note:: - As shown in the preceding code, you must implement all of the methods + As shown in the preceding code, you must implement all the methods of the ``SDAMSubscriber`` interface, even for events you are not subscribing to. The example defines the extra methods as empty so that the application does not output any messages for those events. From e3351c5410ce6637f60a92652272d2a212e51831 Mon Sep 17 00:00:00 2001 From: rustagir Date: Mon, 23 Sep 2024 10:23:24 -0400 Subject: [PATCH 8/9] JM tech review 2 --- source/monitoring/cluster-monitoring.txt | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/source/monitoring/cluster-monitoring.txt b/source/monitoring/cluster-monitoring.txt index 5cdf97f5..44bb4370 100644 --- a/source/monitoring/cluster-monitoring.txt +++ b/source/monitoring/cluster-monitoring.txt @@ -22,9 +22,9 @@ Overview This guide shows you how to use the {+php-library+} to monitor server discovery and monitoring (SDAM) events in a MongoDB instance, replica -set, or sharded cluster. These events occur when there -are any changes in the state of the MongoDB instance or cluster that you -are connected to. +set, or sharded cluster. These events occur when there are any changes +in the state of the MongoDB instance or cluster that you are connected +to. You might use information about SDAM events in your application to understand cluster changes, assess cluster health, or perform capacity @@ -100,21 +100,20 @@ documentation, and a description of when the event is published: changing from secondary to primary. * - :php:`ServerOpeningEvent ` - - Created when the server description is instantiated with its - defaults. + - Created when a server connection is established. * - :php:`ServerClosedEvent ` - - Created when the server is closed. + - Created when a server connection is closed. * - :php:`TopologyChangedEvent ` - Created when the topology description changes, such when there is - an election of a new primary or disconnection of a ``mongos`` proxy. + an election of a new primary. * - :php:`TopologyOpeningEvent ` - - Created when the topology description is initialized. + - Created when the driver first connects to the cluster. * - :php:`TopologyClosedEvent ` - - Created when the topology is closed. + - Created when the driver disconnects from the cluster. * - :php:`ServerHeartbeatStartedEvent ` - Created when the server monitor sends a ``hello`` call to the server. From 4a39d20eb4e85f240b10c03d5ccedb6d0c38dc59 Mon Sep 17 00:00:00 2001 From: rustagir Date: Mon, 23 Sep 2024 15:39:25 -0400 Subject: [PATCH 9/9] JM final fixes --- source/monitoring/cluster-monitoring.txt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/source/monitoring/cluster-monitoring.txt b/source/monitoring/cluster-monitoring.txt index 44bb4370..d9d9901e 100644 --- a/source/monitoring/cluster-monitoring.txt +++ b/source/monitoring/cluster-monitoring.txt @@ -96,8 +96,8 @@ documentation, and a description of when the event is published: - Description * - :php:`ServerChangedEvent ` - - Created when the server description changes, such as the server's type - changing from secondary to primary. + - Created when the server description changes, such as the server's + type changing from secondary to primary. * - :php:`ServerOpeningEvent ` - Created when a server connection is established. @@ -106,8 +106,8 @@ documentation, and a description of when the event is published: - Created when a server connection is closed. * - :php:`TopologyChangedEvent ` - - Created when the topology description changes, such when there is - an election of a new primary. + - Created when the topology description changes, such as when there + is an election of a new primary. * - :php:`TopologyOpeningEvent ` - Created when the driver first connects to the cluster. @@ -116,7 +116,7 @@ documentation, and a description of when the event is published: - Created when the driver disconnects from the cluster. * - :php:`ServerHeartbeatStartedEvent ` - - Created when the server monitor sends a ``hello`` call to the server. + - Created when the server monitor sends a ``hello`` command to the server. This action is called a heartbeat. * - :php:`ServerHeartbeatSucceededEvent `