|
|
@ -33,6 +33,7 @@ import (
|
|
|
|
|
|
|
|
|
|
|
|
"github.com/alecthomas/units"
|
|
|
|
"github.com/alecthomas/units"
|
|
|
|
"github.com/go-kit/log"
|
|
|
|
"github.com/go-kit/log"
|
|
|
|
|
|
|
|
"go.uber.org/atomic"
|
|
|
|
|
|
|
|
|
|
|
|
"github.com/prometheus/prometheus/model/labels"
|
|
|
|
"github.com/prometheus/prometheus/model/labels"
|
|
|
|
"github.com/prometheus/prometheus/promql/parser"
|
|
|
|
"github.com/prometheus/prometheus/promql/parser"
|
|
|
@ -149,8 +150,7 @@ func benchmarkWrite(outPath, samplesFile string, numMetrics, numScrapes int) err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (b *writeBenchmark) ingestScrapes(lbls []labels.Labels, scrapeCount int) (uint64, error) {
|
|
|
|
func (b *writeBenchmark) ingestScrapes(lbls []labels.Labels, scrapeCount int) (uint64, error) {
|
|
|
|
var mu sync.Mutex
|
|
|
|
var total atomic.Uint64
|
|
|
|
var total uint64
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for i := 0; i < scrapeCount; i += 100 {
|
|
|
|
for i := 0; i < scrapeCount; i += 100 {
|
|
|
|
var wg sync.WaitGroup
|
|
|
|
var wg sync.WaitGroup
|
|
|
@ -165,22 +165,21 @@ func (b *writeBenchmark) ingestScrapes(lbls []labels.Labels, scrapeCount int) (u
|
|
|
|
|
|
|
|
|
|
|
|
wg.Add(1)
|
|
|
|
wg.Add(1)
|
|
|
|
go func() {
|
|
|
|
go func() {
|
|
|
|
|
|
|
|
defer wg.Done()
|
|
|
|
|
|
|
|
|
|
|
|
n, err := b.ingestScrapesShard(batch, 100, int64(timeDelta*i))
|
|
|
|
n, err := b.ingestScrapesShard(batch, 100, int64(timeDelta*i))
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
// exitWithError(err)
|
|
|
|
// exitWithError(err)
|
|
|
|
fmt.Println(" err", err)
|
|
|
|
fmt.Println(" err", err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
mu.Lock()
|
|
|
|
total.Add(n)
|
|
|
|
total += n
|
|
|
|
|
|
|
|
mu.Unlock()
|
|
|
|
|
|
|
|
wg.Done()
|
|
|
|
|
|
|
|
}()
|
|
|
|
}()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
wg.Wait()
|
|
|
|
wg.Wait()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fmt.Println("ingestion completed")
|
|
|
|
fmt.Println("ingestion completed")
|
|
|
|
|
|
|
|
|
|
|
|
return total, nil
|
|
|
|
return total.Load(), nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (b *writeBenchmark) ingestScrapesShard(lbls []labels.Labels, scrapeCount int, baset int64) (uint64, error) {
|
|
|
|
func (b *writeBenchmark) ingestScrapesShard(lbls []labels.Labels, scrapeCount int, baset int64) (uint64, error) {
|
|
|
|