This document lists the packages and modules automatically instrumented by the Python agent after you install it. You can also use custom instrumentation if you want to:
Disable instrumentation for specific packages or modules if the instrumentation interferes with your app.
Instrument a-third party package or module that is not instrumented automatically by the agent.
Add more specific instrumentation for your own code, such as to track the time spent in additional functions.
To request built-in instrumentation for additional packages, get support at support.newrelic.com.
Web frameworks
Support for versions 2.2.x or higher.
Function timing in transactions traces for slow transactions is provided for:
View functions (coroutines).
Application middleware.
Exception logging is provided for:
Uncaught exceptions resulting in a non-200 HTTP response.
The web transaction is named after the view function.
Function timing in transactions traces for slow transactions is provided for:
View function.
Template rendering via SimpleTemplate, MakoTemplate, CheetahTemplate, Jinja2Template and SimpleTalTemplate interfaces.
Exception logging is provided for:
Uncaught exceptions which would otherwise generate 500 responses from Bottle.
The web transaction is named after the view function.
As Bottle uses external template libraries, see also which of those packages may be supported for additional detail.
Function timing in transactions traces for slow transactions is provided for:
Handler function.
Exception logging is provided for:
Uncaught exceptions which would otherwise generate 500 responses from CherryPy.
The web transaction is named after the handler function.
As CherryPy relies upon external template libraries, see also which of those packages may be supported for additional detail.
Function timing in transactions traces for slow transactions is provided for:
Request middleware.
View middleware.
Template response middleware.
Response middleware.
Exception middleware.
Template rendering.
Exception logging is provided for:
Exceptions occurring during loading of view handlers by URL resolver.
Exceptions occurring within the execution of the view handler.
Uncaught exceptions which would otherwise generate 500 responses from Django.
Page load timing (sometimes referred to as real user monitoring or RUM) support consists of:
Optional automatic insertion of JavaScript header/footer via response middleware.
Provision of template tag library to enable manual insertion of the JavaScript header/footer into templates.
The web transaction is named after the view handler, unless a request or view middleware returns a response object prior to the view handler being invoked.
Instrumentation is also implemented to provide better web transaction naming or additional functional tracing when using:
Function timing in transactions traces for slow transactions is provided for:
Handler function.
Exception logging is provided for:
Uncaught exceptions which would otherwise generate error responses from Falcon.
The web transaction is named after the handler function.
Function timing in transactions traces for slow transactions is provided for:
Route functions (coroutines).
Application middleware.
Exception handlers.
Background Tasks
Exception logging is provided for:
Exceptions occurring inside middleware.
Exceptions occurring inside an exception handler.
Uncaught exceptions which would otherwise generate 500 responses from FastAPI.
The web transaction is named after the route handler.
Function timing in transactions traces for slow transactions is provided for:
View function.
Template rendering via render_template() and render_template_string().
Exception logging is provided for:
Uncaught exceptions which would otherwise generate 500 responses from Flask.
The web transaction is named after the view function.
As Flask uses Jinja2 for templates, see also details of Jinja2 instrumentation listed below.
Supported for versions 1.4 or higher.
Function timing in transaction traces for slow transactions is provided for:
_stream_response_in_pool
_unary_response_in_pool
Exception logging is provided for:
grpc server aborts
Function timing in transactions traces for slow transactions is provided for:
Controller function, before and after methods.
Template rendering via render_genshi(), render_jinja2() and render_mako().
Exception logging is provided for:
Uncaught exceptions which would otherwise generate 500 responses from Pylons.
The web transaction is named after the controller/action.
As Pylons can use Genshi, Jinja2 or Mako for templates see also details of instrumentation for those modules listed below.
Function timing in transactions traces for slow transactions is provided for:
View handler functions.
Exception logging is provided for:
Uncaught exceptions which would otherwise generate 500 responses from Pyramid.
The web transaction is named after the view handler.
Function timing in transactions traces for slow transactions is provided for:
View functions (coroutines).
Application middleware.
Exception logging is provided for:
Exceptions occurring inside of a request middleware.
Exceptions occurring inside of a response middleware.
Exceptions occurring inside a request handler.
Exceptions occurring inside an exception handler.
Uncaught exceptions which would otherwise generate 500 responses from Sanic.
The web transaction is named after the view handler.
Function timing in transactions traces for slow transactions is provided for:
Route functions (coroutines).
Application middleware.
Exception handlers.
Background Tasks
Exception logging is provided for:
Exceptions occurring inside middleware.
Exceptions occurring inside an exception handler.
Uncaught exceptions which would otherwise generate 500 responses from Starlette.
The web transaction is named after the route handler.
You can use the Python agent with an app that uses Tornado 6.
Function timing in transactions traces for slow transactions is provided for:
Overall time in models phase.
Overall time in controller phase.
Overall time in view phase.
Execution time for specific scripts executed within models, controller and view phases.
Exception logging is provided for:
Uncaught exceptions which would otherwise generate 500 responses from Web2py.
The web transaction is named after the view script.
Backend services
Timing of task execution performed in a gearman worker recorded as background tasks against designated web application. Timing as a web external any client side calls to a gearman server to queue up or wait for the execution of queued tasks.
Timing of task execution recorded as background tasks against designated web application.
Template rendering
Function timing in transactions traces for slow transactions is provided for:
Template rendering.
Function timing in transactions traces for slow transactions is provided for:
Template compilation.
Template rendering.
Function timing in transactions traces for slow transactions is provided for:
Template rendering.
GraphQL Frameworks
The Python agent provides insight into your GraphQL application's operations and resolvers and reports GraphQL-specific metrics and span attributes. For more information on transaction naming and other features, please view our GraphQL documentation. As of agent version 6.10.0.165, the agent supports the following GraphQL frameworks:
To request instance-level information from datastores currently not listed for your agent, get support at support.newrelic.com.
SQL database adapters
For Python DB-API 2.0 compliant modules listed in this section, the Python agent supports:
Timing of database queries
Capturing SQL for the database query
Capturing a stack trace for long database queries
MySQL and PostgreSQ only: Capturing explain plans for slow database queries
The Python agent should be able to track database queries for any Python DB-API 2.0 compliant modules. However, the Python agent only officially supports the modules listed in this section.
For the following database adapters, we provides additional instrumentation for functionality outside of the DB-API 2.0 specification, such as shortcut methods to execute queries without creating cursors:
If your database client module is not listed in this section, get support at support.newrelic.com. New Relic Support may be able to suggest a temporary change to your config file to get it working.
NoSQL database clients
Timing of calls made against NoSQL databases are provided for the following client modules.