2.1.0 • Published 2 years ago

pm2-cluster-prom v2.1.0

Weekly downloads
421
License
MIT
Repository
github
Last release
2 years ago

pm2-cluster-prom

Prometheus metrics aggregation for PM2's clustered mode.

Returns an aggregation of the default prom-client registry from all PM2 processes when running in clustered mode, otherwise, returns the current proc's metrics.

$ npm install --save pm2-cluster-prom

Usage

ES6

import { getAggregateMetrics } from 'pm2-cluster-prom';

const metrics = await getAggregateMetrics();

Vanilla

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.

import { timeSyncRun } from 'pm2-cluster-prom';

const timeout = 15e3;
timeSyncRun(timeout, () => client.collectDefaultMetrics({ timeout }));

// TODO: stuff

  • Other-than-default registry
  • Better exception handling
2.1.0

2 years ago

2.0.0

4 years ago

1.0.8

4 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago