Introduction to New Relic for Python

New Relic's Python agent monitors your application to help you identify and solve performance issues. You can also extend the agent's performance monitoring to collect and analyze business data to help you improve the customer experience and to make data-driven business decisions. With flexible options for custom instrumentation and agent-specific APIs, New Relic's Python agent offers multiple building blocks to customize the data you need for your app.

The Python agent works with a wide variety of web frameworks and hosting mechanisms, including WSGI, CherryPy, FASTCGI, Gunicorn, uWSGI, and more. After you install the agent, you can examine everything from a visual overview of your app's performance, to code-level details such as transaction traces, thread profiler sessions, and x-ray sessions (which combine detailed trace data from selected metrics with the power of thread profiling).

APM Overview for Python app
APM > Applications > (selected app) > Monitoring > Overview: After you install New Relic's Python agent, it starts to collect data about your app, which you can view from New Relic APM.

Install the agent

Before you install the Python agent, make sure your system meets the system requirements. You must also create a New Relic account.

Download the agent

If you are logged in to New Relic, or if you have access to New Relic's Python agent repository, you can get the most recent Python agent package. To view information about the latest release and download it, see the Python agent release notes. You can also install the Python agent by using Python packaging tools such as pip, easy_install, distribute or buildout via the Python Package Index.

Configure the agent

The most important part of agent configuration is to provide your license key and to give your app a descriptive name. New Relic uses this app name to aggregate metrics when you have multiple apps or servers.

The agent includes a variety of configuration options to further customize and fine-tune your installation. After changing any agent configuration options, restart your web server.

Extend agent instrumentation

After installing the agent, go further and extend the agent's instrumentation as needed. For example:

Custom instrumentation options Description
Config file Trace the time spent in additional functions or methods of classes simply by customizing the agent config file.
Python agent API Create more complex calls or customize how a function is identified within the UI by making direct calls to the agent API in your code.
Page load timing Integrate the Python agent with New Relic Browser to gain visibility into end-user activity through the full life cycle of the webpage.
Custom metrics Record arbitrary metrics using APIs provided by the agent; for example, metrics related to the business functions implemented by your web application, additional metrics to evaluate your app's performance, etc.
Background tasks Monitor job-based or task queuing systems.
Business data analysis with New Relic Insights

Use the Python agent with Insights to organize, query, and visualize your data to answer key questions about application performance and customer experience.

Troubleshoot your installation

If your web application is receiving requests, data should appear in the New Relic APM UI within two to three minutes after installation.

Monitor app performance

After you install and configure the Python agent, it begins to collect data about your app. You can view the data as charts and tables in New Relic's user interface.

View the big picture of your app.
Find errors and problems quickly.
Drill down into performance details.

For more help

Additional documentation resources include:

Join the discussion about Python in the New Relic Online Technical Community! The Technical Community is a public platform to discuss and troubleshoot your New Relic toolset.

If you need additional help, get support at