Prometheus metrics aggregation for PM2's clustered mode.
npm install pm2-cluster-prombash
$ npm install --save pm2-cluster-prom
`
Usage
$3
`typescript
import { getAggregateMetrics } from 'pm2-cluster-prom';
const metrics = await getAggregateMetrics();
`
$3
`javascript
const clusterProm = require('pm2-cluster-prom');
clusterProm.getAggregateMetrics().then(metrics => {
console.log(metrics);
});
`
As a general tip, if you're running in clustered mode, it would be a good idea to start your metrics collection at similar cycles to avoid jitter.
`typescript
import { timeSyncRun } from 'pm2-cluster-prom';
const timeout = 15e3;
timeSyncRun(timeout, () => client.collectDefaultMetrics({ timeout }));
``