Measured Node Metrics
Various metrics generators and http framework middlewares that can be used with a self reporting metrics registry to easily instrument metrics for a node app.
Install
npm install measured-node-metrics
What is in this package
Measured Node Metrics Module
See the docs for the main module to see the exported helper functions and maps of metric generators for various system and os metrics.
Example usage
const express = ;const createProcessMetrics createOSMetrics createExpressMiddleware = ; const registry = ; // Create and register default OS metrics;// Create and register default process metrics;// Use the express middlewareconst app = ;app; // Implement the rest of app
You can also create your own middleware if your not using express, (please contribute it)
const onRequestStart onRequestEnd = ; /** * Creates an Express middleware that reports a timer on request data. * With this middleware you will get requests counts and latency percentiles all filterable by status codes, http method, and uri paths. * * @param * @param * @return */ { return { const stopwatch = ; req; ; }; }