AWS Open Distro for OpenTelemetry

AWS Distro for OpenTelemetry Lambda

AWS Distro for OpenTelemetry Lambda

The AWS Distro for OpenTelemetry now supports AWS managed Lambda layers. AWS managed Lambda layers for ADOT provides a plug-and-play user experience by automatically instrumenting a Lambda function, by packaging OpenTelemetry together with an out-of-the-box configuration for AWS Lambda and AWS X-Ray in an easy to setup layer. Users can enable and disable OpenTelemetry for their Lambda function without changing code.




Getting Started with AWS Lambda layers

Manual Steps for Private Lambda Layers

See the documentation on the OpenTelemetry Lambda repository.

Custom configuration for the ADOT Collector on Lambda

The ADOT Lambda layers combines both OpenTelemetry and the ADOT Collector. The configuration of the ADOT Collector follows the OpenTelemetry standard. By default, the ADOT Lambda layer uses config.yaml, which exports telemetry data to AWS X-Ray.

To enable debugging, you can use the configuration file to set log level to debug. See the example below.

To customize the collector configuration, add a configuration yaml file to your function code. Once the file has been deployed with a Lambda function, create an environment variable on your Lambda function OPENTELEMETRY_COLLECTOR_CONFIG_FILE and set it to /var/task/*<path/<to>/<filename>*. This will tell the extension where to find the collector configuration.

Here is a sample configuration file, collector.yaml in the root directory:

#collector.yaml in the root directory
#Set an environemnt variable 'OPENTELEMETRY_COLLECTOR_CONFIG_FILE' to '/var/task/<path/<to>/<file>'
receivers:
otlp:
protocols:
grpc:
exporters:
logging:
loglevel: debug
otlp:
protocols:
http:
endpoint: 0.0.0.0:55681
#enables output for traces to xray
service:
pipelines:
traces:
receivers: [otlp]
exporters: [logging, xray]

You can set this via the Lambda console, or via the AWS CLI.

aws lambda update-function-configuration --function-name Function --environment Variables={OPENTELEMETRY_COLLECTOR_CONFIG_FILE=/var/task/collector.yaml}

You can configure environment variables via CloudFormation template as well:

Function:
Type: AWS::Serverless::Function
Properties:
...
Environment:
Variables:
OPENTELEMETRY_COLLECTOR_CONFIG_FILE: /var/task/collector.yaml

For more information about ADOT Collector configuration, such as adding ca/cert/key files, see the Github README.md.