Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use time.RFC3339 in bucket inspect command for consistency #5114

Merged
merged 1 commit into from
Feb 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ We use *breaking :warning:* to mark changes that are not backward compatible (re
- [#4879](https://github.com/thanos-io/thanos/pull/4879) Bucket verify: Fixed bug causing wrong number of blocks to be checked.
- [#4908](https://github.com/thanos-io/thanos/pull/4908) UI: Show 'minus' icon and add tooltip when store min / max time is not available.
- [#4883](https://github.com/thanos-io/thanos/pull/4883) Mixin: adhere to RFC 1123 compatible component naming.
- [#5114](https://github.com/thanos-io/thanos/pull/5114) Tools `thanos bucket inspect` fix time formatting.

## [v0.24.0](https://github.com/thanos-io/thanos/tree/release-0.24) - 2021.12.22

Expand Down
10 changes: 5 additions & 5 deletions cmd/thanos/tools_bucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ func registerBucketLs(app extkingpin.AppClause, objStoreConfig *extflag.PathOrCo
maxTime := time.Unix(m.MaxTime/1000, 0)

if _, err = fmt.Fprintf(os.Stdout, "%s -- %s - %s Diff: %s, Compaction: %d, Downsample: %d, Source: %s\n",
m.ULID, minTime.Format("2006-01-02 15:04"), maxTime.Format("2006-01-02 15:04"), maxTime.Sub(minTime),
m.ULID, minTime.Format(time.RFC3339), maxTime.Format(time.RFC3339), maxTime.Sub(minTime),
m.Compaction.Level, m.Thanos.Downsample.Resolution, m.Thanos.Source); err != nil {
return err
}
Expand Down Expand Up @@ -911,8 +911,8 @@ func printBlockData(blockMetas []*metadata.Meta, selectorLabels labels.Labels, s
var line []string
line = append(line,
blockMeta.ULID.String(),
time.Unix(blockMeta.MinTime/1000, 0).Format("02-01-2006 15:04:05"),
time.Unix(blockMeta.MaxTime/1000, 0).Format("02-01-2006 15:04:05"),
time.Unix(blockMeta.MinTime/1000, 0).Format(time.RFC3339),
time.Unix(blockMeta.MaxTime/1000, 0).Format(time.RFC3339),
timeRange.String(),
untilDown,
p.Sprintf("%d", blockMeta.Stats.NumSeries),
Expand Down Expand Up @@ -997,8 +997,8 @@ func (t Table) Less(i, j int) bool {

func compare(s1, s2 string) bool {
// Values can be either Time, Duration, comma-delimited integers or strings.
s1Time, s1Err := time.Parse("02-01-2006 15:04:05", s1)
s2Time, s2Err := time.Parse("02-01-2006 15:04:05", s2)
s1Time, s1Err := time.Parse(time.RFC3339, s1)
s2Time, s2Err := time.Parse(time.RFC3339, s2)
if s1Err != nil || s2Err != nil {
s1Duration, s1Err := time.ParseDuration(s1)
s2Duration, s2Err := time.ParseDuration(s2)
Expand Down