# serverless-metrics

> ### Get KPIs for API Gateway + Lambda

Latest version **0.0.2** (published 2017-02-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install serverless-metrics
pnpm add serverless-metrics
yarn add serverless-metrics
bun add serverless-metrics
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.2 |
| Published | 2017-02-24 |
| First published | 2016-10-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | Rotem Tamir |
| Maintainers | rotemtam |
| Keywords | aws-lambda, api-gateway, node.js, es6, metrics |

## Links

- npm: https://www.npmjs.com/package/serverless-metrics
- Repository: https://github.com/rotemtam/serverless-metrics
- Homepage: https://github.com/rotemtam/serverless-metrics#readme
- Issues: https://github.com/rotemtam/serverless-metrics/issues
- npm.io page: https://npm.io/package/serverless-metrics

## Dependencies (4)

- [co](https://npm.io/package/co.md) ^4.6.0
- [moment](https://npm.io/package/moment.md) ^2.15.0
- [aws-sdk](https://npm.io/package/aws-sdk.md) ^2.6.3
- [bluebird](https://npm.io/package/bluebird.md) ^3.4.6

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 0.0.2 (latest) — 2017-02-24
- 0.0.1 — 2016-10-03

## README

## Serverless Metrics (WIP)

### Get KPIs for API Gateway + Lambda

__Why__ - AWS API Gateway + Lambda is a great stack for developing serverless
apps.  Currently, trying to get a good overview of whats going on with your
service is very difficult.

This project's goal is to let you easily get key metrics about your serverless
service, for each resource + method of your gateway:

* Calls to API Gateway
* Errors returned by API Gateway
* Lambda Invocations
* Lambda Errors
* Lambda Throttles

### Installation

```js
npm i --save serverless-metrics
```

Usage

```js
const ServerlessMetrics = require('serverless-metrics')
const HOURS_TO_GET = 5 // default 24
ServerlessMetrics.getGatewayMetrics('gateway_id', 'stage_name', HOURS_TO_GET)
  .then(function(data) {
    console.log(data)
  })
  .catch(console.error)
/* Returns
{
  "data": {
  "/path": {
    "get": {
      "4XXError": 0,
      "5xxError": 0,
      "Count": 0,
      "LambdaErrors": 0,
      "LambdaInvocations": 0,
      "LambdaThrottles": 0,
    }
  },
  "/other_path": {
    "post": {
      "4XXError": 0,
      "5xxError": 0,
      "Count": 0,
      "LambdaErrors": 0,
      "LambdaInvocations": 0,
      "LambdaThrottles": 0,
    }
  }  
  },
  "time": {
    "start": "2016-09-19T03:43:35Z",
    "end": "2016-09-19T08:43:35Z"
  }
}

}
*/

```

### License

MIT

---
_Source: https://npm.io/package/serverless-metrics · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
