Skip to content

bucket: "inspect --sort-by" is not numeric-aware #2414

@belm0

Description

@belm0

Thanos, Prometheus and Golang version used: v0.11.0

What happened: bucket inspect --sort-by UNTIL-DOWN does not produce expected ordering

What you expected to happen: sort numerically by time duration

If it's too complex to support alpha vs. numeric, sorting direction, etc. perhaps it would be better to remove the --sort-by feature and leave it to post-processing...

How to reproduce it (as minimally and precisely as possible):

$ /bin/thanos bucket inspect --sort-by UNTIL-DOWN
|            ULID            |        FROM         |        UNTIL        |  RANGE   | UNTIL-DOWN |  #SERIES  |    #SAMPLES    |  #CHUNKS   | COMP-LEVEL | COMP-FAILED |    LABELS    | RESOLUTION |  SOURCE   |
|----------------------------|---------------------|---------------------|----------|------------|-----------|----------------|------------|------------|-------------|--------------|------------|-----------|
...
| 01E5096G1P88MBXNATDFDPNNRG | 01-04-2020 06:00:00 | 03-04-2020 12:00:00 | 54h0m0s  | -14h0m0s   | 2,316,976 | 3,964,484,856  | 37,540,413 | 4          | false       | replica=main | 0s         | sidecar   |
| 01E5H7MQCQ5Q86095CC1JSJ8AV | 26-12-2019 12:00:00 | 04-01-2020 12:00:00 | 216h0m0s | -176h0m0s  | 842,250   | 1,978,856,089  | 19,461,079 | 6          | false       | replica=main | 0s         | compactor |
| 01E5H6MFM2A9QSMCSX2JK441T8 | 08-04-2020 00:00:00 | 10-04-2020 00:00:00 | 48h0m0s  | -8h0m0s    | 2,207,280 | 3,711,359,114  | 34,641,807 | 3          | false       | replica=main | 0s         | compactor |
| 01E5HCVWQSC1492701AWVKM0CF | 09-03-2020 18:00:00 | 12-03-2020 00:00:00 | 54h0m0s  | 186h0m0s   | 1,880,277 | 580,895,412    | 5,115,790  | 4          | true        | replica=main | 5m0s       | compactor |
| 01E5HHR9V8NGYBC7CTAVYX766E | 27-03-2020 18:00:00 | 30-03-2020 00:00:00 | 54h0m0s  | 186h0m0s   | 1,688,583 | 701,582,637    | 5,788,266  | 4          | true        | replica=main | 5m0s       | compactor |
| 01E5HJTRFBPC2PG44J5BQA170R | 05-03-2020 06:00:00 | 07-03-2020 12:00:00 | 54h0m0s  | 186h0m0s   | 1,795,213 | 572,997,620    | 5,012,678  | 4          | true        | replica=main | 5m0s       | compactor |
| 01E5HQACS5J0RGANE2D9H40W2V | 30-03-2020 00:00:00 | 01-04-2020 06:00:00 | 54h0m0s  | 186h0m0s   | 2,201,667 | 786,975,870    | 6,748,038  | 4          | true        | replica=main | 5m0s       | compactor |
| 01E5HS781NM79E3CT9PBN7GKPR | 01-04-2020 06:00:00 | 03-04-2020 12:00:00 | 54h0m0s  | 186h0m0s   | 2,316,976 | 805,786,196    | 6,953,904  | 4          | false       | replica=main | 5m0s       | compactor |
| 01E5J1HHD53XG3TC3V6NWAEJ8W | 25-03-2020 12:00:00 | 27-03-2020 18:00:00 | 54h0m0s  | 186h0m0s   | 2,031,452 | 716,804,692    | 6,159,897  | 4          | true        | replica=main | 5m0s       | compactor |
| 01E5J4SN7PHQW6Z2WQ3DAZC3Y7 | 07-03-2020 12:00:00 | 09-03-2020 18:00:00 | 54h0m0s  | 186h0m0s   | 1,696,303 | 562,270,851    | 4,858,224  | 4          | true        | replica=main | 5m0s       | compactor |
| 01E5HDVZSCJNRGWJ301YTG4FKT | 08-04-2020 00:00:00 | 10-04-2020 00:00:00 | 48h0m0s  | 192h0m0s   | 2,207,280 | 755,607,249    | 6,784,993  | 3          | false       | replica=main | 5m0s       | compactor |
| 01E526VK93N0JRPNZPR5Y4TNC7 | 03-04-2020 12:00:00 | 04-04-2020 06:00:00 | 18h0m0s  | 22h0m0s    | 1,670,889 | 1,309,978,265  | 11,885,519 | 3          | false       | replica=main | 0s         | sidecar   |
| 01E544MJZP1HD9NCB2YS6SWRKJ | 04-04-2020 06:00:00 | 05-04-2020 00:00:00 | 18h0m0s  | 22h0m0s    | 1,571,817 | 1,250,676,619  | 11,341,306 | 3          | false       | replica=main | 0s         | sidecar   |
...

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions