New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

statful-middleware-koa

Package Overview
Dependencies
Maintainers
6
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

statful-middleware-koa

Koa middleware to automatically register Statful metrics.

latest
Source
npmnpm
Version
1.0.3
Version published
Weekly downloads
15
1400%
Maintainers
6
Weekly downloads
 
Created
Source

statful-middleware-koa

A common pattern in koa 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-koa statful-client
yarn add statful-middleware-koa statful-client

Getting started

const Koa = require("koa");
const app = new Koa();
const Statful = require("statful-client");
const statfulMiddleware = require("statful-middleware-koa");

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-koa is available under the MIT license. See the LICENSE file for more information.

FAQs

Package last updated on 19 Jul 2019

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