From e6f7bd8ed427c95152d7389e431fec1aa639d817 Mon Sep 17 00:00:00 2001 From: Prashant D Date: Fri, 1 Jul 2022 15:19:14 +1000 Subject: [PATCH] Revert "pacific: mgr, mgr/prometheus: Fix regression with prometheus metrics" This reverts pacific commit f07e47ae405218dbe4029ed9c82559d0cf1667a5 Reason: The pacific commit 98760e36c7bbbb48657e4d033bcbb080a56bbf7b has added a new MMgrUpdate message which incorrectly handled service_daemon. Reverting PR#46429 as a result of revert of PR#46427. More details in https://tracker.ceph.com/issues/55322 Signed-off-by: Prashant D --- src/mgr/ActivePyModules.cc | 1 - src/pybind/mgr/prometheus/module.py | 15 ++++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/mgr/ActivePyModules.cc b/src/mgr/ActivePyModules.cc index e62e93b309066..f40e67016f7ac 100644 --- a/src/mgr/ActivePyModules.cc +++ b/src/mgr/ActivePyModules.cc @@ -91,7 +91,6 @@ void ActivePyModules::dump_server(const std::string &hostname, f->open_object_section("service"); f->dump_string("type", key.type); f->dump_string("id", key.name); - f->dump_string("ceph_version", ceph_version); if (!id.empty()) { f->dump_string("name", id); } diff --git a/src/pybind/mgr/prometheus/module.py b/src/pybind/mgr/prometheus/module.py index 6516dc352516a..7890b5eec9279 100644 --- a/src/pybind/mgr/prometheus/module.py +++ b/src/pybind/mgr/prometheus/module.py @@ -971,11 +971,11 @@ class Module(MgrModule): for mon in mon_status['monmap']['mons']: rank = mon['rank'] id_ = mon['name'] - mon_version = servers.get((id_, 'mon'), ('', '', '')) + host_version = servers.get((id_, 'mon'), ('', '', '')) self.metrics['mon_metadata'].set(1, ( - 'mon.{}'.format(id_), mon_version[0], + 'mon.{}'.format(id_), host_version[0], mon['public_addr'].rsplit(':', 1)[0], rank, - mon_version[1] + host_version[1] )) in_quorum = int(rank in mon_status['quorum']) self.metrics['mon_quorum_status'].set(in_quorum, ( @@ -1058,9 +1058,10 @@ class Module(MgrModule): def get_service_list(self) -> Dict[Tuple[str, str], Tuple[str, str, str]]: ret = {} for server in self.list_servers(): + version = cast(str, server.get('ceph_version', '')) host = cast(str, server.get('hostname', '')) for service in cast(List[ServiceInfoT], server.get('services', [])): - ret.update({(service['id'], service['type']): (host, service['ceph_version'], service.get('name', ''))}) + ret.update({(service['id'], service['type']): (host, version, service.get('name', ''))}) return ret @profile_method() @@ -1098,7 +1099,7 @@ class Module(MgrModule): "skipping output".format(id_)) continue - osd_version = servers.get((str(id_), 'osd'), ('', '', '')) + host_version = servers.get((str(id_), 'osd'), ('', '', '')) # collect disk occupation metadata osd_metadata = self.get_metadata("osd", str(id_)) @@ -1115,10 +1116,10 @@ class Module(MgrModule): c_addr, dev_class, f_iface, - osd_version[0], + host_version[0], obj_store, p_addr, - osd_version[1] + host_version[1] )) # collect osd status -- 2.39.5