From 3b450065679e27617f7c012392c1c97e68605760 Mon Sep 17 00:00:00 2001 From: Matthew Macdonald-Wallace Date: Thu, 22 Jul 2021 14:58:22 +0100 Subject: [PATCH] Move common labels into dedicated const --- server/model/monitor.js | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/server/model/monitor.js b/server/model/monitor.js index c2551d189..ca994d7e2 100644 --- a/server/model/monitor.js +++ b/server/model/monitor.js @@ -10,27 +10,23 @@ const {R} = require("redbean-node"); const {BeanModel} = require("redbean-node/dist/bean-model"); const {Notification} = require("../notification") +const commonLabels = [ + 'monitor_name', + 'monitor_type', + 'monitor_url', + 'monitor_hostname', + 'monitor_port', +] + const monitor_response_time = new Prometheus.Gauge({ name: 'monitor_response_time', help: 'Monitor Response Time (ms)', - labelNames: [ - 'monitor_name', - 'monitor_type', - 'monitor_url', - 'monitor_hostname', - 'monitor_port' - ] + labelNames: commonLabels }); const monitor_status = new Prometheus.Gauge({ name: 'monitor_status', help: 'Monitor Status (1 = UP, 0= DOWN)', - labelNames: [ - 'monitor_name', - 'monitor_type', - 'monitor_url', - 'monitor_hostname', - 'monitor_port' - ] + labelNames: commonLabels }); /** * status: