Skip to content

Commit

Permalink
docs: Update tutorial a little bit more (#394)
Browse files Browse the repository at this point in the history
  • Loading branch information
achimnol authored Dec 21, 2023
1 parent 67aaaab commit d79e996
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions docs/tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Tutorial
Lets create simple aiohttp_ application, and see how ``aiomonitor`` can
integrate with it.


Basic aiohttp server
--------------------

Expand All @@ -27,18 +28,19 @@ Basic aiohttp server
# init monitor just before run_app
loop = asyncio.get_running_loop()
with aiomonitor.start_monitor(loop):
await web._run_app(app, port=20101, host="localhost")
with aiomonitor.start_monitor(loop, hook_task_factory=True):
await web._run_app(app, port=8090, host="localhost")
if __name__ == "__main__":
asyncio.run(main())
Lets save this code in file ``simple_srv.py``, so we can run it with command::

$ python simple_srv.py
======== Running on http://localhost:20101 ========
======== Running on http://localhost:8090 ========
(Press CTRL+C to quit)


Connection over telnet
----------------------

Expand Down Expand Up @@ -145,6 +147,17 @@ As result variable ``foo`` available in console::
monitor >>>


Web-based Inspector
-------------------

You may also open your web browser and navigate to http://localhost:20102 .
This will show a web-based UI to inspect the currently running tasks and terminated tasks,
including their recursive stack traces. You can also cancel specific tasks there.

To see the recursive task creation and termination history, you should pass
``hook_task_factory=True`` to the ``start_monitor()`` function.


.. _cust-commands:

Adding custom commands
Expand Down

0 comments on commit d79e996

Please sign in to comment.