Files
signoz/pkg/prometheus/engine.go
Jatinderjit Singh 0865d2edaf
Some checks failed
build-staging / prepare (push) Has been cancelled
build-staging / js-build (push) Has been cancelled
build-staging / go-build (push) Has been cancelled
build-staging / staging (push) Has been cancelled
Release Drafter / update_release_draft (push) Has been cancelled
fix: add support for minimum data points in PromQL alerts (#9975)
2026-01-21 16:00:30 +05:30

29 lines
661 B
Go

package prometheus
import (
"log/slog"
"time"
"github.com/prometheus/prometheus/promql"
)
func NewEngine(logger *slog.Logger, cfg Config) *Engine {
var activeQueryTracker promql.QueryTracker
if cfg.ActiveQueryTrackerConfig.Enabled {
activeQueryTracker = promql.NewActiveQueryTracker(
cfg.ActiveQueryTrackerConfig.Path,
cfg.ActiveQueryTrackerConfig.MaxConcurrent,
logger,
)
}
return promql.NewEngine(promql.EngineOpts{
Logger: logger,
Reg: nil,
MaxSamples: 5_0000_000,
Timeout: 2 * time.Minute,
ActiveQueryTracker: activeQueryTracker,
LookbackDelta: cfg.LookbackDelta,
})
}