Your data. Anywhere you go.

New Relic for iOS or Android


Download on the App Store    Android App on Google play


New Relic Insights App for iOS


Download on the App Store


Learn more

Close icon

Relic Solution: Python Agent Not Reporting Data

level-up
relic-solutions

#1

You just installed the Python Agent, but aren’t seeing data report to the UI. We’ll run through some different scenarios that can get your application up and running.

Topics that are covered in this Level Up:

  1. Quick Troubleshooting Steps
  2. Monitoring Background Tasks
  3. Other Troubleshooting Guides
  4. Information to Send New Relic Support

1. Quick Troubleshooting Steps

To rule out some possible quick solutions, you’ll want to confirm the below steps before troubleshooting any further:

  • If you’re using a virtual environment, confirm that you’ve installed the agent in the same environment as your application.
  • The Python Agent includes a built-in test app that can verify your connection to the New Relic collector. The following doc: Testing the Python Agent will help you confirm nothing is blocking the New Relic collector from collecting data. If you aren’t seeing data with your test app, looking at the logs should give some insight.
  • You’re seeing a banner at the top of your application that says “Some modules were uninstrumented…” when using manual integration. You’ll want to ensure that your import order is correct. More information about this can be found linked in this Level Up post here:

2. Monitoring Background Tasks vs. a Web Application

If the application you’re trying to monitor reports background tasks more so than web data, there a few things you’ll want to configure to get them reporting to your application. To start, you’ll want to use the background_task Python Agent API. More information and examples of how that can be used is linked below:

Additionally, if the tasks you are running are short-lived and execute quickly, you may need to add a startup timeout to ensure your application completely registers. You can do so by adding the following to your newrelic.ini:

startup_timeout = 5.0
shutdown_timeout = 5.0

It’s important to know that the values set in the above example does not mean it is going to add 10 seconds execution time to your script. The startup_timeout value would be a delay in the time it takes the agent to register before executing your script. If you were to set startup_timeout to be 1 second, that may not be enough time for the agent to register and could be a result in loss of data. If you set that value to be 20, that time would typically be more than enough time to register the agent.

The same is the case for shutdown_timeout configuration setting. If we set the shutdown_timeout to be 20 seconds, It adds a delay for your script to gracefully shutdown and for your data to be sent. However, if you were to set that value to be 1, that might not give the agent enough time to gracefully shutdown and send all data.

More information about those configuration options can be found liked here:


3. Other Troubleshooting Guides

A few other helpful guides to get Python data reporting, based on your environment:


4. Information to Send New Relic Support

If none of the scenarios above help and you’re still not able to see data report, let us know! You can create a topic in the Explorer’s Hub, or create a ticket. Some information that would be helpful for us to help you include:

  • If you’re using our wrapper script or manual instrumentation to integrate the Python agent with your app. Sending us your start-up command or a code snippet demonstrating how you are integrating the agent.
  • If you are using a framework and WSGI server, which framework and server and which versions of each?
  • Your newrelic.ini configuration file.
  • The output of a pip freeze
  • Debug logs