Loading…

New Relic for Python

You will find links to detailed information about the Python Agent here.

Information on changes made between different versions of the Python agent can be found in the Python agent release notes. We have also documented any general issues we feel you should know about or details of any missing features in this document on status of Python agent.

If you can't find the information you need to understand how to get the Python agent going or how to use it, then please let us know.

Quick links:

System Requirements

At this time we are supporting Linux and Apple MacOS X operating systems. The supported Python versions are Python 2.5, 2.6 and 2.7.

To get the most from the New Relic UI, specific targeted instrumentation is required for the different Python web frameworks. The web frameworks which we are supporting at this time include Bottle, CherryPy, Django, Flask, Pylons and Web2Py.

Although a specific Python web framework may not be supported the agent can still be used but a break out of time spent in key parts of the framework will not be available by default in web transaction performance breakdowns and transaction traces for slow transactions. You will also be at risk of triggering a problem we like to refer to as metric explosion.

In addition to instrumentation for specific Python web frameworks, instrumentation is also provided for a range of other Python packages and modules. Such instrumentation covers areas such as database queries, memcache requests and external service requests. Results from these will also show up automatically within web transaction performance breakdowns and transaction traces for slow transactions.

For hosting, the agent should be able to be used with any WSGI 1.0 (PEP 333) compliant Python web hosting mechanism. In some cases this will require manual integration into the WSGI application script file or module. For further details as well as any restrictions see documentation on integrating with your hosting mechanism. Specific instructions are also provided for how to use the agent with some commercial Python web hosting services.

Note: Web frameworks providing a custom API based on an event based or asynchronous callback mechanism are not supported by the Python agent. Use of the now obsolete and no longer maintained mod_python module for Apache is also not supported.

Installation Instructions

To use the Python agent, you first need to have a New Relic account. Get sign-up instructions here.

Having signed up you can then install the Python agent software. For this see the documentation on Python agent installation. Additional instructions for a specific version of a release may also be found in the 'INSTALL' file contained in the release package you download.

The most up to date Python agent package is always available on our "Support page" within the New Relic site or from our software download site. The package can also be installed using Python packaging tools pip or easy_install via the Python Package Index.

To get to the "Support page", log into http://rpm.newrelic.com and click on the "Support" link in the upper right-hand corner of the page. In the lower, right-hand corner of this page you will see download links for all of our agents.

Once installed, if a simplified deployment method isn't available for your hosting mechanism or service, you will need to integrate the loading of the Python agent into your application code and define the location of the agent configuration. These steps are covered in the instructions found in the separate guide on integrating with your application.

Agent Configuration

The primary means by which the Python agent is configured is by way of the agent configuration file. For details on the options which can be set from the agent configuration file see the documentation on configuring the Python agent.

Specifically in relation to the configuration of agent logging, additional information can be found in documentation on Python agent logging.

Troubleshooting Tips

After hitting your web application with a batch of requests, data should appear in the RPM console within 2-3 minutes. If no data appears after a few minutes, check for errors within Python agent log file. This log file will be located at the location specified in the Python agent configuration file. If the log file is not configured, enable it as described in documentation on Python agent logging.

If this does not show anything and you have not already performed the Python agent test, ensure you run the procedure described in the documentation on testing the Python agent.

If the Python agent test checks out okay, then for your actual web application, increase the log_level to "debug" and capture about 5 minutes of logging output, ideally upon a re-start and after hitting the web application with requests continuously for 30 seconds so we see exactly what happens. Provide this information when logging a support request with us.

Additional Information

The following documentation related to the Python agent is also available: