The Python agent supports asyncio event loop diagnostics. When there are transactions blocking or delaying an event loop, the agent is able to generate diagnostics to help find and resolve them.
Requirements
Requires Python agent version 5.0.0.124 or higher.
View in New Relic UI
In APM, your event loop transaction data will be in the transaction breakdown table and the trace details page.
Event loop metrics will appear in the transaction Breakdown table:
![python-event-loop-breakdown-table.png Python event loop breakdown table](/static/python-event-loop-breakdown-table-526baf674b5a79458a0504ac0dbdb237.png)
one.newrelic.com > APM > (select an app) > Monitoring > Transactions > (select a transaction): The transaction’s Breakdown table flags event loops with asyncio.
Time spent waiting on other transactions will be shown in the transaction Trace details page:
![python-event-loop-trace-details.png Python event loop trace details](/static/python-event-loop-trace-details-48055f454c92a694d0181ede40dd96ef.png)
one.newrelic.com > APM > (select an app) > Transactions > (select a transaction trace) > Trace details: The Trace details page contains a table with breakdowns for each segment (method or function call) in a transaction trace.
Event Loop NRQL Queries
eventLoopTime
and eventLoopWait
attributes will be available via NRQL query. An example query might be:
SELECT count(*) as 'count', average(eventLoopTime) as 'loopTime', average(eventLoopWait) as 'loopWait' FROM Transaction facet name
In the UI, you might see results like this:
![python-event-loop-insights-table.png Python event loop NRQL query](/static/python-event-loop-insights-table-890ad42456b03f27e024429dd0cffb82.png)
one.newrelic.com > Query your data > Advanced (NRQL): Use advanced (NRQL) to write a query to find event loops.
Where to diagnose event loops
Event loop diagnostics will be available by default through our existing aiohttp, sanic, and Tornado instrumentation frameworks. Coroutines using the Python agent API background_task and web_transaction decorator APIs also support asyncio's event loops.