Перейти к основному содержимому
Перейти к основному содержимому

AWS Lambda

This guide Integrates:

✅ Logs✅ Metrics✅ Traces

Installing the OpenTelemetry Lambda layers

The OpenTelemetry project provides separate lambda layers to:

  1. Automatically instrument your Lambda function code with OpenTelemetry auto-instrumentation.
  2. Forward the collected logs, metrics, and traces to ClickStack.

Adding the language-specific auto-instrumentation layer

The language-specific auto-instrumentation lambda layers automatically instrument your Lambda function code with OpenTelemetry auto-instrumentation package for your specific language.

Each language and region has its own layer ARN.

If your Lambda is already instrumented with an OpenTelemetry SDK, you can skip this step.

To get started:

  1. In the Layers section click "Add a layer"
  2. Select specify an ARN and choose the correct ARN based on language, ensure you replace the <region> with your region (ex. us-east-2):

The latest releases of the layers can be found in the OpenTelemetry Lambda Layers GitHub repository.

  1. Configure the following environment variables in your Lambda function under "Configuration" > "Environment variables".

Installing the OpenTelemetry collector Lambda layer

The collector Lambda layer allows you to forward logs, metrics, and traces from your Lambda function to ClickStack without impacting response times due to exporter latency.

To install the collector layer:

  1. In the Layers section click "Add a layer"
  2. Select specify an ARN and choose the correct ARN based on architecture, ensure you replace the <region> with your region (ex. us-east-2):
  1. Add the following collector.yaml file to your project to configure the collector to send to ClickStack:
  1. Add the following environment variable:

Checking the installation

After deploying the layers, you should now see traces automatically collected from your Lambda function in HyperDX. The decouple and batching processor may introduce a delay in telemetry collection, so traces may be delayed in showing up. To emit custom logs or metrics, you'll need to instrument your code your language-specific OpenTelemetry SDKs.

Troubleshooting

Custom instrumentation not sending

If you're not seeing your manually defined traces or other telemetry, you may be using an incompatible version of the OpenTelemetry API package. Ensure your OpenTelemetry API package is at least the same or lower version than the version included in the AWS lambda.

Enabling SDK debug logs

Set the OTEL_LOG_LEVEL environment variable to DEBUG to enable debug logs from the OpenTelemetry SDK. This will help ensure that the auto-instrumentation layer is correctly instrumenting your application.

Enabling collector debug logs

To debug collector issues, you can enable debug logs by modifying your collector configuration file to add the logging exporter and setting the telemetry log level to debug to enable more verbose logging from the collector lambda layer.