From: Neeraj Pratap Singh Date: Tue, 2 Dec 2025 12:20:52 +0000 (+0530) Subject: src/pybind/mgr: handle json-pretty for perf stats X-Git-Tag: testing/wip-vshankar-testing-20260323.164129~1^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=fdcda76fcf7e9cfffc24945b048f4f84f60f3b02;p=ceph-ci.git src/pybind/mgr: handle json-pretty for perf stats Fixes: https://tracker.ceph.com/issues/74072 Signed-off-by: Neeraj Pratap Singh --- diff --git a/src/pybind/mgr/stats/fs/perf_stats.py b/src/pybind/mgr/stats/fs/perf_stats.py index 7b97e42857a..3c602d2e251 100644 --- a/src/pybind/mgr/stats/fs/perf_stats.py +++ b/src/pybind/mgr/stats/fs/perf_stats.py @@ -648,4 +648,4 @@ class FSPerfStats(object): with self.lock: user_query = self.register_query(filter_spec) result = self.generate_report(user_query) - return 0, json.dumps(result), "" + return result diff --git a/src/pybind/mgr/stats/module.py b/src/pybind/mgr/stats/module.py index fcc1bce97b5..3924577b10f 100644 --- a/src/pybind/mgr/stats/module.py +++ b/src/pybind/mgr/stats/module.py @@ -37,5 +37,8 @@ class Module(MgrModule): prefix = cmd['prefix'] # only supported command is `fs perf stats` right now if prefix.startswith('fs perf stats'): - return self.fs_perf_stats.get_perf_data(cmd) + result = self.fs_perf_stats.get_perf_data(cmd) + if 'format' in cmd and cmd['format'] == 'json-pretty': + return 0, json.dumps(result, indent=2), "" + return 0, json.dumps(result), "" raise NotImplementedError(cmd['prefix'])