From: Laura Flores Date: Fri, 18 Nov 2022 20:42:18 +0000 (+0000) Subject: mgr/telemetry: make sure histograms are formatted in `all` commands X-Git-Tag: v18.1.0~203^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2de6ded621bac2bf9bda83775ad88ffabc358117;p=ceph-ci.git mgr/telemetry: make sure histograms are formatted in `all` commands I noticed that histograms weren't getting formatted in `preview-all` and `show-all`. I made a few tweaks so they are properly formatted now. I verified this fix on: `ceph telemetry preview` `ceph telemetry preview-all` `ceph telemetry show` `ceph telemetry show-all` Note that only the `all` commands were affected. Fixes: https://tracker.ceph.com/issues/58050 Signed-off-by: Laura Flores (cherry picked from commit 277350ed15ca7ca899c8f58062ac463f682e2f37) --- diff --git a/src/pybind/mgr/telemetry/module.py b/src/pybind/mgr/telemetry/module.py index e4f637def9e..2626679113b 100644 --- a/src/pybind/mgr/telemetry/module.py +++ b/src/pybind/mgr/telemetry/module.py @@ -1540,6 +1540,8 @@ class Module(MgrModule): # Formatting the perf histograms so they are human-readable. This will change the # ranges and values, which are currently in list form, into strings so that # they are displayed horizontally instead of vertically. + if 'report' in report: + report = report['report'] try: # Formatting ranges and values in osd_perf_histograms mode = 'osd_perf_histograms' @@ -1937,10 +1939,13 @@ Please consider enabling the telemetry module with 'ceph telemetry on'.''' if not self.channel_device: # device channel is off, no need to display its report - return 0, json.dumps(self.get_report_locked('default'), indent=4, sort_keys=True), '' + report = self.get_report_locked('default') + else: + # telemetry is on and device channel is enabled, show both + report = self.get_report_locked('all') - # telemetry is on and device channel is enabled, show both - return 0, json.dumps(self.get_report_locked('all'), indent=4, sort_keys=True), '' + self.format_perf_histogram(report) + return 0, json.dumps(report, indent=4, sort_keys=True), '' @CLIReadCommand('telemetry preview-all') def preview_all(self) -> Tuple[int, str, str]: