1.0.2 • Published 7 years ago

n-cloudwatch-metrics v1.0.2

Weekly downloads
1
License
MIT
Repository
github
Last release
7 years ago

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 = require('n-cloudwatch-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.count('nameOfMetric');
metrics.count('tenOfTheseThingsHappened', 10);