From c18df50a7c8c0935f6b5a7aea8b43357642b6b5b Mon Sep 17 00:00:00 2001 From: Mike Lang Date: Wed, 11 Nov 2020 09:12:26 -0600 Subject: [PATCH] monitoring: only request for services matching role --- monitoring/prometheus.jsonnet | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/monitoring/prometheus.jsonnet b/monitoring/prometheus.jsonnet index 455c6c7..325e10f 100644 --- a/monitoring/prometheus.jsonnet +++ b/monitoring/prometheus.jsonnet @@ -7,15 +7,18 @@ local hosts_by_scheme = { https: { }, }; -local services = [ - "restreamer", - "downloader", - "backfiller", - "cutter", - "thrimshim", - "sheetsync", - "segment_coverage", -]; +local services_by_role = { + replica: [ + "restreamer", + "downloader", + "backfiller", + "segment_coverage", + ], + local_edit: self.replica + ["thrimshim"], + edit: self.local_edit + ["cutter"], + leader: self.edit + ["sheetsync", "playlist_manager"], +}; +local services = services_by_role.leader; { global: { @@ -49,6 +52,7 @@ local services = [ service: service, }, } for host in std.objectFields(hosts) + if std.count(services_by_role[hosts[host][1]], service) > 0 ], } for service in services