[issue33221] Add stats for asyncio task usage.

2018-04-03 Thread Joongi Kim
Joongi Kim added the comment: I like trio-style instrumentation API because it could be used for more generic purposes, not only for statistics. This stats or instrumentation API will greatly help me to utilize external monitoring services such as Datadog in my

[issue33221] Add stats for asyncio task usage.

2018-04-03 Thread Joongi Kim
Change by Joongi Kim : -- nosy: +achimnol ___ Python tracker ___ ___ Python-bugs-list

[issue33221] Add stats for asyncio task usage.

2018-04-03 Thread Andrew Svetlov
Andrew Svetlov added the comment: Well, event based solution is more powerful than just statistic collection. Please keep me in the loop. -- ___ Python tracker

[issue33221] Add stats for asyncio task usage.

2018-04-03 Thread Yury Selivanov
Yury Selivanov added the comment: > Yuri, what do you think about? I plan to use contextvars module to introduce a full-blown tracing API to asyncio to selectively log events like tacks creations, event loop switching, IO done by transports etc. The plan is to

[issue33221] Add stats for asyncio task usage.

2018-04-03 Thread Nathaniel Smith
Nathaniel Smith added the comment: FYI, here's how trio handles such things – I'm sure it's not perfect, but might be useful for inspiration: https://trio.readthedocs.io/en/latest/reference-hazmat.html#instrument-api -- nosy: +njs

[issue33221] Add stats for asyncio task usage.

2018-04-03 Thread Alexander Mohr
Alexander Mohr added the comment: another idea would be neat to somehow plug into the stats so people can trace (ex: via datadog tracing) "slow" tasks, similarly to things that are outputted via PYTHONASYNCIODEBUG, however in this case be able to trace slow steps and

[issue33221] Add stats for asyncio task usage.

2018-04-03 Thread Andrew Svetlov
New submission from Andrew Svetlov : I suggest adding a `Task.stats()` method. The method should return a dict with the task usage statistics. Dict keys: - total_time: a time between task creation and a moment of the call (or task finishing timestamp if the task has