From fdcda76fcf7e9cfffc24945b048f4f84f60f3b02 Mon Sep 17 00:00:00 2001 From: Neeraj Pratap Singh Date: Tue, 2 Dec 2025 17:50:52 +0530 Subject: [PATCH] src/pybind/mgr: handle json-pretty for perf stats Fixes: https://tracker.ceph.com/issues/74072 Signed-off-by: Neeraj Pratap Singh --- src/pybind/mgr/stats/fs/perf_stats.py | 2 +- src/pybind/mgr/stats/module.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) 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']) -- 2.47.3