lib/streamaggr: consistently use alphabetical order of benchmarked stream aggregation outputs

This commit is contained in:
Aliaksandr Valialkin 2024-07-15 09:53:19 +02:00
parent f3ccbe181d
commit 48ec66883a
No known key found for this signature in database
GPG key ID: 52C003EE2BCDB9EB

View file

@ -11,24 +11,24 @@ import (
) )
var benchOutputs = []string{ var benchOutputs = []string{
"total", "avg",
"total_prometheus", "count_samples",
"count_series",
"histogram_bucket",
"increase", "increase",
"increase_prometheus", "increase_prometheus",
"rate_sum",
"rate_avg",
"count_series",
"count_samples",
"unique_samples",
"sum_samples",
"last", "last",
"min",
"max", "max",
"avg", "min",
"quantiles(0, 0.5, 1)",
"rate_avg",
"rate_sum",
"stddev", "stddev",
"stdvar", "stdvar",
"histogram_bucket", "sum_samples",
"quantiles(0, 0.5, 1)", "total",
"total_prometheus",
"unique_samples",
} }
func BenchmarkAggregatorsPush(b *testing.B) { func BenchmarkAggregatorsPush(b *testing.B) {
@ -40,19 +40,14 @@ func BenchmarkAggregatorsPush(b *testing.B) {
} }
func BenchmarkAggregatorsFlushSerial(b *testing.B) { func BenchmarkAggregatorsFlushSerial(b *testing.B) {
outputs := []string{
"total", "sum_samples", "count_samples", "min",
"max", "avg", "increase", "count_series",
"last", "stddev", "stdvar", "total_prometheus", "increase_prometheus",
}
pushFunc := func(_ []prompbmarshal.TimeSeries) {} pushFunc := func(_ []prompbmarshal.TimeSeries) {}
a := newBenchAggregators(outputs, pushFunc) a := newBenchAggregators(benchOutputs, pushFunc)
defer a.MustStop() defer a.MustStop()
_ = a.Push(benchSeries, nil) _ = a.Push(benchSeries, nil)
b.ResetTimer() b.ResetTimer()
b.ReportAllocs() b.ReportAllocs()
b.SetBytes(int64(len(benchSeries) * len(outputs))) b.SetBytes(int64(len(benchSeries) * len(benchOutputs)))
for i := 0; i < b.N; i++ { for i := 0; i < b.N; i++ {
for _, aggr := range a.as { for _, aggr := range a.as {
aggr.flush(pushFunc, time.Hour, false) aggr.flush(pushFunc, time.Hour, false)