pm2-prom-module-client
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

Client for PM2-Prom-Module npm version

This client facilitates communication among all your concurrently running nodejs applications in PM2 with PM2-Prom-Module. It transmits all of prom-client metrics, enhancing the monitoring and performance analysis of your applications.

Install

npm install pm2-prom-module-client

How to use

To establish communication between pm2-prom-module and your application, import the initMetrics function and provide your Registry as an argument.

Have a look on example:

import client from 'prom-client';
import { initMetrics } from 'pm2-prom-module-client';

const registry = new client.Registry();
const PREFIX = `nodejs_app_`;

const metricRequestCounter = new client.Counter({
    name: `${PREFIX}request_counter`,
    help: 'Show total request count',
    registers: [registry],
});

// Register your prom-client Registry
initMetrics(registry);

// ...
app.get('/*', async (req: AppFastifyRequest, res) => {
    // ...
    metricRequestCounter?.inc();
    // ...
});

Do not forget to install pm2-prom-module to your PM2.

Package Sidebar

Install

npm i pm2-prom-module-client

Weekly Downloads

15

Version

1.0.3

License

ISC

Unpacked Size

4.43 kB

Total Files

4

Last publish

Collaborators

  • vexell