8000 docs: Update tutorial a little bit more by achimnol · Pull Request #394 · aio-libs/aiomonitor · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

docs: Update tutorial a little bit more #394

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Dec 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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