schedule

package
v0.0.0-...-fb7f86c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 18, 2023 License: AGPL-3.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewScheduler

func NewScheduler(cfg SchedulerCfg, stateManager *state.Manager) *schedule

NewScheduler returns a new schedule.

func SchedulerUserFor

func SchedulerUserFor(orgID int64) *user.SignedInUser

Types

type AlertsSender

type AlertsSender interface {
	Send(key ngmodels.AlertRuleKey, alerts definitions.PostableAlerts)
}

AlertsSender is an interface for a service that is responsible for sending notifications to the end-user.

type AlertsSenderMock

type AlertsSenderMock struct {
	mock.Mock
}

AlertsSenderMock is an autogenerated mock type for the AlertsSender type

func (*AlertsSenderMock) EXPECT

func (*AlertsSenderMock) Send

Send provides a mock function with given fields: key, alerts

type AlertsSenderMock_Expecter

type AlertsSenderMock_Expecter struct {
	// contains filtered or unexported fields
}

func (*AlertsSenderMock_Expecter) Send

func (_e *AlertsSenderMock_Expecter) Send(key interface{}, alerts interface{}) *AlertsSenderMock_Send_Call

Send is a helper method to define mock.On call

  • key models.AlertRuleKey
  • alerts definitions.PostableAlerts

type AlertsSenderMock_Send_Call

type AlertsSenderMock_Send_Call struct {
	*mock.Call
}

AlertsSenderMock_Send_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Send'

func (*AlertsSenderMock_Send_Call) Return

func (*AlertsSenderMock_Send_Call) Run

type RulesStore

type RulesStore interface {
	GetAlertRulesKeysForScheduling(ctx context.Context) ([]ngmodels.AlertRuleKeyWithVersion, error)
	GetAlertRulesForScheduling(ctx context.Context, query *ngmodels.GetAlertRulesForSchedulingQuery) error
}

RulesStore is a store that provides alert rules for scheduling

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
}

ScheduleService is an interface for a service that schedules the evaluation of alert rules.

type SchedulerCfg

type SchedulerCfg struct {
	MaxAttempts          int64
	BaseInterval         time.Duration
	C                    clock.Clock
	MinRuleInterval      time.Duration
	DisableGrafanaFolder bool
	AppURL               *url.URL
	EvaluatorFactory     eval.EvaluatorFactory
	RuleStore            RulesStore
	Metrics              *metrics.Scheduler
	AlertSender          AlertsSender
	Tracer               tracing.Tracer
}

SchedulerCfg is the scheduler configuration.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL