Documentation forSolarWinds Observability SaaS

AWS Lambda instrumentation for Java

Auto-instrumentation imposes significant overhead during cold start. See OTel recommendations and Lambda Auto-Instrumentation. Because of this, only Lambda and AWS SDK instrumentation are enabled by default, but additional instrumentation can be enabled by configuration as described here. To enable all instrumentation set the environment variable OTEL_INSTRUMENTATION_COMMON_DEFAULT_ENABLED=true.

Compatibility

The supported runtime versions are Java 8, 11, 17, and 21. The Lambda runtime must be an OS based on Amazon Linux 2.

Most of the Java Library features are supported in the AWS Lambda environment. The exceptions are:

Add layer

Ensure the otelcol layer is already added and configured.

The layer ARN is listed in the SolarWinds Observability Summary Release Notes. Be sure to choose the AWS Region that corresponds to your Lambda function.

An example of adding the Java instrumentation layer to your function (in the us-east-1 region) using AWS CLI v2:

The --layers argument replaces what is set for the function, so any existing layers should be specified in the argument.

aws lambda update-function-configuration --function-name <your-function-name> --layers 'arn:aws:lambda:us-east-1:851060098468:layer:solarwinds-apm-java-2_0_0:1' ...

Configure

Set the required environment variables listed below in your Lambda function’s configuration settings. Recommended and useful optional settings are also listed.

Environment variable Description Requirement
AWS_LAMBDA_EXEC_WRAPPER

/opt/solarwinds-apm/wrapper

This must be set to enable the instrumentation extension.

Required
SW_APM_TRANSACTION_NAME

<transaction-name>

Telemetry from the Lambda function will be associated with this Transaction under the SolarWinds Observability SaaS Service. If unset, the Transaction name defaults to the Lambda function name.

Recommended
SW_APM_DEBUG_LEVEL

Configure the Java Library

This may be useful for diagnostic purposes or for reducing logging to AWS CloudWatch.

Optional
OTEL_JAVAAGENT_DEBUG

Configure the Java Library

This may be useful for diagnostic purposes.

Optional

The other standard Java Library configuration options that are supported in the AWS Lambda environment are listed below. Most of them need to be set as properties in the solarwinds-apm-config.json file, which requires adding the file to a layer then configuring the environment variable SW_APM_CONFIG_FILE to point to it. S3 cannot be used because the file read mechanism assumes a local and not remote file.