From: Tiago Melo Date: Wed, 7 Mar 2018 15:39:27 +0000 (+0000) Subject: mgr/dashboard_v2: add mgr to the list of perf counters X-Git-Tag: v13.1.0~569^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=e8a1e267af32858d830229440d25362a877ed563;p=ceph.git mgr/dashboard_v2: add mgr to the list of perf counters Signed-off-by: Tiago Melo --- diff --git a/qa/tasks/mgr/dashboard_v2/test_perf_counters.py b/qa/tasks/mgr/dashboard_v2/test_perf_counters.py index 6be867bd30e..6f38260303d 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 63d62fedddf..59692d3309a 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()