Fix up CI errors from benchmark

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
This commit is contained in:
Bryan Boreham 2024-12-12 14:15:55 +00:00
parent 994b26d977
commit 7a191b9432

View file

@ -15,14 +15,13 @@ package promql
import ( import (
"context" "context"
"github.com/go-kit/log"
"github.com/go-kit/log/level"
"github.com/prometheus/prometheus/tsdb"
"go.opentelemetry.io/otel"
"os"
"runtime" "runtime"
"testing" "testing"
"time" "time"
"github.com/prometheus/common/promslog"
"github.com/prometheus/prometheus/tsdb"
"go.opentelemetry.io/otel"
) )
func BenchmarkCountSingleInstance(b *testing.B) { func BenchmarkCountSingleInstance(b *testing.B) {
@ -42,11 +41,9 @@ func BenchmarkCountAllOver1h(b *testing.B) {
} }
func benchmarkQuery(query string, b *testing.B) { func benchmarkQuery(query string, b *testing.B) {
// Open a TSDB for reading and/or writing. l := promslog.NewNopLogger()
l := log.NewLogfmtLogger(log.NewSyncWriter(os.Stderr))
l = level.NewFilter(l, level.AllowError())
// TSDB contains a single production block, containing a high cardinality series (~150K) // TSDB contains a single production block, containing a high cardinality series (~150K)
db, err := tsdb.Open("/temp/test-tsdb", l, nil, tsdb.DefaultOptions(), nil) db, err := tsdb.Open("/temp/test-tsdb", nil, nil, tsdb.DefaultOptions(), nil)
noErr(err) noErr(err)
// Create engine for querying // Create engine for querying
@ -76,7 +73,6 @@ func benchmarkQuery(query string, b *testing.B) {
var memstats runtime.MemStats var memstats runtime.MemStats
runtime.ReadMemStats(&memstats) runtime.ReadMemStats(&memstats)
memstats.Sys
b.ReportMetric(float64(memstats.Sys), "sys_memory") b.ReportMetric(float64(memstats.Sys), "sys_memory")
// Clean up any last resources when done. // Clean up any last resources when done.