Documentation ¶
Index ¶
- Constants
- func FromAlertStateToPostableAlerts(firingStates []*state.State, stateManager *state.Manager, appURL *url.URL) apimodels.PostableAlerts
- func FromAlertsStateToStoppedAlert(firingStates []*state.State, appURL *url.URL, clock clock.Clock) apimodels.PostableAlerts
- func NewScheduler(cfg SchedulerCfg, expressionService *expr.Service, appURL *url.URL, ...) *schedule
- type FakeScheduleService
- func (_m *FakeScheduleService) AlertmanagersFor(orgID int64) []*url.URL
- func (_m *FakeScheduleService) DeleteAlertRule(key models.AlertRuleKey)
- func (_m *FakeScheduleService) DroppedAlertmanagersFor(orgID int64) []*url.URL
- func (_m *FakeScheduleService) Pause() error
- func (_m *FakeScheduleService) Run(_a0 context.Context) error
- func (_m *FakeScheduleService) Unpause() error
- func (_m *FakeScheduleService) UpdateAlertRule(key models.AlertRuleKey)
- type ScheduleService
- type SchedulerCfg
Constants ¶
const ( NoDataAlertName = "DatasourceNoData" ErrorAlertName = "DatasourceError" Rulename = "rulename" )
Variables ¶
This section is empty.
Functions ¶
func FromAlertsStateToStoppedAlert ¶
func FromAlertsStateToStoppedAlert(firingStates []*state.State, appURL *url.URL, clock clock.Clock) apimodels.PostableAlerts
FromAlertsStateToStoppedAlert converts firingStates that have evaluation state either eval.Alerting or eval.NoData or eval.Error to models.PostableAlert that are accepted by notifiers. Returns a list of alert instances that have expiration time.Now
func NewScheduler ¶
func NewScheduler(cfg SchedulerCfg, expressionService *expr.Service, appURL *url.URL, stateManager *state.Manager) *schedule
NewScheduler returns a new schedule.
Types ¶
type FakeScheduleService ¶
FakeScheduleService is an autogenerated mock type for the ScheduleService type
func (*FakeScheduleService) AlertmanagersFor ¶
func (_m *FakeScheduleService) AlertmanagersFor(orgID int64) []*url.URL
AlertmanagersFor provides a mock function with given fields: orgID
func (*FakeScheduleService) DeleteAlertRule ¶
func (_m *FakeScheduleService) DeleteAlertRule(key models.AlertRuleKey)
DeleteAlertRule provides a mock function with given fields: key
func (*FakeScheduleService) DroppedAlertmanagersFor ¶
func (_m *FakeScheduleService) DroppedAlertmanagersFor(orgID int64) []*url.URL
DroppedAlertmanagersFor provides a mock function with given fields: orgID
func (*FakeScheduleService) Pause ¶
func (_m *FakeScheduleService) Pause() error
Pause provides a mock function with given fields:
func (*FakeScheduleService) Run ¶
func (_m *FakeScheduleService) Run(_a0 context.Context) error
Run provides a mock function with given fields: _a0
func (*FakeScheduleService) Unpause ¶
func (_m *FakeScheduleService) Unpause() error
Unpause provides a mock function with given fields:
func (*FakeScheduleService) UpdateAlertRule ¶
func (_m *FakeScheduleService) UpdateAlertRule(key models.AlertRuleKey)
UpdateAlertRule provides a mock function with given fields: key
type ScheduleService ¶
type ScheduleService interface { // Run the scheduler until the context is canceled or the scheduler returns // an error. The scheduler is terminated when this function returns. Run(context.Context) error Pause() error Unpause() error // AlertmanagersFor returns all the discovered Alertmanager URLs for the // organization. AlertmanagersFor(orgID int64) []*url.URL // DroppedAlertmanagersFor returns all the dropped Alertmanager URLs for the // organization. DroppedAlertmanagersFor(orgID int64) []*url.URL // UpdateAlertRule notifies scheduler that a rule has been changed UpdateAlertRule(key models.AlertRuleKey) // DeleteAlertRule notifies scheduler that a rule has been changed DeleteAlertRule(key models.AlertRuleKey) // contains filtered or unexported methods }
ScheduleService is an interface for a service that schedules the evaluation of alert rules.
type SchedulerCfg ¶
type SchedulerCfg struct { C clock.Clock BaseInterval time.Duration Logger log.Logger EvalAppliedFunc func(models.AlertRuleKey, time.Time) MaxAttempts int64 StopAppliedFunc func(models.AlertRuleKey) Evaluator eval.Evaluator RuleStore store.RuleStore OrgStore store.OrgStore InstanceStore store.InstanceStore AdminConfigStore store.AdminConfigurationStore MultiOrgNotifier *notifier.MultiOrgAlertmanager Metrics *metrics.Scheduler AdminConfigPollInterval time.Duration DisabledOrgs map[int64]struct{} MinRuleInterval time.Duration }
SchedulerCfg is the scheduler configuration.