[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 production deployments.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33221] Add stats for asyncio task usage.

2018-04-03 Thread Joongi Kim

Change by Joongi Kim :


--
nosy: +achimnol

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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 prototype it in uvloop first.

I'll update this issue with a link to a discussion.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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 
also slow accumulated steps.  In this scenario you don't know which task will 
be slow and don't want to track every task.

--
nosy: +thehesiod

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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 finished). The value includes a time for 
`await func()` waiting.
- real_time: a cumulative time for `Task._step()` executions
- switch_count: a count of `Task._step()` calls.

It can help with tasks activity analyzing.

Yuri, what do you think about?

--
components: asyncio
messages: 314905
nosy: asvetlov, yselivanov
priority: normal
severity: normal
status: open
title: Add stats for asyncio task usage.
versions: Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com