Alerting: Update scheduler to receive rule updates only from database (#64662)

Alerting: Update scheduler to get updates only from database (#64635)

* stop using the scheduler's Update and Delete methods all communication must be via the database
* update scheduler's registry to calculate diff before re-setting the cache
* update fetcher to return the diff generated by registry
* update processTick to update rule eval routine if the rule was updated and it is not going to be evaluated at this tick.
* remove references to the scheduler from api package
* remove unused methods in the scheduler

(cherry picked from commit 85a954cd81)

# Conflicts:
#	pkg/services/ngalert/api/api_ruler.go
#	pkg/services/ngalert/ngalert.go
#	pkg/services/ngalert/ngalert_test.go
#	pkg/services/ngalert/schedule/schedule.go
#	pkg/services/ngalert/schedule/schedule_mock.go
#	pkg/services/ngalert/schedule/schedule_unit_test.go
This commit is contained in:
Yuri Tseretyan
2023-03-14 18:51:26 -04:00
committed by GitHub
parent f854430ca6
commit 2b00a15709
11 changed files with 191 additions and 290 deletions
-3
View File
@@ -16,7 +16,6 @@ import (
"github.com/grafana/grafana/pkg/services/ngalert/models"
"github.com/grafana/grafana/pkg/services/ngalert/notifier"
"github.com/grafana/grafana/pkg/services/ngalert/provisioning"
"github.com/grafana/grafana/pkg/services/ngalert/schedule"
"github.com/grafana/grafana/pkg/services/ngalert/sender"
"github.com/grafana/grafana/pkg/services/ngalert/state"
"github.com/grafana/grafana/pkg/services/ngalert/store"
@@ -64,7 +63,6 @@ type API struct {
DatasourceService datasources.DataSourceService
RouteRegister routing.RouteRegister
QuotaService quota.Service
Schedule schedule.ScheduleService
TransactionManager provisioning.TransactionManager
ProvenanceStore provisioning.ProvisioningStore
RuleStore RuleStore
@@ -110,7 +108,6 @@ func (api *API) RegisterAPIEndpoints(m *metrics.API) {
&RulerSrv{
conditionValidator: api.EvaluatorFactory,
QuotaService: api.QuotaService,
scheduleService: api.Schedule,
store: api.RuleStore,
provenanceStore: api.ProvenanceStore,
xactManager: api.TransactionManager,