]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/telemetry: make sure histograms are formatted in `all` commands 48948/head
authorLaura Flores <lflores@redhat.com>
Fri, 18 Nov 2022 20:42:18 +0000 (20:42 +0000)
committerLaura Flores <lflores@redhat.com>
Fri, 18 Nov 2022 22:18:51 +0000 (22:18 +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>
src/pybind/mgr/telemetry/module.py

index 597a9e0ebe82754f77018ba7b94f3706fec34273..4df3fa59b4edff196b3db79012cf1f52d94b4f54 100644 (file)
@@ -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]: