AWS Lambda
Instrument your AWS Lambda using Aspecto
Aspecto supports instrumenting AWS Lambdas. There are 2 possible ways to do so:
Option 1: Aspecto Wrapper File (recommended)
In your lambda src folder, create a file to initialize aspecto, such as aspecto-wrapper.js
:
In your Lambda function configuration, add or update the NODE_OPTIONS
environment variable to require the wrapper, e.g.:
NODE_OPTIONS=--require aspecto-wrapper
Option 2: Wrap Lambda handler with function
To do so, set up Aspecto as you'd usually do, and extract the returned lambda
utility:
Next, wrap your function handler definition with the returned utility.
Example:
Note: if your lambda is not deployed with a package.json
file, make sure to provide the serviceName
option when initializing Aspecto.
Last updated