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: v19.0.0~1579^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=277350ed15ca7ca899c8f58062ac463f682e2f37;p=ceph.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 --- diff --git a/src/pybind/mgr/telemetry/module.py b/src/pybind/mgr/telemetry/module.py index 597a9e0ebe82..4df3fa59b4ed 100644 --- a/src/pybind/mgr/telemetry/module.py +++ b/src/pybind/mgr/telemetry/module.py @@ -1523,6 +1523,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' @@ -1920,10 +1922,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]: