rule

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UpdateRuleInterval        = 30 * time.Second
	MaxDelayForUpdateRuleTime = 10 * time.Minute
)
View Source
const (
	AlarmTypeHeartBeat = iota
	AlarmTypeThreshold
	AlarmTypeTopN
	AlarmTypeCompare
)
View Source
const (
	CompareTypeDifference = iota
	CompareTypeRatio
)
View Source
const (
	UpdateCurvesInterval = 600
	AlarmQueryDelay      = 10 // the end of query time range is 10 seconds ago
)
View Source
const MaxCompareDays = 7
View Source
const MaxTopNLimit = 100

Variables

This section is empty.

Functions

This section is empty.

Types

type AlarmDataSource

type AlarmDataSource struct {
	Metric         string            `json:"metric"`
	Tags           map[string]string `json:"tags"`
	DownSample     int64             `json:"down_sample"`
	Aggregation    string            `json:"aggregation"`
	Sort           string            `json:"sort"`             // use for topN rule only
	Limit          int               `json:"limit"`            // use for topN rule only
	CompareType    int               `json:"compare_type"`     // use for compare rule only
	CompareDaysAgo int               `json:"compare_days_ago"` // use for compare rule only
	CompareSeconds int               `json:"compare_seconds"`  // use for compare rule only
}

type AlarmRule

type AlarmRule struct {
	dbmodel.AlarmRule
	// contains filtered or unexported fields
}

func (*AlarmRule) GetAlarmRule

func (r *AlarmRule) GetAlarmRule() dbmodel.AlarmRule

func (*AlarmRule) Parse

func (r *AlarmRule) Parse() error

func (*AlarmRule) Stop

func (r *AlarmRule) Stop()

type AlarmTrigger

type AlarmTrigger struct {
	ErrorCount  int     `json:"error_count"`
	LessThan    float64 `json:"less_than"`
	GreaterThan float64 `json:"greater_than"`
}

type BaseRule

type BaseRule interface {
	GetAlarmRule() dbmodel.AlarmRule
	Parse() error
	Start()
	Stop()
	Run()
}

type CompareRule

type CompareRule struct {
	AlarmRule
	// contains filtered or unexported fields
}

func (*CompareRule) Parse

func (r *CompareRule) Parse() error

func (*CompareRule) Run

func (r *CompareRule) Run()

func (*CompareRule) Start

func (r *CompareRule) Start()

type HeartBeatRule

type HeartBeatRule struct {
	AlarmRule
	// contains filtered or unexported fields
}

func (*HeartBeatRule) Parse

func (r *HeartBeatRule) Parse() error

func (*HeartBeatRule) Run

func (r *HeartBeatRule) Run()

func (*HeartBeatRule) Start

func (r *HeartBeatRule) Start()

type Manager

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

func NewManager

func NewManager() *Manager

func (*Manager) Start

func (m *Manager) Start() error

type ThresholdRule

type ThresholdRule struct {
	AlarmRule
	// contains filtered or unexported fields
}

func (*ThresholdRule) Parse

func (r *ThresholdRule) Parse() error

func (*ThresholdRule) Run

func (r *ThresholdRule) Run()

func (*ThresholdRule) Start

func (r *ThresholdRule) Start()

type TopNRule

type TopNRule struct {
	AlarmRule
}

func (*TopNRule) Parse

func (r *TopNRule) Parse() error

func (*TopNRule) Run

func (r *TopNRule) Run()

func (*TopNRule) Start

func (r *TopNRule) Start()

Jump to

Keyboard shortcuts

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