From e8a1e267af32858d830229440d25362a877ed563 Mon Sep 17 00:00:00 2001 From: Tiago Melo Date: Wed, 7 Mar 2018 15:39:27 +0000 Subject: [PATCH] mgr/dashboard_v2: add mgr to the list of perf counters Signed-off-by: Tiago Melo --- .../mgr/dashboard_v2/test_perf_counters.py | 19 ++++++++++++++++--- .../dashboard_v2/controllers/perf_counters.py | 1 + 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/qa/tasks/mgr/dashboard_v2/test_perf_counters.py b/qa/tasks/mgr/dashboard_v2/test_perf_counters.py index 6be867bd30eb8..6f38260303dcd 100644 --- a/qa/tasks/mgr/dashboard_v2/test_perf_counters.py +++ b/qa/tasks/mgr/dashboard_v2/test_perf_counters.py @@ -20,13 +20,14 @@ class PerfCountersControllerTest(DashboardTestCase): self.assertIn('osd.{}'.format(osd['osd']), data) @authenticate - def test_perf_counters_mon_a_get(self): - data = self._get('/api/perf_counters/mon/a') + def test_perf_counters_mon_get(self): + mon = self.mons()[0] + data = self._get('/api/perf_counters/mon/{}'.format(mon)) self.assertStatus(200) self.assertIsInstance(data, dict) self.assertEqual('mon', data['service']['type']) - self.assertEqual('a', data['service']['id']) + self.assertEqual(mon, data['service']['id']) self.assertIsInstance(data['counters'], list) self.assertGreater(len(data['counters']), 0) counter = data['counters'][0] @@ -35,3 +36,15 @@ class PerfCountersControllerTest(DashboardTestCase): self.assertIn('name', counter) self.assertIn('unit', counter) self.assertIn('value', counter) + + @authenticate + def test_perf_counters_mgr_get(self): + mgr = self.mgr_cluster.mgr_ids[0] + data = self._get('/api/perf_counters/mgr/{}'.format(mgr)) + self.assertStatus(200) + + self.assertIsInstance(data, dict) + self.assertEqual('mgr', data['service']['type']) + self.assertEqual(mgr, data['service']['id']) + self.assertIsInstance(data['counters'], list) + self.assertEqual(len(data['counters']), 0) diff --git a/src/pybind/mgr/dashboard_v2/controllers/perf_counters.py b/src/pybind/mgr/dashboard_v2/controllers/perf_counters.py index 63d62fedddf98..59692d3309a16 100644 --- a/src/pybind/mgr/dashboard_v2/controllers/perf_counters.py +++ b/src/pybind/mgr/dashboard_v2/controllers/perf_counters.py @@ -59,6 +59,7 @@ class PerfCounters(RESTController): self.osd = PerfCounter('osd') self.rgw = PerfCounter('rgw') self.rbd_mirror = PerfCounter('rbd-mirror') + self.mgr = PerfCounter('mgr') def list(self): counters = mgr.get_all_perf_counters() -- 2.39.5