From 2b89b6d0e95b25e9910d4bfd6dea5438cabda032 Mon Sep 17 00:00:00 2001 From: Pablo Romeo Date: Wed, 22 Apr 2020 17:20:09 -0300 Subject: [PATCH] Remove worker id from metric labels --- orchestrator/metrics.js | 8 ++++---- orchestrator/orchestrator.js | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/orchestrator/metrics.js b/orchestrator/metrics.js index d31e19d..ca534a2 100644 --- a/orchestrator/metrics.js +++ b/orchestrator/metrics.js @@ -40,13 +40,13 @@ const gaugeWorkers = new client.Gauge({ const workerLoadCPUStats = new client.Gauge({ name : 'worker_load_cpu', help : 'Worker Load - CPU usage', - labelNames: ['worker_id', 'worker_name'], + labelNames: ['worker_name'], }) const workerLoadTasksStats = new client.Gauge({ name : 'worker_load_tasks', help : 'Worker Load - Tasks Count', - labelNames: ['worker_id', 'worker_name'], + labelNames: ['worker_name'], }) module.exports = { @@ -58,8 +58,8 @@ module.exports = { setActiveWorkers : (amount) => { gaugeWorkers.set(amount) }, setActiveJobPosters : (amount) => { gaugeJobPosters.set(amount) }, - setWorkerLoadCPU : (workerId, workerName, value) => { workerLoadCPUStats.labels(workerId, workerName).set(value) }, - setWorkerLoadTasks : (workerId, workerName, value) => { workerLoadTasksStats.labels(workerId, workerName).set(value) }, + setWorkerLoadCPU : (workerName, value) => { workerLoadCPUStats.labels(workerName).set(value) }, + setWorkerLoadTasks : (workerName, value) => { workerLoadTasksStats.labels(workerName).set(value) }, injectMetricsRoute : (app) => { app.get('/metrics', (req, res) => { diff --git a/orchestrator/orchestrator.js b/orchestrator/orchestrator.js index a638341..7e3d58a 100644 --- a/orchestrator/orchestrator.js +++ b/orchestrator/orchestrator.js @@ -40,8 +40,8 @@ class Worker { updateStats(stats) { this.stats = { cpu : parseFloat(stats.cpu), tasks: parseInt(stats.tasks)} - metrics.setWorkerLoadCPU(this.id, this.host, this.stats.cpu) - metrics.setWorkerLoadTasks(this.id, this.host, this.stats.tasks) + metrics.setWorkerLoadCPU(this.host, this.stats.cpu) + metrics.setWorkerLoadTasks(this.host, this.stats.tasks) } }