From eaaa21aa7ff196661e53de14fab3e4f805378049 Mon Sep 17 00:00:00 2001 From: Ziqi Zhao Date: Fri, 1 Sep 2023 11:21:52 +0800 Subject: [PATCH] promtool tsdb dump support native histogram (#12775) Signed-off-by: Ziqi Zhao --- cmd/promtool/tsdb.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cmd/promtool/tsdb.go b/cmd/promtool/tsdb.go index 4e27f69c0..820cd4687 100644 --- a/cmd/promtool/tsdb.go +++ b/cmd/promtool/tsdb.go @@ -647,6 +647,14 @@ func dumpSamples(path string, mint, maxt int64, match string) (err error) { ts, val := it.At() fmt.Printf("%s %g %d\n", lbs, val, ts) } + for it.Next() == chunkenc.ValFloatHistogram { + ts, fh := it.AtFloatHistogram() + fmt.Printf("%s %s %d\n", lbs, fh.String(), ts) + } + for it.Next() == chunkenc.ValHistogram { + ts, h := it.AtHistogram() + fmt.Printf("%s %s %d\n", lbs, h.String(), ts) + } if it.Err() != nil { return ss.Err() }