AWS Lambda
このガイドで統合するデータ:
| ✅ ログ | ✅ メトリクス | ✅ トレース |
OpenTelemetry Lambda レイヤーのインストール
OpenTelemetry プロジェクトは、次の目的で個別の Lambda レイヤーを提供しています:
- OpenTelemetry の自動インストルメンテーションを使用して、Lambda 関数のコードを自動的にインストルメントする。
- 収集したログ、メトリクス、トレースを ClickStack に転送する。
言語別の自動インストゥルメンテーションレイヤーの追加
言語別の自動インストゥルメンテーション Lambda レイヤーは、対象言語向けの OpenTelemetry の自動インストゥルメンテーション用パッケージを利用して、Lambda 関数コードを自動的にインストゥルメントします。
各言語およびリージョンごとに専用のレイヤー ARN が用意されています。
すでに Lambda 関数が OpenTelemetry SDK でインストゥルメントされている場合は、この手順はスキップできます。
設定を開始するには:
- 「Layers」セクションで「Add a layer」をクリックします。
- 「Specify an ARN」を選択し、言語に応じて正しい ARN を選択します。
<region>を自身のリージョンに置き換えてください(例:us-east-2):
- Javascript
- Python
- Java
- Ruby
The latest releases of the layers can be found in the OpenTelemetry Lambda Layers GitHub repository.
- Configure the following environment variables in your Lambda function under "Configuration" > "Environment variables".
- Javascript
- Python
- Java
- Ruby
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:
- In the Layers section click "Add a layer"
- Select specify an ARN and choose the correct ARN based on architecture, ensure you replace the
<region>with your region (ex.us-east-2):
- x86_64
- arm64
- Add the following
collector.yamlfile to your project to configure the collector to send to ClickStack:
- 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.