Reducing Data Size with Sampling

In a serverless system to have a reliable product, users need to be aware of issues and fix these issues quickly. You need have a useful contextual information for debugging and troubleshooting your serverless system. Observability is the key feature to achieve an insight about how your system is working, detect problems and taking actions about them quickly. However, it could cause cost issues such as collecting logs and data to observe your serverless system. Now, in favor of sampling feature of Thundra you don't need to worry about cost problems!

Using Thundra, data of your system is collected by asynchronous or synchronously. In order to collect data async, lots of data is sent to CloudWatch logs and this causes much more cost to you. Sampling allows you to reduce your cost easily and continue to observe your serverless system without missing out issues. Taking a percentage of your invocation can be enough to observe your metrics, anomalies and debug your system. You can sample your metrics, traces and logs.

Sampling Metrics

While sampling your metric data you can use 4 different ways:

  • Count Aware Sampler - samples metrics for a configured percentage of all invocations.

  • Time Aware Sampler - samples metrics with every configured time within consecutive lambda invocations.

  • Error Aware Sampler - samples metrics for erroneous invocations.

  • Custom Sampler - samples metrics with customized function.

  • Composite Sampler - samples metrics with more than one sampler.

Sampling Traces

In Thundra you can also sample your trace data. In order to sample your trace data you can use different ways:

  • Duration Aware Sampler - samples trace data only if duration of invocation is more than configured time.

  • Error Aware Sampler - samples traces for erroneous invocations.

  • Count Aware Sampler - samples traces for a configured percentage of all invocations.

  • Time Aware Sampler - samples trace data with every configured time within consecutive lambda invocations.

  • Custom Sampler - samples traces with a customized function.

Sampling Logs

Logs can cause spending more while you are observing your serverless system. Thundra helps you to sample your logs in different ways:

  • Count Aware Sampler - samples logs for a configured percentage of all invocations.

  • Time Aware Sampler - samples logs with every configured time within consecutive lambda invocations.

  • Error Aware Sampler - samples logs for erroneous invocations.

  • Custom Sampler - samples logs with customized function.

  • Log level filtering - set level of logs that will be reported.

How to configure your serverless system for sampling?

To use sampling in your serverless system , you can follow our documentations: