Skip to main content
You only need to add the Python Lambda layer — no separate collector layer is required. Trace0 handles ingestion directly.

1. Add the OpenTelemetry Lambda Layer

Find the latest layer-python ARN for your AWS region from the opentelemetry-lambda releases page. Add the layer ARN to your function.

2. Set Environment Variables

3. Set HTTP request spans

For lambdas triggered via API Gateway, the HTTP request and response attributes are not set automatically on the lambda invocation span by the OTel Lambda auto-instrumentation. Therefore, they need to be set manually in your lambda code handler.

4. Add Trace0 logger

The OpenTelemetry Lambda Layer does not include the opentelemetry-instrumentation-logging library. Adding it as a dependency pulls in opentelemetry-sdk and opentelemetry-instrumentation as transitive dependencies — both of which are already bundled in the layer — resulting in duplicate packages and potential version conflicts. The trace0-lambda-otel-logger library solves this problem by installing a logging.Handler on the root logger that automatically injects the active OTel span’s traceId and spanId into every log record, and exporting them directly to the Trace0 ingest endpoint. This enables full log-trace correlation, while only depending on opentelemetry-api, which is already present in the layer, making it safe to install alongside it. First, install the library:
Then add the library as the first import in your Lambda handler module, and call flush() at the end of every invocation:
The library will now automatically capture all logging output, inject OTel trace context (traceId, spanId), and export the logs to the Trace0 ingest endpoint.

5. Deploy service

Deploy your service and watch traces, metrics, and logs appear in the Trace0 dashboard within seconds.

Example service

See our Python Lambda example app for a working service you can deploy to your AWS account.