4 minutes read

POSTED May, 2022 dot IN Serverless

Monitoring to Debugging: 7 Thundra Features to Improve Development

Serkan Özal

Written by Serkan Özal

Founder and CTO of Thundra

While it may seem like cloud-native tools are limitless, monitoring and debugging in a cloud environment is still a challenge. Users often have to combine tools to set up a working environment for monitoring and debugging, and these tools don’t always work well together.

Thundra was developed with the understanding that monitoring a system from a single pane is critical for efficient and effective debugging. In this article, we’ll look at 7 powerful features that Thundra offers so you can focus on building new features, instead of struggling to debug your applications on your own.

7 Unique Capabilities

To showcase Thundra’s powerful capabilities, we need to create an example application. For this demonstration, we’ll implement a service that manages requests using AWS Lambda and DynamoDB in the Java language. We’ll use Localstack, so we don’t actually need to integrate with the real service in AWS, and we’ll use serverless to deploy the application locally.

You can find more details on how the service is made in this git repository.

Now that you’re set up, here are 7 useful features from Thundra that you can explore in this demonstration.

1. Distributed Tracing

Thundra APM makes it easy for users to see the distributed traces of their running application. This is very helpful in distributed systems, where things can easily fall apart due to a single error.

To integrate our example application with Thundra APM, all you need to do is add the Thundra API key into the serverless.yml file:

  name: aws
  runtime: java8
  stage: ${self:custom.stage}
  region: ${self:custom.region}
  memorySize: ${opt:memory, 512}
  timeout: ${opt:timeout, 60}
    name: ${self:custom.deploymentBucketName}
    PRODUCTS_TABLE_NAME: ${self:custom.tableName}
    ARCHIVE_BUCKET_NAME: ${self:custom.bucketName}

We’ll start our application with the make start command, and then check the Trace Map in the Thundra APM dashboard.

Figure 1 : Trace Map of how requests are made in the example application

2. Time Travel Debugging

If you use or have thought of using Thundra, you already know about features like easy scaling, only paying for what you use, and freedom from setting up your own infrastructure from scratch. But one of Thundra’s greatest assets is its Time Travel Debugging (TTD) feature.

Working with a cloud environment has its pain points, and the most annoying is probably debugging. To make things more difficult, code editors or IDEs offer little support for debugging cloud services. Thundra APM, on the other hand, supports debugging with cloud resources.

Below, we’ll model how to debug Lambda functions in our sample application using the TTD feature in Thundra APM. To follow along, add the following to your serverless.yml file:

  - serverless-plugin-thundra

Now, all you need to do is deploy your application and invoke the method that you want to debug:

sls deploy
sls invoke --function http_handleRequest

3. Chaos Engineering Support in Thundra

In software development, no matter how many tests we run,  we can’t be sure our products will always work in production. But chaos engineering can help us minimize the impact catastrophes have on our products.

Thundra makes it easy for users to set up and monitor chaos testing tasks. To set up chaos testing, follow Thundra’s chaos engineering guide.

Thundra APM provides a few ways to inject errors into the application. Our example below shows how to inject errors in DynamoDB.

 public static void injectDynamoDBError() {
        ErrorInjectorSpanListener errorListener =
                        errorMessage("As AWS CTO Werner Vogels said, 'Everything fails, all the time.'").
        FilteringSpanListener errorFilteringSpanListener =

To run the chaos tests in our example project, run the command:

make test

You’ll then be able to view which part of the test is broken by going to the Thundra APM dashboard.

Figure 2 : View Trace Maps and debug every line of our code from Thundra APM

4. Apply Asynchronous Monitoring

Traditional monitoring solutions are often synchronous. However, with synchronous monitoring, there tends to be more latency for the application. In order to optimize the performance of applications while applying monitoring methods, Thundra provides an asynchronous monitoring option.

In our demo example, all we need to do to apply asynchronous monitoring is add the following code to our serverless.yml file, and we’re good to go:

thundra_agent_lambda_report_cloudwatch_enable: true

5. Sampling

Monitoring and logging applications are important, but most of the time we don’t need to collect every log. Besides, more logs mean more storage and higher costs.

Thundra APM provides sampling, which only collects the logs, traces, and metrics defined in the configuration. For details on how to enable and use this feature, refer to the Thundra APM documentation. You can also find an example code for trace sampling below.

import io.thundra.agent.trace.sample.impl.DurationAwareThundraSpanSampler;
import io.thundra.agent.trace.TraceSupport;
DurationAwareThundraSpanSampler durationAwareSampler =
        new DurationAwareThundraSpanSampler(1000);

6. Masking for Traces While Monitoring

When collecting traces for debugging purposes, there might be sensitive user data that you aren’t able to collect.

Luckily, Thundra supports many types of masking, so you can apply the method that best fits your situation. Read the documentation for details on how to apply masking when collecting logs and traces. Below is an example of how to mask data in MongoDB with just a line of text added to the serverless.yml file.

thundra_agent_trace_integrations_mongodb_command_mask: true

7. Automated Instrumentation Support

Thundra provides services for automated instrumentation support. That means that you don’t need to set up and add configuration methods to your existing project because Thundra automatically collects the data for you. Tools that are supported by default include Redis, AWS resources, HTTP endpoints, and MySQL.

You can find details in the APM guide.


With these 7 powerful features, your software development team can see both the big picture and a detailed view of your application through Thundra. Monitoring and debugging are made easy, and your team can display the results of their tests in one place. This includes everything from unit tests and integration tests, to end-to-end testing. Thundra even supports sophisticated tasks like chaos testing by providing the agent and Trace Map to show where the chaos starts and how it impacts the system.

From the local environment to the production environment, Thundra supports easy debugging. You don’t have to worry about reproducing the production bug that happened only once, because the root cause of the bug can easily be found using Thundra logs and Trace Maps.

Start experimenting with Thundra’s powerful features today, so you can stop debugging and focus on building your own new features.