n-cloudwatch-metrics
A small library to send metrics to cloudwatch from your AWS lambdas, extracted from n-lambda
Usage
You will need to set up an environmental variable called AWS_REGION
with the correct region for your app (e.g. eu-west-1
) and an environmental variable called AWS_LAMBDA_FUNCTION_NAME
.
Requiring the module will return an instance of the cloudwatch client.
const metrics = ;
You can then call the count
method on this instance with the name of the metric as the first argument. There is a second optional argument that lets you specify what the number to add to the count is. It defaults to 1.
metrics;metrics;