rules

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromPath

func FromPath(path, region string) (*fileStore, error)

Types

type Rule

type Rule struct {
	Version           string
	Namespace         string
	Name              string
	Database          string
	Interval          time.Duration
	Query             string
	AutoMitigateAfter time.Duration
	Destination       string

	// Criteria is a map of key-value pairs that are used to determine where an alert can execute.
	Criteria map[string][]string
	// CriteriaExpression is an optional CEL expression used for richer execution control.
	CriteriaExpression string

	// Management queries (starts with a dot) have to call a different
	// query API in the Kusto Go SDK.
	IsMgmtQuery bool

	// Stmt specifies the underlayEtcdPeersQuery to execute.
	Stmt kusto.Stmt

	// LastQueryTime from the AlertRule status, used for smart scheduling
	LastQueryTime time.Time
}

Rule is analogous to a kusto-to-metric configuration, containing definitions and using the parlance found in the k2m UI.

func (*Rule) Matches added in v0.2.0

func (r *Rule) Matches(tags map[string]string) (bool, error)

Matches evaluates whether this rule should execute based on simple Criteria AND the CEL CriteriaExpression. It returns true if both the map criteria matches and the expression evaluates to true. Errors are returned for invalid criteria keys (referencing tags that don't exist) or CEL compilation issues.

type Store

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

func NewStore

func NewStore(opts StoreOpts) *Store

func (*Store) Close

func (s *Store) Close() error

func (*Store) Open

func (s *Store) Open(ctx context.Context) error

func (*Store) Register

func (s *Store) Register(rule *Rule)

func (*Store) Rules

func (s *Store) Rules() []*Rule

type StoreOpts

type StoreOpts struct {
	Region  string
	CtrlCli client.Client
}

Jump to

Keyboard shortcuts

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