Skip to content

Module to collect PM2 metrics from all you running apps

Notifications You must be signed in to change notification settings

VeXell/pm2-prom-module-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Module to collect PM2 metrics from all you running apps

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published