AppOptics Integration with Django/uWSGI/Nginx on DigitalOcean Platform

Hi All,

I have a simple Django website running on a DigitalOcean Droplet. The site is powered by Ubuntu 20.04, served by Nginx, which integrates with uSWGI, which in turn integrates with Django.

I am trying to configure SolwarWinds cloud monitoring platform (AO/Loggly/Pingdom) to monitor it. Pingdom and Loggly are working fine and can display data from their collectors.

With AppOptics, the setup does not seem to be finding any metrics from any collector. I followed the instructions on this page:

to install the AppOptics APM agent, set the service key, add the appoptics djangoware application to the file of Django project. Also ensured the service key is set by /etc/bash.bashrc - so it's systemwide for non-interactive shells as well.

The swisnapd service is running, but the logs are showing messages like:

ERRO[2021-04-05T09:12:00Z] Failures while collecting metrics             _function=CollectMetrics errors=[action error: error when receiving part of GRPC collect response: rpc error: code = Unknown desc = plugin is not able to collect metrics: can't process collect request, other request for the same id (2f5e<redacted>) is in progress] task-id=<redacted>

The syslog shows this messages:

No subscribers to send message

And from the AppOptics Set up APM UI, the spinning wheel keeps running:

Now, the Set up APM page also has this instruction:

Import the AppOptics agent and attach it to your web application. Here's an example for Flask:

from appoptics_apm.middleware import AppOpticsApmMiddleware
# the flask app
app = Flask(__name__)
app.wsgi_app = AppOpticsApmMiddleware(app.wsgi_app)

And the link above shows this information:

Many python apps are implemented atop WSGI, which provides a uniform interface through which web frameworks and middleware libraries interoperate. AppOptics offers a WSGI middleware component called AppOpticsApmMiddleware, which wraps your WSGI app to collect performance statistics. Install middleware instrumentation as you would any other middleware by adding it to the file that instantiates your app. But put it at the end of the list, closest to the outside of the middleware stack.

Can anyone tell me how does this work for Django website served by uSWGI?

  • What changes (if I have to) I need to make in Django file?
  • What changes (if I have to) I need to make in Django file?
  • What other changes do I need to make?

Thanks so much for your help!