AWS Lambda instrumentation for Node.js
To reduce overhead during cold start, only Lambda and AWS SDK instrumentation are enabled by default. Additional instrumentation can be enabled by configuration as described here.
Compatibility
The supported runtime versions are Node.js 16, 18, and 20.
Only CommonJs module handlers are supported for now. ES module handler support is coming soon.
Most of the Node.js 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 Node.js 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-js-14_0_2: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 SaaS Service. If unset, the Transaction name defaults to the Lambda function name. |
Recommended |
SW_APM_LOG_LEVEL
|
This may be useful for diagnostic purposes or for reducing logging to AWS CloudWatch. |
Optional |
The other standard Node.js Library configuration options that are supported in the AWS Lambda environment are listed below.
enabled
tracingMode
insertTraceContextIntoLogs
insertTraceContextIntoQueries
transactionSettings
instrumentations