Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions lib/cluster.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const requests = new Map(); // Pending requests for workers' local metrics.
class AggregatorRegistry extends Registry {
constructor(regContentType = Registry.PROMETHEUS_CONTENT_TYPE) {
super(regContentType);
addListeners();
addListeners(regContentType);
}

/**
Expand Down Expand Up @@ -131,9 +131,10 @@ class AggregatorRegistry extends Registry {
/**
* Adds event listeners for cluster aggregation. Idempotent (safe to call more
* than once).
* @param {string} registryType content type of the aggregated registry.
* @returns {void}
*/
function addListeners() {
function addListeners(registryType) {
if (listenersAdded) return;
listenersAdded = true;

Expand All @@ -159,7 +160,7 @@ function addListeners() {
// finalize
clearTimeout(request.errorTimeout);

const registry = Registry.aggregate(request.responses);
const registry = Registry.aggregate(request.responses, registryType);
const promString = registry.metrics();
request.done(undefined, promString);
}
Expand Down