@serverless/aws-lambda-sdk
AWS Lambda dedicated tracing utility
Instruments AWS Lambda functions and propagates traces to the Serverless Console
Setup
2. Instrument functions with the SDK in one of the following ways:
(A) Attach internal extension layer
Resolve Layer ARN with following steps
- Attach layer to the function
- Configure following environment variables for the function environment:
SLS_ORG_ID: (id of your organization in Serverless Console)
AWS_LAMBDA_EXEC_WRAPPER: /opt/sls-sdk-node/exec-wrapper.sh
(B) Instrument function manually
CJS:
const instrument = require('@serverless/aws-lambda-sdk/instrument');
module.exports.handler = instrument(
(event, context, callback) => { },
{
orgId: <orgId>
}
);
ESM:
import instrument from '@serverless/aws-lambda-sdk/instrument';
export const handler = instrument(
(event, context, callback) => { },
{
orgId: <orgId>
}
);
Outcome
SDK automatically creates the trace that covers internal process of function invocation and initialization.
For all the details check docs/sdk-trace.md