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 SaaS 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.
Only the Otelcol extension is required for a Go Lambda function, Instrumentation is provided by the SolarWinds Observability SaaS Go Library that should be compiled into the function executable as a dependency.
-
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 SaaS.
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. The otelcol layer needs be added to your Lambda function and configured with environment variables in order to export telemetry to SolarWinds Observability SaaS. For a function where we provide an instrumentation extension, the layer should be added and configured to automatically collect telemetry. For a function implemented in Go, the AWS Lambda instrumentation SDK provided by the SolarWinds Observability SaaS Go Library should be used.
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 |
Optional |
HTTPS_PROXY
|
If your Lambda function runs in a VPC which restricts outbound connections, this setting can be used to configure otelcol extension's connections to go through an HTTP proxy. The proxy needs to forward TLS connections to the SolarWinds Observability endpoints for APM collector and OTel collector. Example for a proxy that requires Basic Authentication: |
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 SaaS. Overriding it with a custom configuration file is not recommended for the typical use case.
Instrumentation extension or SDK
Once the otelcol extension is installed and configured, install the instrumentation extension or use the SDK corresponding to the runtime language of your Lambda function.