Skip to content

AWS Lambda

This guide configures logs, traces, metrics. Replace YOUR_INGEST_KEY with your key on your server, never in a public example.

Attach the current published layer ARN from the official Lambda instructions. Never reuse an ARN from a different region or architecture. Layer support differs by runtime. For Java/.NET use their runtime-specific Lambda instrumentation.

Runtime: Node.js or Python
Layer: official OpenTelemetry Lambda layer for your runtime, region and CPU architecture
Node wrapper: AWS_LAMBDA_EXEC_WRAPPER=/opt/otel-handler
Python wrapper: AWS_LAMBDA_EXEC_WRAPPER=/opt/otel-instrument

Set these on the running service. Keep the key out of source control, client bundles and build logs.

Terminal window
export OTEL_SERVICE_NAME='my-service'
export OTEL_RESOURCE_ATTRIBUTES='deployment.environment.name=production'
export OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
export OTEL_EXPORTER_OTLP_LOGS_ENDPOINT='https://otlp.siteqwality.com/v1/logs'
export OTEL_EXPORTER_OTLP_LOGS_HEADERS='Authorization=YOUR_INGEST_KEY'
export OTEL_EXPORTER_OTLP_TRACES_ENDPOINT='https://otlp.siteqwality.com/v1/traces'
export OTEL_EXPORTER_OTLP_TRACES_HEADERS='Authorization=YOUR_INGEST_KEY'
export OTEL_EXPORTER_OTLP_METRICS_ENDPOINT='https://otlp.siteqwality.com/v1/metrics'
export OTEL_EXPORTER_OTLP_METRICS_HEADERS='Authorization=YOUR_INGEST_KEY'
export OTEL_LOGS_EXPORTER=otlp
export OTEL_TRACES_EXPORTER=otlp
export OTEL_METRICS_EXPORTER=otlp

Use a test event accepted by your function. Configure variables through your infrastructure secret mechanism. Do not replace the function environment wholesale with a sample. Export during the invocation or use the Collector extension; a background timer may be frozen after return. CloudWatch logs are separate unless a logging bridge, extension or Firehose forwards them.

Terminal window
aws lambda invoke --function-name YOUR_FUNCTION --payload fileb://event.json response.json

Open Logs, Traces or Metrics. New data usually shows up within a minute, and a page that says it is waiting for data switches to your data on its own. Nothing arriving? See what each status code means in failure handling.

Store the key in your platform secret mechanism, rotate it when exposed and remove test keys. Set a stable service.name and deployment.environment.name; avoid user IDs or unbounded values in metric labels. Prefer a persistent queue, bounded retries and exporter failure monitoring. Review redaction and processors before increasing traffic.