|
|
|
|
@ -51,7 +51,7 @@ func main() { |
|
|
|
|
listPath = listCmd.Arg("db path", "database path (default is "+filepath.Join("benchout", "storage")+")").Default(filepath.Join("benchout", "storage")).String() |
|
|
|
|
analyzeCmd = cli.Command("analyze", "analyze churn, label pair cardinality.") |
|
|
|
|
analyzePath = analyzeCmd.Arg("db path", "database path (default is "+filepath.Join("benchout", "storage")+")").Default(filepath.Join("benchout", "storage")).String() |
|
|
|
|
analyzeBlockId = analyzeCmd.Arg("block id", "block to analyze (default is the last block)").String() |
|
|
|
|
analyzeBlockID = analyzeCmd.Arg("block id", "block to analyze (default is the last block)").String() |
|
|
|
|
analyzeLimit = analyzeCmd.Flag("limit", "how many items to show in each list").Default("20").Int() |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
@ -76,9 +76,9 @@ func main() { |
|
|
|
|
} |
|
|
|
|
blocks := db.Blocks() |
|
|
|
|
var block *tsdb.Block |
|
|
|
|
if *analyzeBlockId != "" { |
|
|
|
|
if *analyzeBlockID != "" { |
|
|
|
|
for _, b := range blocks { |
|
|
|
|
if b.Meta().ULID.String() == *analyzeBlockId { |
|
|
|
|
if b.Meta().ULID.String() == *analyzeBlockID { |
|
|
|
|
block = b |
|
|
|
|
break |
|
|
|
|
} |
|
|
|
|
@ -455,15 +455,17 @@ func analyzeBlock(b *tsdb.Block, limit int) { |
|
|
|
|
lbls := labels.Labels{} |
|
|
|
|
chks := []chunks.Meta{} |
|
|
|
|
for p.Next() { |
|
|
|
|
err = ir.Series(p.At(), &lbls, &chks) |
|
|
|
|
if err = ir.Series(p.At(), &lbls, &chks); err != nil { |
|
|
|
|
exitWithError(err) |
|
|
|
|
} |
|
|
|
|
// Amount of the block time range not covered by this series.
|
|
|
|
|
uncovered := uint64(meta.MaxTime-meta.MinTime) - uint64(chks[len(chks)-1].MaxTime-chks[0].MinTime) |
|
|
|
|
for _, lbl := range lbls { |
|
|
|
|
key := lbl.Name + "=" + lbl.Value |
|
|
|
|
labelsUncovered[lbl.Name] += uncovered |
|
|
|
|
labelpairsUncovered[key] += uncovered |
|
|
|
|
labelpairsCount[key] += 1 |
|
|
|
|
entries += 1 |
|
|
|
|
labelpairsCount[key]++ |
|
|
|
|
entries++ |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if p.Err() != nil { |
|
|
|
|
|