Skip to content

tools/rados: Remove plain text snippets from rados bench JSON output - #66936

Merged
rzarzynski merged 1 commit into
ceph:mainfrom
jacquesh:remove-text-output-from-rados-bench-json
Jun 1, 2026
Merged

rzarzynski merged 1 commit into
ceph:mainfrom
jacquesh:remove-text-output-from-rados-bench-json

Conversation

@jacquesh

Copy link
Copy Markdown
Contributor

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.

Below is a "diff" of the output (sort of hand constructed from an actual diff because obviously all the numbers etc also changed, also ignore the trailing "added" whitespace, apparently github won't format a diff as such if there are only lines removed):

Plain-text output
  $ rados -p tp bench 5 write
  2026-01-15T16:08:38.887+0000 7f6c8bf0a100 -1 WARNING: all dangerous and experimental features are enabled.
  2026-01-15T16:08:38.891+0000 7f6c8bf0a100 -1 WARNING: all dangerous and experimental features are enabled.
  2026-01-15T16:08:38.892+0000 7f6c8bf0a100 -1 WARNING: all dangerous and experimental features are enabled.
- hints = 1
  Object prefix: benchmark_data_foo
    sec Cur ops   started  finished  avg MB/s  cur MB/s last lat(s)  avg lat(s)
      0       0         0         0         0         0           -           0
      1      16        73        57   227.958       228    0.251027    0.251335
      2      16       135       119   237.963       248    0.182117    0.249729
      3      16       207       191   254.628       288    0.163453    0.244034
      4      16       268       252   251.963       244    0.198276    0.246531
      5      16       334       318   254.362       264    0.200861    0.244526
  Total time run:         5.13436
  Total writes made:      334
  Write size:             4194304
  Object size:            4194304
  Bandwidth (MB/sec):     260.208
  Stddev Bandwidth:       22.7332
  Max bandwidth (MB/sec): 288
  Min bandwidth (MB/sec): 228
  Average IOPS:           65
  Stddev IOPS:            5.68331
  Max IOPS:               72
  Min IOPS:               57
  Average Latency(s):     0.243039
  Stddev Latency(s):      0.0447988
  Max latency(s):         0.444701
  Min latency(s):         0.0928305
  Cleaning up (deleting benchmark objects)
  Removed 334 objects
  Clean up completed and total clean up time :0.436406
+
JSON output
$ rados -p tp --format=json bench 5 write
  2026-01-15T16:08:51.563+0000 7f714069e100 -1 WARNING: all dangerous and experimental features are enabled.
  2026-01-15T16:08:51.568+0000 7f714069e100 -1 WARNING: all dangerous and experimental features are enabled.
  2026-01-15T16:08:51.568+0000 7f714069e100 -1 WARNING: all dangerous and experimental features are enabled.
- hints = 1
- {"concurrent_ios":"16","object_size":"4194304","op_size":"4194304","seconds_to_run":"5","max_objects":"0","object_prefix":"benchmark_data_foo","datas":[<snip so it formats properly> {"sec":"5","cur_ops":"16","started":"327","finished":"311","avg_bw":"248.769687","cur_bw":"228.000000","last_lat":"0.272882","avg_lat":"0.247997"}Cleaning up (deleting benchmark objects)
- Removed 327 objects
- Clean up completed and total clean up time :0.48125
- ],"total_time_run":"5.138616","total_writes_made":"327","write_size":"4194304","object_size":"4194304","bandwidth":"254.543228","stddev_bandwidth":"19.879638","max_bandwidth":"280.000000","min_bandwidth":"228.000000","average_iops":"63","stddev_iops":"-1371919792","max_iops":"70","min_iops":"57","average_latency":"0.248902","stddev_latency":"0.045634","max_latency":"0.389138","min_latency":"0.126813"}
+{"concurrent_ios":"16","object_size":"4194304","op_size":"4194304","seconds_to_run":"5","max_objects":"0","object_prefix":"benchmark_data_foo","datas":[{"sec":"0","cur_ops":"0","started":"0","finished":"0","avg_bw":"0.000000","cur_bw":"0.000000","last_lat":"0.000000","avg_lat":"0.000000"},     <snip, because if the line is too long github won't highlight it properly>    ],"total_time_run":"5.112553","total_writes_made":"307","write_size":"4194304","object_size":"4194304","bandwidth":"240.193125","stddev_bandwidth":"11.798305","max_bandwidth":"252.000000","min_bandwidth":"220.000000","average_iops":"60","stddev_iops":"35310160","max_iops":"63","min_iops":"55","average_latency":"0.265146","stddev_latency":"0.056829","max_latency":"0.393825","min_latency":"0.102045"}

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands

You must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.

@jacquesh
jacquesh requested a review from a team as a code owner January 15, 2026 16:34
@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Can one of the admins verify this patch?

14 similar comments
@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Can one of the admins verify this patch?

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Can one of the admins verify this patch?

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Can one of the admins verify this patch?

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Can one of the admins verify this patch?

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Can one of the admins verify this patch?

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Can one of the admins verify this patch?

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Can one of the admins verify this patch?

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Can one of the admins verify this patch?

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Can one of the admins verify this patch?

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Can one of the admins verify this patch?

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Can one of the admins verify this patch?

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Can one of the admins verify this patch?

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Can one of the admins verify this patch?

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Can one of the admins verify this patch?

@batrick batrick left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead I'd switch this to cerr. These messages are always inappropriate for cout.

@jacquesh
jacquesh force-pushed the remove-text-output-from-rados-bench-json branch from 14e865e to fef23ed Compare January 16, 2026 15:39
@jacquesh

Copy link
Copy Markdown
Contributor Author

Thanks for the prompt review.

I switched all these logs from cout to cerr but kept them behind the formatter gate. My reasoning for this is that as a user if I specify that I want json output and then visually in the output I see random text intermingled with the json (with text that isn't actually an error), I'd probably still be confused rather than immediately recognising that some of this goes to stderr. Maybe that's on me but still. It's a trade-off against always having the information from the logs available, for which I can imagine an argument as well so I'm happy to defer to what others think is best.

@batrick

batrick commented Feb 20, 2026

Copy link
Copy Markdown
Member

Thanks for the prompt review.

I switched all these logs from cout to cerr but kept them behind the formatter gate. My reasoning for this is that as a user if I specify that I want json output and then visually in the output I see random text intermingled with the json (with text that isn't actually an error), I'd probably still be confused rather than immediately recognising that some of this goes to stderr. Maybe that's on me but still. It's a trade-off against always having the information from the logs available, for which I can imagine an argument as well so I'm happy to defer to what others think is best.

I think it'd be better to always emit these messages to cerr. It can be useful to monitor progress on the terminal (or a log!) even when redirecting the json to some other process like jq.

If you want to avoid these messages then please add a --quiet option to squelch the messages.

@jacquesh
jacquesh force-pushed the remove-text-output-from-rados-bench-json branch from fef23ed to 85b9535 Compare February 23, 2026 14:19
@github-actions github-actions Bot added the stale label Apr 24, 2026
@jacquesh

Copy link
Copy Markdown
Contributor Author

@batrick This PR is now emitting the progress log messages to stderr as requested, and I see you previously approved. What else needs to be done for us to get this in?

@github-actions github-actions Bot removed the stale label Apr 27, 2026
@jmundack

Copy link
Copy Markdown
Contributor

jenkins test this

@ceph ceph deleted a comment from github-actions Bot May 27, 2026
@batrick

batrick commented May 27, 2026

Copy link
Copy Markdown
Member

/ok to test

@ljflores

Copy link
Copy Markdown
Member

jenkins test docs

@ljflores

Copy link
Copy Markdown
Member

@batrick

batrick commented May 29, 2026

Copy link
Copy Markdown
Member

jenkins test docs

@batrick

batrick commented May 29, 2026

Copy link
Copy Markdown
Member
Running Sphinx v6.2.1
Traceback (most recent call last):
  File "/home/docs/checkouts/readthedocs.org/user_builds/ceph/envs/66936/lib/python3.9/site-packages/sphinx/registry.py", line 442, in load_extension
    mod = import_module(extname)
  File "/home/docs/.asdf/installs/python/3.9.25/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/home/docs/checkouts/readthedocs.org/user_builds/ceph/envs/66936/lib/python3.9/site-packages/sphinxcontrib/seqdiag.py", line 19, in <module>
    import pkg_resources
ModuleNotFoundError: No module named 'pkg_resources'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
  File "/home/docs/checkouts/readthedocs.org/user_builds/ceph/envs/66936/lib/python3.9/site-packages/sphinx/cmd/build.py", line 280, in build_main
    app = Sphinx(args.sourcedir, args.confdir, args.outputdir,
  File "/home/docs/checkouts/readthedocs.org/user_builds/ceph/envs/66936/lib/python3.9/site-packages/sphinx/application.py", line 229, in __init__
    self.setup_extension(extension)
  File "/home/docs/checkouts/readthedocs.org/user_builds/ceph/envs/66936/lib/python3.9/site-packages/sphinx/application.py", line 404, in setup_extension
    self.registry.load_extension(self, extname)
  File "/home/docs/checkouts/readthedocs.org/user_builds/ceph/envs/66936/lib/python3.9/site-packages/sphinx/registry.py", line 445, in load_extension
    raise ExtensionError(__('Could not import extension %s') % extname,
sphinx.errors.ExtensionError: Could not import extension sphinxcontrib.seqdiag (exception: No module named 'pkg_resources')
Extension error:
Could not import extension sphinxcontrib.seqdiag (exception: No module named 'pkg_resources')

hmm.

@batrick

batrick commented May 29, 2026

Copy link
Copy Markdown
Member

jenkins test docs

`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 <[email protected]>
@batrick
batrick force-pushed the remove-text-output-from-rados-bench-json branch from 85b9535 to f3b68e3 Compare May 29, 2026 14:53
@batrick

batrick commented May 29, 2026

Copy link
Copy Markdown
Member

(trivial rebase)

@rzarzynski
rzarzynski merged commit b5d6285 into ceph:main Jun 1, 2026
6 checks passed
@jacquesh
jacquesh deleted the remove-text-output-from-rados-bench-json branch June 2, 2026 09:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants