|
|
|
@ -60,7 +60,7 @@ func main() {
|
|
|
|
|
if err != nil { |
|
|
|
|
exitWithError(err) |
|
|
|
|
} |
|
|
|
|
db.PrintBlocks() |
|
|
|
|
printBlocks(db.Blocks()) |
|
|
|
|
} |
|
|
|
|
flag.CommandLine.Set("log.level", "debug") |
|
|
|
|
} |
|
|
|
@ -331,3 +331,21 @@ func exitWithError(err error) {
|
|
|
|
|
fmt.Fprintln(os.Stderr, err) |
|
|
|
|
os.Exit(1) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func printBlocks(blocks []tsdb.DiskBlock) { |
|
|
|
|
tw := tsdb.GetNewTabWriter(os.Stdout) |
|
|
|
|
defer tw.Flush() |
|
|
|
|
|
|
|
|
|
fmt.Fprintln(tw, "BLOCK ULID\tMIN TIME\tMAX TIME\tNUM SAMPLES\tNUM CHUNKS\tNUM SERIES") |
|
|
|
|
for _, b := range blocks { |
|
|
|
|
fmt.Fprintf(tw, |
|
|
|
|
"%v\t%v\t%v\t%v\t%v\t%v\n", |
|
|
|
|
b.Meta().ULID, |
|
|
|
|
b.Meta().MinTime, |
|
|
|
|
b.Meta().MaxTime, |
|
|
|
|
b.Meta().Stats.NumSamples, |
|
|
|
|
b.Meta().Stats.NumChunks, |
|
|
|
|
b.Meta().Stats.NumSeries, |
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|