Alerting: Introduce alert rule models in storage (#93187)
* introduce storage model for alert rule tables * remove AlertRuleVersion from models because it's not used anywhere other than in storage * update historian xorm store to use alerting store to fetch rules * fix folder tests --------- Co-authored-by: Matthew Jacobson <matthew.jacobson@grafana.com>
This commit is contained in:
co-authored by
Matthew Jacobson
parent
0a976f831c
commit
f8fa5286a1
@@ -5,6 +5,7 @@ import (
|
||||
|
||||
"github.com/grafana/grafana/pkg/services/annotations/accesscontrol"
|
||||
"github.com/grafana/grafana/pkg/services/annotations/annotationsimpl/loki"
|
||||
alertingStore "github.com/grafana/grafana/pkg/services/ngalert/store"
|
||||
|
||||
"github.com/grafana/grafana/pkg/infra/db"
|
||||
"github.com/grafana/grafana/pkg/infra/log"
|
||||
@@ -29,6 +30,7 @@ func ProvideService(
|
||||
features featuremgmt.FeatureToggles,
|
||||
tagService tag.Service,
|
||||
tracer tracing.Tracer,
|
||||
ruleStore *alertingStore.DBstore,
|
||||
) *RepositoryImpl {
|
||||
l := log.New("annotations")
|
||||
l.Debug("Initializing annotations service")
|
||||
@@ -37,7 +39,7 @@ func ProvideService(
|
||||
write := xormStore
|
||||
|
||||
var read readStore
|
||||
historianStore := loki.NewLokiHistorianStore(cfg.UnifiedAlerting.StateHistory, features, db, log.New("annotations.loki"), tracer)
|
||||
historianStore := loki.NewLokiHistorianStore(cfg.UnifiedAlerting.StateHistory, features, db, ruleStore, log.New("annotations.loki"), tracer)
|
||||
if historianStore != nil {
|
||||
l.Debug("Using composite read store")
|
||||
read = NewCompositeStore(log.New("annotations.composite"), xormStore, historianStore)
|
||||
|
||||
Reference in New Issue
Block a user