From b17ca3ddbc5650dd67d1773c6bd9dfade8ae113d Mon Sep 17 00:00:00 2001 From: Roman Mogylatov Date: Thu, 8 Oct 2020 19:51:29 -0400 Subject: [PATCH] Refactor asyncio tutorial httpbin.org monitor tutorial --- docs/tutorials/asyncio-daemon.rst | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/docs/tutorials/asyncio-daemon.rst b/docs/tutorials/asyncio-daemon.rst index 284ae4bf..6ab2c3b1 100644 --- a/docs/tutorials/asyncio-daemon.rst +++ b/docs/tutorials/asyncio-daemon.rst @@ -278,7 +278,7 @@ Put next lines into the ``__main__.py`` file: Container is the first object in the application. -Logging and configuration parsing part is done. In the next section we will create the monitoring +Logging and configuration parsing part is done. In next section we will create the monitoring checks dispatcher. Dispatcher @@ -487,7 +487,7 @@ The output should look like: Everything works properly. Dispatcher starts up and exits because there are no monitoring tasks. -By the end of this section we have the application skeleton ready. In the next section will will +By the end of this section we have the application skeleton ready. In next section will will add first monitoring task. Example.com monitor @@ -722,8 +722,8 @@ You should see: .. code-block:: bash - Starting monitoring-daemon-tutorial_monitor_1 ... done - Attaching to monitoring-daemon-tutorial_monitor_1 + Starting asyncio-daemon-tutorial_monitor_1 ... done + Attaching to asyncio-daemon-tutorial_monitor_1 monitor_1 | [2020-08-08 17:06:41,965] [INFO] [Dispatcher]: Starting up monitor_1 | [2020-08-08 17:06:42,033] [INFO] [HttpMonitor]: Check monitor_1 | GET http://example.com @@ -743,14 +743,14 @@ Let's add a monitor for the `http://httpbin.org `_. Httpbin.org monitor ------------------- -Adding of the monitor for the `httpbin.org`_ will be much easier because we have all the +Adding of a monitor for the `httpbin.org`_ will be much easier because we have all the components ready. We just need to create a new provider in the container and update the configuration. Edit ``containers.py``: .. code-block:: python - :emphasize-lines: 31-35,41 + :emphasize-lines: 30-34,40 """Containers module.""" @@ -830,27 +830,24 @@ You should see: .. code-block:: bash - Starting monitoring-daemon-tutorial_monitor_1 ... done - Attaching to monitoring-daemon-tutorial_monitor_1 + Starting asyncio-daemon-tutorial_monitor_1 ... done + Attaching to asyncio-daemon-tutorial_monitor_1 monitor_1 | [2020-08-08 18:09:08,540] [INFO] [Dispatcher]: Starting up monitor_1 | [2020-08-08 18:09:08,618] [INFO] [HttpMonitor]: Check monitor_1 | GET http://example.com monitor_1 | response code: 200 monitor_1 | content length: 648 monitor_1 | request took: 0.077 seconds - monitor_1 | monitor_1 | [2020-08-08 18:09:08,722] [INFO] [HttpMonitor]: Check monitor_1 | GET https://httpbin.org/get monitor_1 | response code: 200 monitor_1 | content length: 310 monitor_1 | request took: 0.18 seconds - monitor_1 | monitor_1 | [2020-08-08 18:09:13,619] [INFO] [HttpMonitor]: Check monitor_1 | GET http://example.com monitor_1 | response code: 200 monitor_1 | content length: 648 monitor_1 | request took: 0.066 seconds - monitor_1 | monitor_1 | [2020-08-08 18:09:13,681] [INFO] [HttpMonitor]: Check monitor_1 | GET https://httpbin.org/get monitor_1 | response code: 200 @@ -860,7 +857,7 @@ You should see: The functional part is done. Daemon monitors `http://example.com `_ and `https://httpbin.org `_. -In the next section we will add some tests. +In next section we will add some tests. Tests -----