mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-25 21:54:10 -08:00
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:
parent
b40cc43958
commit
92d15169fc
|
@ -506,6 +506,30 @@ func analyzeBlock(b *tsdb.Block, limit int) {
|
||||||
fmt.Printf("\nMost common label pairs:\n")
|
fmt.Printf("\nMost common label pairs:\n")
|
||||||
printInfo(postingInfos)
|
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]
|
postingInfos = postingInfos[:0]
|
||||||
for _, n := range allLabelNames {
|
for _, n := range allLabelNames {
|
||||||
lv, err := ir.LabelValues(n)
|
lv, err := ir.LabelValues(n)
|
||||||
|
|
Loading…
Reference in a new issue