Socket
Book a DemoInstallSign in
Socket

serverless-plugin-metric

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

serverless-plugin-metric

Simplified way to create AWSL:Logs:MetricFilter resources using custom pattern-filter

latest
Source
npmnpm
Version
1.2.3
Version published
Weekly downloads
1.1K
0.64%
Maintainers
1
Weekly downloads
 
Created
Source

Serverless Plugin Metric

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

Requirements

  • Node: >= 4.6.1
  • Serverless: >= 1.24.1 (older versions not tested)

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: '<serviceName>/<stageName>')
 * @property {string} [value]           The value to apply to each occurence. (default: 1)
 */

Keywords

aws

FAQs

Package last updated on 31 Aug 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts