chrislahaye / pm2-messages Goto Github PK
View Code? Open in Web Editor NEWLibrary to retrieve messages within a PM2 cluster
Library to retrieve messages within a PM2 cluster
Not a pm2-messages issue, but significant enough to mention here. pm2-messages is vulnerable to pm2 bug 4627.
We've had to disable pm2-messages because pm2 keeps crashing/restarting when being scraped by multiple prometheus servers.
@ChrisLahaye I'd would love to know your thoughts on this issue or if you have ideas for a solution.
@ChrisLahaye hello again. For a little context, your pm2-messages is being used in CoStar Group's flagship product CoStar Suite.
We ended up having to disable prometheus scraping in production because of a memory leak.
This leak was traced back to pm2-messages. The leak is of an object containing pendingBusTargets, resolverBusTargets, and messages as you can see in this screenshot. A thorough memory analysis was performed to discover and confirm these findings.
A thorough analysis of the code confirmed that the leak is of the myBus Listener (myBus.on).
The following PR suggests a remedy by allowing the bus listeners to be destroyed after use.
#8
The project hasn't been updated in a while, is it possible to update dependencies to cover the vulnerabilities of the older dependency versions?
This appears to me like the best solution I've encountered so far for gathering prom-metrics from a clustered app in pm2. Unfortunately I can't get it to work. Could additional documentation/examples please be provided?
I run the following code against 4 clustered instances of an app hosted in pm2 4.4.0
import pm2mes from "pm2-messages";
import * as prom from "prom-client";
prom.collectDefaultMetrics();
pm2mes.onMessage("get_prom_register", () => prom.register.getMetricsAsJSON());
const foo = async (callback) => {
const metricsArr = await pm2mes.getMessages("get_prom_register");
console.log(metricsArr);
callback(prom.AggregatorRegistry.aggregate(metricsArr).metrics());
};
foo((o) => console.log(o));
the result is ....
> [email protected] start /work/csgp/pm2-prom-client
> node ./dist/index.js
[]
Any hints as to why metricsArr is empty?
Regards
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.