statful-middleware-express

2.0.4 • Public • Published

statful-middleware-express

A common pattern in expressjs/restify applications it to gather response times from all received requests, this middleware takes care of collecting common useful metrics automatically.

npm version Build Status

Installing

npm install --save statful-middleware-express statful-client
yarn add statful-middleware-express statful-client

Getting started

const express = require("express");
const Statful = require("statful-client");
const statfulMiddleware = require("statful-middleware-express");
 
const app = express();
const statful = new Statful({
  /* statful configuration */
});
 
app.use(statfulMiddleware(statful));
app.listen(3000);

Configuration

Most of the configuration is done directly in the statful instance. You can read more about the available options directly from the Statful repository.

Default Metrics

By default, the follow metrics are collected, with the corresponding tags:

  • response_time
    • hostname
    • method: GET, POST, PUT ...
    • statusCode: 200, 400, 404 ...
    • statusCodeCategory
      • informational
      • success
      • redirection
      • client_error
      • server_error
    • route: Either the route handler's name, the route path or unknown_route. e.g.: /users/:id?

Authors

Mindera - Software Craft

License

statful-middleware-express is available under the MIT license. See the LICENSE file for more information.

Readme

Keywords

none

Package Sidebar

Install

npm i statful-middleware-express

Weekly Downloads

1

Version

2.0.4

License

MIT

Unpacked Size

8.17 kB

Total Files

12

Last publish

Collaborators

  • jose.tavares
  • miguelcnf
  • couto
  • yconoclast
  • jorgecosta