Print label names with highest cumulative label value length during tsdb analyze (#626)

Signed-off-by: Ryan Scott <rscott@splunk.com>
Co-authored-by: Chris Marchbanks <csmarchbanks@gmail.com>
This commit is contained in:
Chris Marchbanks 2019-06-21 02:07:50 -06:00 committed by Krasi Georgiev
parent b40cc43958
commit 92d15169fc

View file

@ -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)