mirror of
https://github.com/BreizhHardware/express-prom-bundle.git
synced 2026-03-18 21:30:38 +01:00
Merge pull request #97 from diegoximenes/fix/cluster_example
Fix cluster example
This commit is contained in:
@@ -199,7 +199,8 @@ which returns an aggregate of all metrics from all the workers.
|
|||||||
|
|
||||||
``` javascript
|
``` javascript
|
||||||
const cluster = require('cluster');
|
const cluster = require('cluster');
|
||||||
const promBundle = require('./src/index');
|
const promBundle = require('express-prom-bundle');
|
||||||
|
const promClient = require('prom-client');
|
||||||
const numCPUs = Math.max(2, require('os').cpus().length);
|
const numCPUs = Math.max(2, require('os').cpus().length);
|
||||||
const express = require('express');
|
const express = require('express');
|
||||||
|
|
||||||
@@ -215,6 +216,7 @@ if (cluster.isMaster) {
|
|||||||
console.log('cluster metrics listening on 9999');
|
console.log('cluster metrics listening on 9999');
|
||||||
console.log('call localhost:9999/metrics for aggregated metrics');
|
console.log('call localhost:9999/metrics for aggregated metrics');
|
||||||
} else {
|
} else {
|
||||||
|
new promClient.AggregatorRegistry();
|
||||||
const app = express();
|
const app = express();
|
||||||
app.use(promBundle({
|
app.use(promBundle({
|
||||||
autoregister: false, // disable /metrics for single workers
|
autoregister: false, // disable /metrics for single workers
|
||||||
|
|||||||
Reference in New Issue
Block a user