Documentation forSolarWinds Observability

AWS Lambda instrumentation

This topic covers AWS Lambda instrumentation for service entities. For information about the AWS Lambda metrics that can be gathered when monitoring your AWS cloud account, see Lambda metrics. For information about using AWS Lambda to collect logs from your AWS cloud account, see Add logs from AWS.

AWS Lambda function tracing for SolarWinds Observability is built on top of OpenTelemetry, which provides two extensions that enable the collection and export of telemetry for insight into the function handler execution. Both extensions are required for proper functionality.

  • Instrumentation: A language-specific extension that uses our APM library to collect trace and metrics.

  • Otelcol: A custom build of the OpenTelemetry Collector extension for Lambda that polls for sampling settings and transmits the data collected by instrumentation to SolarWinds Observability.

Compatibility

Lambda function architectures x86_64 and arm64 are supported.

The following AWS Regions are supported:

  • ap-northeast-1
  • ap-northeast-2
  • ap-south-1
  • ap-southeast-1
  • ap-southeast-2
  • ca-central-1
  • eu-central-1
  • eu-north-1
  • eu-west-1
  • eu-west-2
  • eu-west-3
  • sa-east-1
  • us-east-1
  • us-east-2
  • us-west-1
  • us-west-2

The following AWS Lambda runtime languages are supported. You can find the details for each, including runtime versions supported, on the language specific pages:

Instrumentation imposes some overhead on the Lambda function, especially during the execution environment initialization (AKA cold start). The function’s timeout and memory settings may need to be increased to avoid a cold start timeout.

Installation

The extensions are packaged as Lambda layers. Both the otelcol and instrumentation layers need to be added to your Lambda function and configured with environment variables.

Otelcol extension

This is provided as a layer specific to the Lambda function’s architecture, either x86_64 or arm64.

Add layer

The layer ARN is listed under SolarWinds Observability Summary Release Notes. Be sure to choose the AWS Region and architecture that correspond to your Lambda function.

An example of adding the arm64 otelcol 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:opentelemetry-collector-arm64-0_0_8:2' ...

Configure

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

Environment variable Description Requirement
OTEL_SERVICE_NAME

<your-service-name>

Telemetry from the Lambda function will be exported to this SWO Service. If unset, the Service name defaults to the Lambda function name.

Recommended
SW_APM_API_TOKEN <your-swo-api-token> Required
SW_APM_DATA_CENTER

<your-data-center>

Data centers and endpoint URIs – for example, na-01

Required
OPENTELEMETRY_EXTENSION_LOG_LEVEL

Set this to control the otelcol extension log level. This may be useful for diagnostic purposes or reduce logging to AWS CloudWatch.

Valid values are debug, info , warn (default), error , dpanic , panic, and fatal.

Optional

Configuration Reference

The otelcol extension is a custom distro based on OpenTelemetry, so it supports the configuration mechanisms described in the upstream repository and documentation. Note that our distro bundles a default YAML configuration file customized to work for SolarWinds Observability. Overriding it with a custom configuration file is not recommended for the typical use case.

Instrumentation extension

Once the otelcol extension is installed and configured, install the instrumentation extension corresponding to the runtime language of your Lambda function.