diff --git a/src/util/prometheus.js b/src/util/prometheus.js index 60b0e922b1..03db05c462 100644 --- a/src/util/prometheus.js +++ b/src/util/prometheus.js @@ -1,12 +1,17 @@ const prometheusClient = require('prom-client'); const logger = require('../logger'); const { MetricsAggregator } = require('./metricsAggregator'); +const cluster = require('cluster'); const clusterEnabled = process.env.CLUSTER_ENABLED !== 'false'; const useMetricsAggregator = process.env.USE_METRICS_AGGREGATOR === 'true'; const instanceID = process.env.INSTANCE_ID || 'localhost'; const prefix = 'transformer'; -const defaultLabels = { instanceName: instanceID }; +const defaultLabels = { + instanceName: instanceID, + isMaster: cluster.isPrimary, + workerId: cluster.worker ? cluster.worker.id : 0, +}; function appendPrefix(name) { return `${prefix}_${name}`;