Dash0 integrates with AWS Lambda to collect telemetry data such as traces, logs, and metrics.
AWS Lambda is a serverless compute service that lets you run code without provisioning or managing servers. You can use AWS Lambda to run code in response to events such as changes in data or system state, or actions by users. You can integrate AWS Lambda with Dash0 to send telemetry data such as logs, metrics, and traces.
To collect telemetry data from an AWS Lambda function, you need to instrument your Lambda function with an OpenTelemetry SDK and configure the latter to send telemetry to Dash0.
The traces, logs and metrics generated by the OpenTelemetry SDK inside your function is routed to a local OpenTelemetry Collector, acting as a AWS Lambda External Extension, which then forwards it to Dash0. The local OpenTelemetry Collector also collects as logs the output your function sends to its standard output and standard error.
For collecting the platform metrics from the Lambda runtime, like throttles and recursive invocations, use the CloudWatch metrics integration.
Before starting, ensure you have:
The setup is based on the OpenTelemetry Lambda setup and varies depending on your Lambda function's programming language.
You need to create a configuration file that tells the OpenTelemetry Collector how to send telemetry data to Dash0. You can store this configuration in three ways:
Create a file named otel-collector-config.yaml
with the following content:
To create a Lambda layer containing your configuration:
otel-collector-config
).otel-collector-config.yaml
file in the root directory.For detailed instructions, see the AWS documentation on creating layers.
Your Lambda function needs three layers:
Replace <region>
with your AWS region and <version>
with the latest version number.
Runtime | Instrumentation Layer ARN | Latest Version | Wrapper Path |
---|---|---|---|
Node.js | arn:aws:lambda:<region>:184161586896:layer:opentelemetry-nodejs-<version>:1 | /opt/otel-handler | |
Python | arn:aws:lambda:<region>:184161586896:layer:opentelemetry-python-<version>:1 | /opt/otel-instrument | |
Java Agent | arn:aws:lambda:<region>:184161586896:layer:opentelemetry-javaagent-<version>:1 | /opt/otel-handler | |
Java Wrapper | arn:aws:lambda:<region>:184161586896:layer:opentelemetry-javawrapper-<version>:1 | /opt/otel-handler | |
Ruby | arn:aws:lambda:<region>:184161586896:layer:opentelemetry-ruby-dev-<version>:1 | /opt/otel-handler |
OpenTelemetry Collector Layer:
arn:aws:lambda:<region>:184161586896:layer:opentelemetry-collector-<amd64|arm64>-<version>:1
Variable | Value | Description |
---|---|---|
AWS_LAMBDA_EXEC_WRAPPER | See table above | Path to the OpenTelemetry wrapper for your runtime |
OPENTELEMETRY_COLLECTOR_CONFIG_URI | See options below | Location of your collector configuration file |
Choose one based on how you stored your configuration file:
Lambda Layer: /opt/otel-collector-config.yaml
Function Bundle: /var/task/otel-collector-config.yaml
S3 Bucket: s3://<bucket_name>.s3.<region>.amazonaws.com/otel-collector-config.yaml
Note: For S3, ensure your Lambda function has permissions to read the bucket and use the full S3 URI including the s3://
prefix.
After completing the setup:
The OpenTelemetry collector automatically collects Lambda function logs and sends them to Dash0.
Important: To correlate logs with traces, use a logger that supports OpenTelemetry. Your logs should include tracing information as part of their structured output.
Application metrics emitted using the OpenTelemetry SDK are automatically captured by the collector and exported to Dash0.
For Lambda runtime metrics (invocation count, duration, error rates, etc.), use the CloudWatch metrics integration.