To blog |

Plumbr now monitors Python applications and APIs

May 6, 2020 by Ago Allikmaa Filed under: Monitoring Plumbr Product Updates Tracing

Plumbr uses tracing to provide actionable insight into your application’s performance. The traces begin in the end users’ browsers (or at the API endpoint for APIs) and cover all servers in the backend that participate in serving the user interactions (or API calls).

Today, we’re happy to announce that Plumbr back-end agents can now also trace backend calls serviced by Python applications. With this addition, we have extended the number of backend technologies that Plumbr can monitor to a total of five:

As a result, traces spanning through the back-end microservices deployed across all the different runtimes mentioned above will be monitored end-to-end.

Here’s a (somewhat anonymised and artificial-looking) example of how a Plumbr trace looks like that originated from an end user’s web interaction and traveled through Java and Python backends:

As you can see, Plumbr not only traces the request through the backend nodes, but also automatically links to errors in each node.

Here’s how to read the above example: 

  • The user clicked on a link labeled “Last 30 days”. 
  • Their interaction with the selfserve.acme.com application resulted in 4 backend calls.
  • The first call returned a status.json in 38 ms.
  • The second two XHR calls, to accountinfo and userinfo, were served by a selfserve-api JVM and also took less than 100 ms to complete. 
  • The fourth call, to services API endpoint, returned an error from the selfserve-api JVM (notice the red bar on the chart that ends with the exception pin).
    • We can also see that the JVM had internally called a crm-api Python service, which responded with an error.
    • When I clicked on the exception pin, the above stack trace and exception message opened.

Similarly, Plumbr also automatically detects the most common performance bottlenecks in Python code. Here’s a screenshot from our test API call that had a slow database query in the Python code:

What can we learn from the trace?

  • A consumer called the /sql_slow endpoint of the monitored gunicorn API
  • It was served by a Python application. API response time was 6 sec 196 ms
  • Out of the total response time, 6 sec 32 ms were spent waiting for the select pg_sleep(?) database query, location of which in code is indicated by the included Python call stack. Clearly, this database call was the main bottleneck that made our API response slow.

As with Java and PHP, also the errors and bottlenecks in Python code are automatically detected by Plumbr and linked to the distributed trace. This ensures that you will always have an objective overview of the code issues that impact your application’s end users or API consumers.

Installation instructions

In order to use Plumbr with your Python applications or APIs, you do not need to make any changes to your application. You just need to attach an agent to the underlying application framework. In order to install Plumbr on the server running your Python application, just do this:

  1. Log in to your Plumbr account, download the zipped installer and extract the contents to a convenient location on your server.
  2. Run the installer in your terminal:
    sudo ./PlumbrAgentInstaller
  3. Enter your server and cluster details requested (defaults are provided).
  4. Restart your services to begin monitoring.

Supported Python frameworks

At the moment, Plumbr offers official out of the box support for Django and Flask frameworks. We’re happy to extend this to other frameworks as well, as per customer requirements. If you’re using a different framework, let us know!

Finally, if you’re already using Plumbr to monitor your Java or PHP backend nodes, and these in turn use Python-based (micro) services, we encourage you to add these Python services to your Plumbr dashboard as well. Downstream API calls will not even count towards your subscription limit, which means that you will get downstream visibility free of charge.

For any assistance with installation and use, please write to support@plumbr.io. Our Customer Success team is more than happy to help you expand Plumbr to monitor your Python applications and APIs.

ADD COMMENT