npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

serverless-plugin-cloudwatch

v0.1.12

Published

Generate CloudWatch Dashboard including widgets with configured metrics

Downloads

2

Readme

serverless-plugin-cloudwatch

Serverless plugin for setting up AWS CloudWatch dashboards with widgets (only from type 'metric') for configured metrics.

v0.1.10: it's still in development, not ready to use right now :)

Installation

Install via npm in the root of your Serverless service:

npm install serverless-plugin-cloudwatch

Add the plugin to the plugins array of your Serverless service in serverless.yml:

plugins:
  - serverless-plugin-cloudwatch

Usage

There will be only one dashboard per deployment stage. A dashboard is a customizable home page in the CloudWatch console that you can use to monitor your AWS resources in a single view. That's why there will be only one dashboard per deployment.

Following AWS Services are currently supported:

  • AWS Lambda
  • AWS DynamoDB

(AWS S3 and AWS ApiGateway follows soon)

Configuration of the dashboard

The plugin can be configured by adding a property called dashboard to the custom properties of the Serverless service.

Lambda

This is the minimum required configuration:

dashboard:
  lambda:
    enabled: true

Default configuration It will be used, if you only include the minimum required configuration. The default configuration looks like this:

dashboard:
  lambda:
    widgets:
      - name: 'sum of function invocations'
        metrics: 
          - name: 'Invocations'
            stat: 'Sum'
      - name: 'number of invocations that result in a function error',
        metrics: 
          - name: 'Erorrs'
            stat: 'Sum'
    enabled: true

With the default configuration the following widgets will be added to the cloudwatch dashboard:

  • one widget with the title 'Sum of Invocations' and one metric 'Invocations'.
  • one widget with the title 'Sum of Errors' and one metric 'Errors' The metrics in a widget will be shown for each of your lambda functions (if lambda dashboards are enabled globally).
You can configure by your own:
  • the number of widgets by adding a widget to the array
  • the title (name) of the widget
  • which metrics (name) should be included in each widget
  • which statistic (stat) should be used for each metric

To gain maximum control over which functions to be included, you can disable lambda dashboards globally,

dashboard:
  lambda:
    enabled: false

and enable it only for specific functions, by setting the dashboard flag for those functions to true:

functions:
    myFunction:
      handler: some_handler
      dashboard: true

DynamoDB

This is the minimum required configuration:

dashboard:
  dynamoDB:
    enabled: true

Default configuration It will be used, if you only include the minimum required configuration. The default configuration looks like this:

dashboard:
  dynamoDB:
    widgets:
      - name: 'sum of system- and user errors'
        metrics: 
          - name: 'SystemErrors'
            stat: 'Sum'
            dimension: 'TableName'
          - name: 'UserErrors'
            stat: 'Sum'
            dimension: 'TableName'
      - name: 'average time of successful requests',
        metrics: 
          - name: 'SuccessfulRequestLatency'
            stat: 'Average'
            dimension: 'TableName'
    enabled: true

With the default configuration the following widgets will be added to the cloudwatch dashboard:

  • one widget with the title 'System- and UserErrors' and two metrics 'SystemErrors' and 'UserErrors'.
  • one widget with the title 'Successful requests' and one metric 'SuccessfulRequestLatency'

The metrics in those widget will be shown for each of your dynamoDB tables.

You can configure by your own:
  • the number of widgets by adding a widget to the array
  • the title (name) of the widget
  • which metrics (name) should be included in each widget
  • which statistic (stat) should be used for each metric
  • which dimension (dimension) should be used for each metric (GlobalSecondaryIndexName | Operation | ReceivingRegion | StreamLabel | TableName). See AWS DynamoDB Metrics and Dimensions

S3

This is the minimum required configuration:

dashboard:
  s3:
    enabled: true

Default configuration It will be used, if you only include the minimum required configuration. The default configuration looks like this:

dashboard:
  s3:
    widgets:
      - name: 'daily storage metrics for buckets'
        metrics: 
          - name: 'BucketSizeBytes'
            stat: 'Average'
            dimension: 'BucketName'
          - name: 'UserErrors'
            stat: 'Average'
            dimension: 'BucketName'
      - name: 'total request latency',
        metrics: 
          - name: 'TotalRequestLatency'
            stat: 'Average'
            dimension: 'BucketName'
    enabled: true

ApiGateway

This is the minimum required configuration:

dashboard:
  apiGateway:
    enabled: true

Default configuration It will be used, if you only include the minimum required configuration. The default configuration looks like this:

dashboard:
  apiGateway:
    widgets:
      - name: 'system- and user errors'
        metrics: 
          - name: '5xxErrors'
            stat: 'Sum'
          - name: '4xxErrors'
            stat: 'Sum'
      - name: 'total number of API requests',
        metrics: 
          - name: 'Count'
            stat: 'SampleCount'
    enabled: true

License

This software is released under the MIT license. See the license file for more details.