]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/telemetry: make sure histograms are formatted in `all` commands
authorLaura Flores <lflores@redhat.com>
Fri, 18 Nov 2022 20:42:18 +0000 (20:42 +0000)
committerLaura Flores <lflores@redhat.com>
Fri, 10 Mar 2023 21:46:02 +0000 (21:46 +0000)
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 <lflores@redhat.com>
(cherry picked from commit 277350ed15ca7ca899c8f58062ac463f682e2f37)

src/pybind/mgr/telemetry/module.py

index e4f637def9e4ee32f6ed3e10b2bce4f0f4c6de38..2626679113bbf63625d7d03fec0e2564e91ba656 100644 (file)
@@ -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]: