mirror of
https://github.com/prometheus/prometheus.git
synced 2025-02-21 03:16:00 -08:00
Merge pull request #8575 from pfreixes/add-scrapes-parameter
Add num scrapes as tsdb write benchmark command flag
This commit is contained in:
commit
63ea88af82
|
@ -124,6 +124,7 @@ func main() {
|
||||||
tsdbBenchWriteCmd := tsdbBenchCmd.Command("write", "Run a write performance benchmark.")
|
tsdbBenchWriteCmd := tsdbBenchCmd.Command("write", "Run a write performance benchmark.")
|
||||||
benchWriteOutPath := tsdbBenchWriteCmd.Flag("out", "Set the output path.").Default("benchout").String()
|
benchWriteOutPath := tsdbBenchWriteCmd.Flag("out", "Set the output path.").Default("benchout").String()
|
||||||
benchWriteNumMetrics := tsdbBenchWriteCmd.Flag("metrics", "Number of metrics to read.").Default("10000").Int()
|
benchWriteNumMetrics := tsdbBenchWriteCmd.Flag("metrics", "Number of metrics to read.").Default("10000").Int()
|
||||||
|
benchWriteNumScrapes := tsdbBenchWriteCmd.Flag("scrapes", "Number of scrapes to simulate.").Default("3000").Int()
|
||||||
benchSamplesFile := tsdbBenchWriteCmd.Arg("file", "Input file with samples data, default is ("+filepath.Join("..", "..", "tsdb", "testdata", "20kseries.json")+").").Default(filepath.Join("..", "..", "tsdb", "testdata", "20kseries.json")).String()
|
benchSamplesFile := tsdbBenchWriteCmd.Arg("file", "Input file with samples data, default is ("+filepath.Join("..", "..", "tsdb", "testdata", "20kseries.json")+").").Default(filepath.Join("..", "..", "tsdb", "testdata", "20kseries.json")).String()
|
||||||
|
|
||||||
tsdbAnalyzeCmd := tsdbCmd.Command("analyze", "Analyze churn, label pair cardinality.")
|
tsdbAnalyzeCmd := tsdbCmd.Command("analyze", "Analyze churn, label pair cardinality.")
|
||||||
|
@ -195,7 +196,7 @@ func main() {
|
||||||
os.Exit(RulesUnitTest(*testRulesFiles...))
|
os.Exit(RulesUnitTest(*testRulesFiles...))
|
||||||
|
|
||||||
case tsdbBenchWriteCmd.FullCommand():
|
case tsdbBenchWriteCmd.FullCommand():
|
||||||
os.Exit(checkErr(benchmarkWrite(*benchWriteOutPath, *benchSamplesFile, *benchWriteNumMetrics)))
|
os.Exit(checkErr(benchmarkWrite(*benchWriteOutPath, *benchSamplesFile, *benchWriteNumMetrics, *benchWriteNumScrapes)))
|
||||||
|
|
||||||
case tsdbAnalyzeCmd.FullCommand():
|
case tsdbAnalyzeCmd.FullCommand():
|
||||||
os.Exit(checkErr(analyzeBlock(*analyzePath, *analyzeBlockID, *analyzeLimit)))
|
os.Exit(checkErr(analyzeBlock(*analyzePath, *analyzeBlockID, *analyzeLimit)))
|
||||||
|
|
|
@ -58,7 +58,7 @@ type writeBenchmark struct {
|
||||||
logger log.Logger
|
logger log.Logger
|
||||||
}
|
}
|
||||||
|
|
||||||
func benchmarkWrite(outPath, samplesFile string, numMetrics int) error {
|
func benchmarkWrite(outPath, samplesFile string, numMetrics, numScrapes int) error {
|
||||||
b := &writeBenchmark{
|
b := &writeBenchmark{
|
||||||
outPath: outPath,
|
outPath: outPath,
|
||||||
samplesFile: samplesFile,
|
samplesFile: samplesFile,
|
||||||
|
@ -118,7 +118,7 @@ func benchmarkWrite(outPath, samplesFile string, numMetrics int) error {
|
||||||
if err := b.startProfiling(); err != nil {
|
if err := b.startProfiling(); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
total, err = b.ingestScrapes(lbs, 3000)
|
total, err = b.ingestScrapes(lbs, numScrapes)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue