[WHITE PAPER]: Introduction to Serverless Monitoring Get the e-book! 📖

Recent Developments in monitoring AWS Lambda in Python

Jun 20, 2019

Thundra’s Python agent recently had important additions to its feature set. We made observing applications with distributed components easier with distributed tracing support. Also, it now has automatic tracing for SqlAlchemy, Elasticsearch, and MongoDB to ease observing interactions with your datastores. Moreover, we added sampling support for log, metric and trace plugins to filter data intelligently under heavy load.

Architecture View and Distributed Tracing

On the process of moving from monolithic applications to microservices, the components that construct the system becomes more distributed and interactions between the components can become the key point in the design of the architecture. Visualizing components and interactions between them can help developers understand the system as a whole. Also, seeing the path of an individual request through traces can help figure out how the application behaves and pinpoint possible failures in the system. For these reasons, Thundra has recently announced Architecture View and Distributed Tracing. Using Thundra’s Python agent, (along with Java, Nodejs and Go agents) one can see the architecture of the system in Architecture page and trace maps on Traces page.

Let’s go over a very simple example to see architecture and distributed tracing in action. Suppose we have an application where we get comments from different sources and they can later be searched. For the purpose of demonstration, let's say that different data providers are using different endpoints in our system.

image1We have several endpoints to post comments.  We store comments in a DynamoDB table and also write to Elasticsearch in order to have free text search capability for search endpoint. In this example, there are two endpoints for simplicity but we can also assume that we might have many different sources writing comments to the dynamodb.

In the example, we can see that we have an error while writing to elasticsearch as the arrow representing interaction with it is red. To inspect, when we click on the erroneous link, the invocation with error is shown as below:


When we click on invocation, the invocation detail page is shown and we can have a look at the erroneous interaction with Elasticsearch.


It is visible from the trace details that it was a parsing error on the date field. The date format expected is different from what we got and that was not handled on the path. We can click on the trace button to see the path that caused this error to happen.


We can see from above that the request to our endpoint did not have the appropriate format. One of the data providers is sending different date format than what we expected and we are able to easily identify the source of problematic invocation using Thundra’s Trace map. Instead of going over logs to see where a problem originated, seeing it in one trace from start to end can save lots of time.

This example is quite simple for demonstration purposes but the architecture of our system could be more complicated and seeing the origin and the path for an error or unexpected result can save you from searching for Waldo in your application.

New Integrations

Data storage is of crucial importance in almost all applications. Tracing interactions of your functions with data storage units can have significant benefits especially the underlying queries are a mystery for you. If you can demystify these, you can also optimize them.  Hence, Thundra’s Python agent has new integrations to support automatic tracing for:


SqlAlchemy is a SQL toolkit and ORM providing an abstraction over DBAPI implementations. Thundra Python agent supports integration for  https://pypi.org/project/SQLAlchemy/. Check out the documentation for Thundra Python Sqlalchemy integration.


Elasticsearch is an open-source, RESTful, distributed search and analytics engine built on Apache Lucene. Thundra's Python agent supports integration with the Elasticsearch client for https://pypi.org/project/elasticsearch/. Check out the documentation for Thundra Python Elasticsearch integration.


MongoDB is a cross-platform document-oriented database program. Thundra's Python agent supports integration with the MongoDB client for https://pypi.org/project/pymongo/. Check out the documentation for Thundra Python MongoDB integration.

Sampling support

Sampling is the recommended method to decrease observability data size. While using sampling to reduce data size, it is important to sample relevant data. Thundra’s Python agent supports intelligent sampling to be able to reduce the size of data without losing representation. You can read it from Yan Cui's blog on how you can achieve the observability without breaking the bank. For more information about sampling, check out the documentation.

I have done a quick recap of recent improvements to our system and python agent. There will be more improvements and features to come. You can now also see new announcements in our console with changelog tab.

You can sign up to our web console and start experimenting. Don’t forget to explore our demo environment - no sign up needed. We are very curious about your comments and feedback. Join our Slack channel or send a tweet or contact us from our website!