New Relic Python Agent
The newrelic package instruments your application for performance monitoring and advanced performance analytics with New Relic.
Pinpoint and solve Python application performance issues down to the line of code. New Relic APM is the only tool you’ll need to see everything in your Python application, from the end user experience to server monitoring. Trace problems down to slow database queries, slow 3rd party APIs and web services, caching layers, and more. Monitor your app in a production environment and make sure your app can stand a big spike in traffic by running scalability reports.
Visit Python Application Performance Monitoring with New Relic to learn more.
$ pip install newrelic
(These instructions can also be found online: Python Agent Quick Start.)
Generate the agent configuration file with your license key.
$ newrelic-admin generate-config <YOUR-LICENSE-KEY> newrelic.ini
Validate the agent configuration and test the connection to our data collector service.
$ newrelic-admin validate-config newrelic.ini
Integrate the agent with your web application.
If you control how your web application or WSGI server is started, you can use the newrelic-admin wrapper script. Modify the existing startup script, prefixing the existing startup command and options with newrelic-admin run-program.
Also, set the NEW_RELIC_CONFIG_FILE environment variable to the name of the configuration file you created above:
$ NEW_RELIC_CONFIG_FILE=newrelic.ini newrelic-admin run-program <YOUR-EXISTING-STARTUP-COMMAND>
$ NEW_RELIC_CONFIG_FILE=newrelic.ini newrelic-admin run-program gunicorn -c config.py test_site.wsgi $ NEW_RELIC_CONFIG_FILE=newrelic.ini newrelic-admin run-program uwsgi uwsgi_config.ini
Alternatively, you can also manually integrate the agent by adding the following lines at the very top of your python WSGI script file. (This is useful if you’re using mod_wsgi.)
import newrelic newrelic.agent.initialize('/path/to/newrelic.ini')
Start or restart your Python web application or WSGI server.
Done! Check your application in the New Relic RPM UI to see the real time statistics generated from your application.
New Relic for Python is free-to-use, proprietary software. Please see the LICENSE file in the distribution for details on the New Relic License agreement and the licenses of its dependencies.
Copyright (c) 2010-2018 New Relic, Inc. All rights reserved.