Documentation ¶
Index ¶
- Variables
- func NewEvaluationValues(m map[string]eval.NumberValueCapture) map[string]*float64
- type AlertInstanceManager
- type Evaluation
- type Manager
- func (st *Manager) Close()
- func (st *Manager) Get(orgID int64, alertRuleUID, stateId string) (*State, error)
- func (st *Manager) GetAll(orgID int64) []*State
- func (st *Manager) GetStatesForRuleUID(orgID int64, alertRuleUID string) []*State
- func (st *Manager) ProcessEvalResults(ctx context.Context, alertRule *ngModels.AlertRule, results eval.Results) []*State
- func (st *Manager) Put(states []*State)
- func (st *Manager) RemoveByRuleUID(orgID int64, ruleUID string)
- func (st *Manager) ResetCache()
- func (st *Manager) Warm(ctx context.Context)
- type State
- func (a *State) Equals(b *State) bool
- func (a *State) GetLabels(opts ...ngModels.LabelOption) map[string]string
- func (a *State) GetLastEvaluationValuesForCondition() map[string]float64
- func (a *State) NeedsSending(resendDelay time.Duration) bool
- func (a *State) TrimResults(alertRule *ngModels.AlertRule)
Constants ¶
This section is empty.
Variables ¶
View Source
var ResendDelay = 30 * time.Second
Functions ¶
func NewEvaluationValues ¶
func NewEvaluationValues(m map[string]eval.NumberValueCapture) map[string]*float64
NewEvaluationValues returns the labels and values for each RefID in the capture.
Types ¶
type AlertInstanceManager ¶
type AlertInstanceManager interface { GetAll(orgID int64) []*State GetStatesForRuleUID(orgID int64, alertRuleUID string) []*State }
AlertInstanceManager defines the interface for querying the current alert instances.
type Evaluation ¶
type Evaluation struct { EvaluationTime time.Time EvaluationState eval.State // Values contains the RefID and value of reduce and math expressions. // Classic conditions can have different values for the same RefID as they can include multiple conditions. // For these, we use the index of the condition in addition RefID as the key e.g. "A0, A1, A2, etc.". Values map[string]*float64 // Condition is the refID specified as the condition in the alerting rule at the time of the evaluation. Condition string }
type Manager ¶
func NewManager ¶
func (*Manager) GetStatesForRuleUID ¶
func (*Manager) ProcessEvalResults ¶
func (*Manager) RemoveByRuleUID ¶
RemoveByRuleUID deletes all entries in the state manager that match the given rule UID.
func (*Manager) ResetCache ¶
func (st *Manager) ResetCache()
ResetCache is used to ensure a clean cache on startup.
type State ¶
type State struct { AlertRuleUID string OrgID int64 CacheId string State eval.State Resolved bool Results []Evaluation LastEvaluationString string StartsAt time.Time EndsAt time.Time LastEvaluationTime time.Time EvaluationDuration time.Duration LastSentAt time.Time Annotations map[string]string Labels data.Labels Error error }
func (*State) GetLastEvaluationValuesForCondition ¶
func (*State) TrimResults ¶
Click to show internal directories.
Click to hide internal directories.