diff --git a/cmd/tsdb/main.go b/cmd/tsdb/main.go index e7b33c855e..74dfed4c5c 100644 --- a/cmd/tsdb/main.go +++ b/cmd/tsdb/main.go @@ -506,6 +506,30 @@ func analyzeBlock(b *tsdb.Block, limit int) { fmt.Printf("\nMost common label pairs:\n") printInfo(postingInfos) + postingInfos = postingInfos[:0] + for _, n := range allLabelNames { + values, err := ir.LabelValues(n) + if err != nil { + exitWithError(err) + } + var cumulativeLength uint64 + + for i := 0; i < values.Len(); i++ { + value, _ := values.At(i) + if err != nil { + exitWithError(err) + } + for _, str := range value { + cumulativeLength += uint64(len(str)) + } + } + + postingInfos = append(postingInfos, postingInfo{n, cumulativeLength}) + } + + fmt.Printf("\nLabel names with highest cumulative label value length:\n") + printInfo(postingInfos) + postingInfos = postingInfos[:0] for _, n := range allLabelNames { lv, err := ir.LabelValues(n)