Serverless Plugin Metric

homepage icon https://github.com/alex20465/serverless-plugin-metric
Follow @alex20465

Tracked

NPM Downloads Last Month
27
Issues
1
Stars
7
Forks
3
Watchers
7
Watch Star Fork Issue Download License NPM Build Status Coverage Status Contributors

Repo README Contents:

Serverless Plugin Metric

A serverless plugin to automatically create AWS:Logs:MetricFilter resources.

Requirements

Installation

NPM:

npm install serverless-plugin-metric --save-dev

Add the plugin to serverless.yml

plugins:
  - serverless-plugin-metric

setup metrics:

custom:
  metrics: # Array<MetricOption>
    - name: foo
      pattern: "{ $.statusCode != 200 }"

Info: In order to display the metric on CloudWatch it is necessary to receive data.

Metric option type-definitions:

/** 
 * @typedef {object} MetricOption
 * @property {string} name              The name of the metric
 * @property {string} pattern           Filter patter doc (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/FilterAndPatternSyntax.html)
 * @property {string[]} [functions]     Default: ALL
 * @property {string} [namespace]       Override dynamic generated namespace (default: CustomMetrics/<serviceName>)
 */