express-prom-bundle
Advanced tools
Comparing version 4.2.0 to 4.2.1
{ | ||
"name": "express-prom-bundle", | ||
"version": "4.2.0", | ||
"version": "4.2.1", | ||
"description": "express middleware with popular prometheus metrics in one bundle", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -43,24 +43,2 @@ [![build status](https://travis-ci.org/jochen-schweizer/express-prom-bundle.png)](https://travis-ci.org/jochen-schweizer/express-prom-bundle) [![Coverage Status](https://coveralls.io/repos/github/jochen-schweizer/express-prom-bundle/badge.svg?branch=master)](https://coveralls.io/github/jochen-schweizer/express-prom-bundle?branch=master) [![license](https://img.shields.io/github/license/mashape/apistatus.svg?maxAge=2592000)](https://www.tldrlegal.com/l/mit) [![NPM version](https://badge.fury.io/js/express-prom-bundle.png)](http://badge.fury.io/js/express-prom-bundle) | ||
## Usage with Node Cluster | ||
``` javascript | ||
if (cluster.isMaster) { | ||
const numCPUs = Math.max(2, os.cpus().length); | ||
const workers: cluster.Worker[] = []; | ||
for (let i=1; i < numCPUs; i++) { | ||
const worker = forkWorker(); | ||
workers.push(worker); | ||
} | ||
const metricsApp = express(); | ||
metricsApp.use('/cluster_metrics', promBundle.clusterMetrics()); | ||
metricsApp.listen(9999); | ||
console.log('metrics listening on 9999'); // call localhost:9999/cluster_metrics for aggregated metrics | ||
} else { | ||
const app = express(); | ||
app.use(promBundle({includeMethod: true}); | ||
app.use('/api', require('./api')); | ||
app.listen(3000); | ||
} | ||
``` | ||
The code the master process runs will expose an API with a single endpoint `/cluster_metrics` which returns an aggregate of all metrics from all the workers. | ||
## Options | ||
@@ -67,0 +45,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
17816
250