Bug #41754
openUse dump_stream() instead of dump_float() for floats where max precision isn't helpful
0%
Description
Some examples from osd dump are below. The full_ratio is .95, backfill_ratio .90 and nearfull_ratio .85.
"full_ratio": 0.949999988079071, "backfillfull_ratio": 0.8999999761581421, "nearfull_ratio": 0.8500000238418579,
Some fields from osd dump I'm not sure about.
"weight": 0.904632568359375, "primary_affinity": 0.451995849609375,
Another example of useless precision:
$ ceph daemon osd.0 compact { "elapsed_time": 0.087996230999999994 }
Updated by Марк Коренберг over 4 years ago
Regarding elapsed time it might be important (for `compact` is not, but for benchmarking is). Another importatnat thing -- Prometheus plugin. It gathers info from such API. and it requires full precision.
As a compromise, it might be possible to add special global parameter (i.e. precision), that can be used in dump_float.
Possibly, we might restrict precision in json-pretty, but leave full precision in json. This is nice idea, but it is quite unexpected for admins/developers.
Updated by David Zafman over 4 years ago
I was suspicious that the trailing 0999999994 in the elapsed time is noise. Could this be caused by a float being cast to double?
Updated by David Zafman over 4 years ago
- Related to Bug #41156: dump_float() poor output added
Updated by David Zafman over 4 years ago
From json.org:
JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans to read and write. It is easy for machines to parse and generate.
The whole reason I'm fixing this bug instead of https://tracker.ceph.com/issues/41156 is because of the claim that JSON output is only for machines to parse.