mirror of
https://github.com/prometheus/prometheus.git
synced 2025-01-11 13:57:36 -08:00
Display block duration in promtool list blocks command (#7653)
* Update tsdb.go Added DURATION column to `tsdb list` command Signed-off-by: soup <chicknsoupuds@gmail.com> * Use time.Duration instead of hardcoded hour Signed-off-by: soup <chicknsoupuds@gmail.com>
This commit is contained in:
parent
6b7ac2ac1b
commit
e05c19da5d
|
@ -363,15 +363,16 @@ func printBlocks(blocks []tsdb.BlockReader, humanReadable bool) {
|
||||||
tw := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
|
tw := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
|
||||||
defer tw.Flush()
|
defer tw.Flush()
|
||||||
|
|
||||||
fmt.Fprintln(tw, "BLOCK ULID\tMIN TIME\tMAX TIME\tNUM SAMPLES\tNUM CHUNKS\tNUM SERIES")
|
fmt.Fprintln(tw, "BLOCK ULID\tMIN TIME\tMAX TIME\tDURATION\tNUM SAMPLES\tNUM CHUNKS\tNUM SERIES")
|
||||||
for _, b := range blocks {
|
for _, b := range blocks {
|
||||||
meta := b.Meta()
|
meta := b.Meta()
|
||||||
|
|
||||||
fmt.Fprintf(tw,
|
fmt.Fprintf(tw,
|
||||||
"%v\t%v\t%v\t%v\t%v\t%v\n",
|
"%v\t%v\t%v\t%v\t%v\t%v\t%v\n",
|
||||||
meta.ULID,
|
meta.ULID,
|
||||||
getFormatedTime(meta.MinTime, humanReadable),
|
getFormatedTime(meta.MinTime, humanReadable),
|
||||||
getFormatedTime(meta.MaxTime, humanReadable),
|
getFormatedTime(meta.MaxTime, humanReadable),
|
||||||
|
time.Duration(meta.MaxTime-meta.MinTime)*time.Millisecond,
|
||||||
meta.Stats.NumSamples,
|
meta.Stats.NumSamples,
|
||||||
meta.Stats.NumChunks,
|
meta.Stats.NumChunks,
|
||||||
meta.Stats.NumSeries,
|
meta.Stats.NumSeries,
|
||||||
|
|
Loading…
Reference in a new issue