Thundra APM
Search…
Deployment Integrations
Powered By GitBook
Zero Overhead with Lambda Extensions
For AWS Lambda monitoring, there's an inevitable overhead due to the transmission of the data to the collectors. Thundra already solves this problem by asynchronous monitoring by gathering logs from CW. With the preview announcement of Lambda Extensions, Thundra provides an alternative way of transmitting observability data to our collectors.
By default, Thundra agent collects telemetry data during invocation and send them at the end of invocation to the Thundra collector endpoint (communicates with regional collector endpoint ${region}.collector.thundra.io to minimize network RTT). Of course this adds extra latency to the invocation duration around 3-4 milliseconds on average.
Thundra Lambda extension is a kind of companion process which provides asynchronous telemetry data (traces, metrics, logs) reporting functionality to the Thundra agents. To do that, Thundra extension starts a local collector and Thundra agent sends collected data to the local collector endpoint without any network delay. Then Thundra extension sends buffered data to the real collector asynchronously along with the execution of the invocation. So there will be zero network delay added by Thundra agent. Additionally, remaining buffered telemetry data is flushed on shutdown of the Lambda container.

How to Setup Thundra Lambda Extension?

    Thundra Lambda extension is also an extension to Thundra Lambda agent running along with your application Our Lambda extension is supported every runtime that Thundra has the agent for - Node.js, Python, Java, Go, .NET. In order to use our extension, the Thundra agent must be integrated into your Lambda application first.
    Then, the Thundra agent must be configured to use the local collector as the data transmission point, which is provided by the Thundra Lambda extension, instead of the remote collector. The configuration can be done easily through environment variables by setting THUNDRA_AGENT_REPORT_REST_LOCAL to true

Add Thundra Lambda Extension with AWS Lambda layer

Thundra Lambda extension is published as an AWS Lambda layer which includes extension implementation. So it can be added as follows:
arn:aws:lambda:${region}:269863060030:layer:thundra-lambda-extension:3

Add Thundra Lambda Extension with Container Images

Thundra Lambda extension is available as container images as well. So it can be added as follows:
FROM thundraio/thundra-lambda-extension:LATEST
For Java runtime, an example Dockerfile configuration:
Dockerfile
1
FROM thundraio/thundra-lambda-container-base-java8:LATEST
2
FROM thundraio/thundra-lambda-extension:LATEST AS ext
3
4
# copy Thundra Lambda extension to /opt
5
WORKDIR /opt
6
COPY --from=ext /opt/ .
7
8
# your function code path
9
ARG FUNCTION_CODE_PATH="target/sample-app.jar"
10
11
# task directory
12
ARG TASK_DIR="/var/task"
13
14
# create task directory
15
RUN mkdir -p ${TASK_DIR}
16
17
# copy your function code to the task directory
18
COPY ${FUNCTION_CODE_PATH} ${TASK_DIR}
19
20
# Set the CMD to your handler
21
CMD ["io.thundra.container.sample.Handler"]
Copied!
Last modified 4mo ago