redo-monolith

`statsd` client wrapper and `express` middleware

Showing:

Popularity

Downloads/wk

2

GitHub Stars

4

Maintenance

Last Commit

4yrs ago

Contributors

1

Package

Dependencies

2

Size (min+gzip)

4.8KB

License

ISC

Type Definitions

Tree-Shakeable

No?

Categories

Readme

Monolith

Express middleware for your log-to-statsd needs.

Installation

npm install --save redo-monolith

Usage

var monolith = require('redo-monolith');
var statsd = monolith({
  host: '127.0.0.1',
  port: 8125,
  queueHeader: 'X-Request-Start'
});

As an express middleware

var express = require('express');
var app = express();

function sendFn(params) {
  /**
   *  `params` is an object with the following attributes for logging what you want about the request:
   *  queueDuration: amount of time since the request has been enqueued by `nginx` until the request finishes
   *  requestDuration: amount of time since the request started to be processed by `express` until it finishes
   *  status: a `String` representation of the resulting HTTP status code
   *  req: an `express#Request` object
   *  res: an `express#Response` object
   *  client: a `lynx` instance
   */

  params.client.increment(params.status);
}

app.use(statsd.middleware({ send: sendFn }))

As a standalone statsd client

statsd.client.increment('myMetric');

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100