[Python-ideas] New PEP 550: Execution Context
Yury Selivanov
yselivanov.ml at gmail.com
Sat Aug 12 00:16:45 EDT 2017
> This is exciting and I'm happy that you're addressing this problem.
Thank you!
> Some of our use cases can't be implemented using this PEP; notably, we use a timing context that times how long an asynchronous function takes by repeatedly pausing and resuming the timer.
Measuring performance of coroutines is a bit different kind of
problem. With PEP 550 you will be able to decouple context management
from collecting performance data. That would allow you to subclass
asyncio.Task (let's call it InstrumentedTask) and implement all extra
tracing functionality on it (by overriding its _send method for
example). Then you could set a custom task factory that would use
InstrumentedTask only for a fraction of requests. That would make it
possible to collect performance metrics even in production (my 2c).
Yury
More information about the Python-ideas
mailing list