go-c8y-cli icon indicating copy to clipboard operation
go-c8y-cli copied to clipboard

Improve readability for big numbers in go-c8y-cli views

Open k-butz opened this issue 1 year ago • 3 comments

When dealing with tenant statistics, you're often dealing with big numbers, e.g. measurementCreatedCount or storage size. One example:

# c8y tenantstatistics list --select day,storageSize,measurementsCreatedCount --dateFrom -1w --includeAll -o table
| day                           | storageSize        | measurementsCreatedCount |
|-------------------------------|--------------------|--------------------------|
| 2024-02-28T00:00:00.000Z      | 2828355978011      | 77622763                 |
| 2024-02-29T00:00:00.000Z      | 2837046761229      | 77707640                 |
| 2024-03-01T00:00:00.000Z      | 2840216916862      | 77969384                 |
| 2024-03-02T00:00:00.000Z      | 2842677558821      | 77916302                 |
| 2024-03-03T00:00:00.000Z      | 2843945102113      | 77925296                 |
| 2024-03-04T00:00:00.000Z      | 2846609592135      | 77785959                 |
| 2024-03-05T00:00:00.000Z      | 2670452044668      | 37865132                 |

These big numbers are pretty hard to read. My improvement idea would be to show them as 2,828,355,978,011 or 2_828_355_978_011 instead of 2828355978011.

Maybe it can be made configurable in view-definitions to show a number "as-is" or with such separators?

k-butz avatar Mar 05 '24 11:03 k-butz

Though wouldn't another option be to display large numbers ons an approximate format e.g. "2.35 billion" or something similar to that as generally high resolution is not needed for very large numbers.

reubenmiller avatar Mar 05 '24 11:03 reubenmiller

Maybe using SI Units (without the unit), https://github.com/dustin/go-humanize?tab=readme-ov-file#si-notation

reubenmiller avatar Mar 05 '24 11:03 reubenmiller

Yeah, showing "2.35 bio" would also fit for me. In the end I just wanted to see easier and on the first sight how big these numbers actually are (e.g tens of mio, hundreds of mio, billions, etc).

k-butz avatar Mar 05 '24 12:03 k-butz