Thundra: Serverless Observability for AWS Lambda

The black box nature of AWS Lambda and other serverless environments means that identifying and fixing performance issues is difficult and time-consuming. Built for straightforward debugging, monitoring, and observability, Thundra provides deep insight into your entire serverless environment. Thundra collects and correlates all your metrics, logs, and traces, allowing you to quickly identify problematic invocations and also analyzes external services associated with that function. With Thundra’s zero overhead and automated instrumentation capabilities, your developers are free to write code without worrying about bulking up their Lambdas or wasting time on chasing black box problems.

Get Started    Discussions

Installation and Configuration


Installation is extremely simple with the pip3 command in the directory of your project.

pip3 install thundra -t .

After installing Thundra’s python module, you simply have to import it within your Python Lambda function as shown below:

from thundra.thundra_agent import Thundra
thundra = Thundra(api_key=<your api key is here>)
def handler(event, context):
   print("Hello Thundra!")

To initialize your Thundra variable in your function, you can pass in your Thundra generated API key.

Automatic Wrapping

If you do not want to change your code you may also automatically wrap your Python function handlers by using Thundra's automatic wrapping capabilities for Python. This is a non-invasive method to wrap your functions and can be done when deploying your lambda functions using serverless. You can read about automatic wrapping in more detail here.


Configuring your Lambda functions allows you to control what information you would like to monitor and how you would like to monitor it. This includes monitoring modes such as synchronous or asynchronous monitoring. Thundra for Python functions can be configured in three ways, providing flexibility in how you prefer to monitor your applications. These include:

A detailed list of configuration variable can be found here

After you have successfully configured your lambda function as per the steps above, you can expect to see invocation details of your Lambda function on the Thundra Web Console. This includes displaying your invocation Trace as a single Span. To see more detailed span information, you can instrument your function further, either by manual or through automated instrumentation.

Serverless Framework

Serverless framework deployment is facilitated by using Thundra’s environment variables and setting them in your serverless.yml file. Deploying your serverless application will set these variables and allow Thundra to monitor your functions. A list of environment variables that you may configure in your serverless.yml file can be found here.

Programatic Configuration

You can configure Thundra monitoring in your code base itself using module initialization parameters and are set when initializing your thundra variable. A list of Python initialization variables can be found here.

The initialization variables are passed into the Thundra constructor as comma separated parameters. An example can be seen below:

Configuration Precedence

It must be noted that environment variables have a higher precedence over initialization parameters.

Configuration via AWS Console

This allows you to set Thundra’s environment variables in your AWS lambda function console itself. Hence allowing you to set them through AWS.

To do so, ensure that you have all the required python modules zipped in a single file. By choosing the ‘Upload a zip file’ option in the ‘Code entry type’ drop-down field of the console, you can upload your code with a few clicks, and begin to configure Thundra as you prefer.

Environment variables go in the ‘Environment Variables’ field of the console and clicking 'Save' on the top right-hand side will set your configurations.

You can configure Thundra using environment variables or module initialization parameters.
Environment variables have higher precedence over initialization parameters. For detailed information about all configuration options, check out this documentation.