]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
tools/rados: Remove plain text snippets from rados bench JSON output 66936/head
authorJacques Heunis <jheunis@bloomberg.net>
Thu, 15 Jan 2026 12:11:11 +0000 (12:11 +0000)
committerPatrick Donnelly <pdonnell@ibm.com>
Fri, 29 May 2026 14:53:22 +0000 (10:53 -0400)
`rados bench` emits performance stats as its output. It is very helpful
for this output to be in a machine-readable format and the CLI provides
the `--format=json` flag to achieve this.

There are some logs that do not respect the formatter flag though, as
they provide status updates as the tool is running and do not form part
of the output dataset. This prevents the contents of stdout from being
valid JSON which destroys the machine-readability of the output.

To resolve this we gate those status messages behind a check for the
formatter. If any specific formatter is provided we do not emit the
status logs. This leaves the plaintext output largely untouched while
helping the machine-readable output to be well-formed.

Fixes: https://tracker.ceph.com/issues/74370
Signed-off-by: Jacques Heunis <jheunis@bloomberg.net>
src/common/obj_bencher.cc
src/tools/rados/rados.cc

index b4db480a686cf5921de3492ec3e354ce654928c4..63de044122dca1dc68a42ac446f57dcbef59ce46 100644 (file)
@@ -333,13 +333,14 @@ int ObjBencher::aio_bench(
     }
 
     data.start_time = mono_clock::now();
-    out(cout) << "Cleaning up (deleting benchmark objects)" << std::endl;
+    out(cerr) << "Cleaning up (deleting benchmark objects)" << std::endl;
 
     r = clean_up(num_objects, prev_pid, concurrentios);
     if (r != 0) goto out;
 
     timePassed = mono_clock::now() - data.start_time;
-    out(cout) << "Clean up completed and total clean up time :" << timePassed.count() << std::endl;
+    out(cerr) << "Clean up completed and total clean up time :"
+              << timePassed.count() << std::endl;
 
     // lastrun file
     r = sync_remove(run_name_meta);
@@ -1244,7 +1245,8 @@ int ObjBencher::clean_up(int num_objects, int prevPid, int concurrentios) {
 
   completions_done();
 
-  out(cout) << "Removed " << data.finished << " object" << (data.finished != 1 ? "s" : "") << std::endl;
+  out(cerr) << "Removed " << data.finished << " object"
+            << (data.finished != 1 ? "s" : "") << std::endl;
 
   return 0;
 
@@ -1431,7 +1433,8 @@ int ObjBencher::clean_up_slow(const std::string& prefix, int concurrentios) {
 
   completions_done();
 
-  out(cout) << "Removed " << data.finished << " object" << (data.finished != 1 ? "s" : "") << std::endl;
+  out(cerr) << "Removed " << data.finished << " object"
+            << (data.finished != 1 ? "s" : "") << std::endl;
 
   return 0;
 
index 301a4da33e4ceb79dad4fa1d868ae7b0eeefa5ca..42103648b6b8a0ec2b152840b62ce3acc9d947dd 100644 (file)
@@ -3434,7 +3434,6 @@ static int rados_tool_common(const std::map < std::string, std::string > &opts,
       object_size = op_size;
     else if (object_size < op_size)
       op_size = object_size;
-    cout << "hints = " << (int)hints << std::endl;
     ret = bencher.aio_bench(operation, seconds,
                            concurrent_ios, op_size, object_size,
                            max_objects, cleanup, hints, run_name, reuse_bench, no_verify);