Documentation
¶
Index ¶
- Constants
- Variables
- func Audit(actorID int, action string, resourceID int64, outcome string, details any)
- func DeleteRule(id int64) error
- func DueRules(now int64, limit int) ([]*model.MetricAlertRule, error)
- func ErrorMessage(err error) string
- func TouchNextRun(ruleID int64, now int64, interval int64) error
- type ConditionInput
- type EvaluationResult
- type MetricDefinition
- type RuleInput
- type RuleView
Constants ¶
View Source
const ( ScopePerInstance = "per_instance" ScopeAggregate = "aggregate" MatchAll = "all" MatchAny = "any" ReminderOnce = "once" ReminderInterval = "repeat_interval" )
Variables ¶
View Source
var ( ErrInvalidInput = errors.New("invalid metric alert input") ErrNotFound = errors.New("metric alert rule not found") )
Functions ¶
func DeleteRule ¶
func ErrorMessage ¶
Types ¶
type ConditionInput ¶
type EvaluationResult ¶
type EvaluationResult struct {
RuleID int64 `json:"rule_id"`
Scopes int `json:"scopes"`
Triggered int `json:"triggered"`
Recovered int `json:"recovered"`
Values map[string]float64 `json:"values,omitempty"`
}
func EvaluateRule ¶
func EvaluateRule(ctx context.Context, ruleID int64) (*EvaluationResult, error)
type MetricDefinition ¶
type MetricDefinition struct {
Key string `json:"key"`
Label string `json:"label"`
Unit string `json:"unit"`
Kinds []string `json:"kinds"`
Aggregatable bool `json:"aggregatable"`
}
func Capabilities ¶
func Capabilities(instanceIDs []int64, scopeMode string, access ...*authz.DataAccess) ([]MetricDefinition, error)
func MetricDefinitions ¶
func MetricDefinitions() []MetricDefinition
type RuleInput ¶
type RuleInput struct {
Name string `json:"name"`
Description string `json:"description"`
Enabled bool `json:"enabled"`
ScopeMode string `json:"scope_mode"`
MatchMode string `json:"match_mode"`
EvaluationIntervalSeconds int64 `json:"evaluation_interval_seconds"`
TriggerCount int `json:"trigger_count"`
RecoveryCount int `json:"recovery_count"`
FailureThreshold int `json:"failure_threshold"`
ReminderMode string `json:"reminder_mode"`
RepeatIntervalSeconds int64 `json:"repeat_interval_seconds"`
Recipients []string `json:"recipients"`
InstanceIDs []int64 `json:"instance_ids"`
Conditions []ConditionInput `json:"conditions"`
}
type RuleView ¶
type RuleView struct {
model.MetricAlertRule
Recipients []string `json:"recipients"`
InstanceIDs []int64 `json:"instance_ids"`
Conditions []*model.MetricAlertCondition `json:"conditions"`
States []*model.MetricAlertState `json:"states"`
}
Click to show internal directories.
Click to hide internal directories.