minio / mc

Unix like utilities for object store
https://min.io/download
GNU Affero General Public License v3.0
2.86k stars 548 forks source link

simplify histograms, make it based on the server return #4935

Closed harshavardhana closed 5 months ago

harshavardhana commented 5 months ago

Community Contribution License

All community contributions in this pull request are licensed to the project maintainers under the terms of the Apache 2 license. By creating this pull request I represent that I have the right to license the contributions to the project maintainers under the Apache 2 license.

Description

simplify histograms, make it based on the server return

Motivation and Context

avoid making mc by hardcoded with server return

How to test this PR?

~ mc stat play/builds

Name      : builds
Date      : 2024-05-12 11:29:25 PDT 
Size      : N/A    
Type      : folder 

Properties:
  Versioning: Un-versioned
  Location: us-east-1
  Anonymous: Enabled
  ILM: Disabled

Usage:
      Total size: 301 MiB
   Objects count: 313
  Versions count: 0

Object sizes histogram:
   189 object(s) BETWEEN_1024B_AND_1_MB
    21 object(s) BETWEEN_1024_B_AND_64_KB
     0 object(s) BETWEEN_10_MB_AND_64_MB
     0 object(s) BETWEEN_128_MB_AND_512_MB
   124 object(s) BETWEEN_1_MB_AND_10_MB
    65 object(s) BETWEEN_256_KB_AND_512_KB
    41 object(s) BETWEEN_512_KB_AND_1_MB
    62 object(s) BETWEEN_64_KB_AND_256_KB
     0 object(s) BETWEEN_64_MB_AND_128_MB
     0 object(s) GREATER_THAN_512_MB
     0 object(s) LESS_THAN_1024_B

Types of changes

Checklist:

klauspost commented 5 months ago

A bit annoying we can't present it in size sorted order. I guess that would require either an addition to the data sent or hard-coding "known" values.

klauspost commented 5 months ago

Maybe pre-code a sort order for the fields we "know".

harshavardhana commented 5 months ago

Maybe pre-code a sort order for the fields we "know".

Yeah if server sends it's correctly and madmin is able to give it back properly then sure it will be fine.

But for now this is most simpler from what I could think of.

klauspost commented 5 months ago

@harshavardhana It is a map, so we don't control order.

harshavardhana commented 5 months ago

@harshavardhana It is a map, so we don't control order.

Correct we have to change the data structure, while sending it to client.