From 7b6b349363535efde4b5dc32f14abbbb1267a19d Mon Sep 17 00:00:00 2001 From: "Joey@macstudio" Date: Mon, 13 Jul 2026 07:53:19 +0800 Subject: [PATCH] docs: clarify cluster listener initialization Signed-off-by: Joey@macstudio --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 98f34e65..dda12b75 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,11 @@ will only reveal that individual worker's metrics, which is generally undesirable. To solve this, you can aggregate all of the workers' metrics in the master process. See `example/cluster.js` for an example. +Instantiate `ClusterRegistry` before branching on `cluster.isPrimary`, as shown +in the example. Its constructor installs the appropriate IPC listener in each +process; if only the primary creates it, workers cannot answer aggregation +requests and `clusterMetrics()` times out. + Default metrics use sensible aggregation methods. (Note, however, that the event loop lag mean and percentiles are averaged, which is not perfectly accurate.) Custom metrics are summed across workers by default. To use a different