rules

package
v0.0.0-...-8fd811e Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrRuleSetValidationFailed = errors.New("rule set validation failed")

	ErrMissingRulesMsg                 = "there must be at least 1 rule in a rule set"
	ErrMissingRuleIDMsg                = "rule id cannot be empty"
	ErrMissingNotificationTemplatesMsg = "missing notification templates"
	ErrMissingIgnoreSpecsMsg           = "missing ignore specs"
	ErrActionMissingContentMsg         = "missing action content"
	ErrMissingExprMsg                  = "expression cannot be empty"
	ErrTemplateNotFoundMsg             = "template not found"
	ErrFailedToCompileMsg              = "failed to compile rule"
)

Functions

This section is empty.

Types

type Action

type Action struct {
	*NotifyList `json:"notify,omitempty"`
	*IgnoreList `json:"ignore,omitempty"`
	LogMessage  `json:"log,omitempty"`
}

func (*Action) Clone

func (at *Action) Clone() (clonedAct Action)

func (*Action) GetActType

func (at *Action) GetActType() (actType actions.ActionType)

type ActionList

type ActionList []Action

func (ActionList) Clone

func (al ActionList) Clone() (clonedAL ActionList)

type AlertStatus

type AlertStatus string
const (
	Alerting AlertStatus = "ALERTING"
	Resolved AlertStatus = "RESOLVED"
)

type IgnoreList

type IgnoreList []IgnoreSpec

type IgnoreSpec

type IgnoreSpec string

type LogMessage

type LogMessage string

type NotifyList

type NotifyList []templates.TemplateID

type Problem

type Problem struct {
	ID         ProblemID  `json:"problem_id"`
	RuleID     RuleID     `json:"rule_id"`
	ClientID   string     `json:"client_id"`
	ClientName string     `json:"client_name"`
	Actions    ActionList `json:"actions"`
	Active     bool       `json:"active"`

	CreatedAt  time.Time      `json:"created_at"`
	ResolvedAt types.TimeJSON `json:"resolved_at"`

	CUID string `json:"client_update_id"`
	MUID string `json:"measurement_update_id"`
}

func (*Problem) Clone

func (p *Problem) Clone() (clonedProblem Problem)

type ProblemID

type ProblemID string

type ProblemUpdateRequest

type ProblemUpdateRequest struct {
	Active bool `json:"active"`
}

type Problems

type Problems []Problem

type Rule

type Rule struct {
	ID       RuleID            `json:"id"`
	Severity severity.Severity `json:"severity"`
	Ex       string            `json:"expr"`
	Actions  ActionList        `json:"actions"`
}

func (*Rule) Clone

func (r *Rule) Clone() (clonedRule Rule)

type RuleID

type RuleID string

type RuleSet

type RuleSet struct {
	RuleSetID RuleSetID `json:"id,omitempty"`
	Vars      UserVars  `json:"vars,omitempty"`
	Rules     []Rule    `json:"rules"`
}

type RuleSetID

type RuleSetID string
const (
	DefaultRuleSetID RuleSetID = "default"
)

type State

type State string
const (
	StateUnknown State = "Unknown"
	NotFiring    State = "Not Firing"
	Firing       State = "Firing"
)

type UserVars

type UserVars map[string]any

Jump to

Keyboard shortcuts

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