0

I want to use cluster module in my node application. I am also using Prometheus in my application.

In the documentation, I read that with the cluster module a new process is spawned. Will it also create a new instance of cached node modules? Basically, I want to use the same registry of Prometheus so the scraper can get the data across all processes.

If a new object of the module(node module) will be created for the child process, how can I aggregate the metrics across all the processes and scrape that aggregated metric?

Akshit Bansal
  • 75
  • 1
  • 7
  • For each cluster worker a separate node.js process is spawned and has its own heap memory and therefore a new object instance is created. – Marc Nov 15 '22 at 18:37
  • So in this case, when prom scrapes it will get metrics from one process only, and not whole metrics, right? – Akshit Bansal Nov 16 '22 at 07:34
  • Dont know, never worked with Prometheus. But thats how it is when you use the cluster module. Why dont you try it out with a simple test? Create a simple demo app with fake data. Why do you think you need a singleton instance? – Marc Nov 16 '22 at 09:53

0 Answers0