AWS Lambda instrumentation for Ruby
Compatibility
The supported runtime versions are Ruby 3.2 and 3.3.
Most of the Ruby Library features are supported in the AWS Lambda environment. The exceptions are:
- Custom transaction naming via the SDK
- Trigger trace
Net::HTTP instrumentation is disabled by default since it would collect extra spans for internal RPC calls made by the Lambda runtime. To explicitly enable Net::HTTP instrumentation, set the environment variable OTEL_RUBY_INSTRUMENTATION_NET_HTTP_ENABLED=true
.
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 and architecture that correspond to your Lambda function.
An example of adding the arm64 Ruby 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-ruby-arm64-6_1_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
|
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 Service. If unset, the Transaction name defaults to the Lambda function name. |
Recommended |
SW_APM_DEBUG_LEVEL
|
This may be useful for diagnostic purposes or for reducing logging to AWS CloudWatch. |
Optional |
SW_APM_LAMBDA_PRELOAD_DEPS
|
The extension attempts to parse the Lambda function code and preload its dependencies in order to instrument them. Setting the value to false or FALSE disables this behavior and should only be done for diagnostic purposes.
|
Optional |
The other standard Ruby Library configuration options that are supported in the AWS Lambda environment are listed below.