engine

package
v5.11.2 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2022 License: Apache-2.0 Imports: 41 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EventQueue = list.NewSafeListLimited(10000000)
View Source
var RuleEvalForExternal = RuleEvalForExternalType{/* contains filtered or unexported fields */}
View Source
var Workers = &WorkersType{rules: make(map[string]*RuleEval), recordRules: make(map[string]RecordingRuleEval)}

Functions

func IsMuted added in v5.9.7

func IsMuted(event *models.AlertCurEvent, clock ...int64) bool

如果传入了clock这个可选参数,就表示使用这个clock表示的时间,否则就从event的字段中取TriggerTime

func LogEvent added in v5.8.0

func LogEvent(event *models.AlertCurEvent, location string, err ...error)

func Reload added in v5.11.0

func Reload()

func Report added in v5.11.0

func Report(errorType ErrorType)

func Start

func Start(ctx context.Context) error

func StringSetKeys added in v5.4.0

func StringSetKeys(m map[string]struct{}) []string

Types

type AlertCurEventMap added in v5.11.0

type AlertCurEventMap struct {
	sync.RWMutex
	Data map[string]*models.AlertCurEvent
}

func NewAlertCurEventMap added in v5.11.0

func NewAlertCurEventMap() *AlertCurEventMap

func (*AlertCurEventMap) Delete added in v5.11.0

func (a *AlertCurEventMap) Delete(key string)

func (*AlertCurEventMap) Get added in v5.11.0

func (*AlertCurEventMap) GetAll added in v5.11.0

func (a *AlertCurEventMap) GetAll() map[string]*models.AlertCurEvent

func (*AlertCurEventMap) Keys added in v5.11.0

func (a *AlertCurEventMap) Keys() []string

func (*AlertCurEventMap) Set added in v5.11.0

func (a *AlertCurEventMap) Set(key string, value *models.AlertCurEvent)

func (*AlertCurEventMap) SetAll added in v5.11.0

func (a *AlertCurEventMap) SetAll(data map[string]*models.AlertCurEvent)

func (*AlertCurEventMap) UpdateLastEvalTime added in v5.11.0

func (a *AlertCurEventMap) UpdateLastEvalTime(key string, lastEvalTime int64)

type ErrorType added in v5.11.0

type ErrorType string
const (
	QueryPrometheusError ErrorType = "QueryPrometheusError"
	RuntimeError         ErrorType = "RuntimeError"
)

register new error here

type MaintainMessage added in v5.9.7

type MaintainMessage struct {
	Tos     []*models.User `json:"tos"`
	Title   string         `json:"title"`
	Content string         `json:"content"`
}

type Notice

type Notice struct {
	Event *models.AlertCurEvent `json:"event"`
	Tpls  map[string]string     `json:"tpls"`
}

type RecordingRuleEval added in v5.9.5

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

func (RecordingRuleEval) RuleID added in v5.9.5

func (r RecordingRuleEval) RuleID() int64

func (RecordingRuleEval) Start added in v5.9.5

func (r RecordingRuleEval) Start()

func (RecordingRuleEval) Stop added in v5.9.5

func (r RecordingRuleEval) Stop()

func (RecordingRuleEval) Work added in v5.9.5

func (r RecordingRuleEval) Work()

type RuleEval

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

func (*RuleEval) Judge added in v5.11.0

func (r *RuleEval) Judge(clusterName string, vectors []conv.Vector)

func (*RuleEval) MakeNewEvent added in v5.11.0

func (r *RuleEval) MakeNewEvent(from string, now int64, clusterName string, vectors []conv.Vector) (map[string]struct{}, bool)

func (*RuleEval) RecoverEvent added in v5.11.0

func (r *RuleEval) RecoverEvent(hash string, now int64, value float64)

func (*RuleEval) RuleID

func (r *RuleEval) RuleID() int64

func (*RuleEval) Start

func (r *RuleEval) Start()

func (*RuleEval) Stop

func (r *RuleEval) Stop()

func (*RuleEval) Work

func (r *RuleEval) Work()

type RuleEvalForExternalType added in v5.11.0

type RuleEvalForExternalType struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func (*RuleEvalForExternalType) Build added in v5.11.0

func (re *RuleEvalForExternalType) Build()

func (*RuleEvalForExternalType) Get added in v5.11.0

func (re *RuleEvalForExternalType) Get(rid int64) (RuleEval, bool)

type TaskCreateReply

type TaskCreateReply struct {
	Err string `json:"err"`
	Dat int64  `json:"dat"` // task.id
}

type TaskForm

type TaskForm struct {
	Title     string   `json:"title"`
	Account   string   `json:"account"`
	Batch     int      `json:"batch"`
	Tolerance int      `json:"tolerance"`
	Timeout   int      `json:"timeout"`
	Pause     string   `json:"pause"`
	Script    string   `json:"script"`
	Args      string   `json:"args"`
	Action    string   `json:"action"`
	Creator   string   `json:"creator"`
	Hosts     []string `json:"hosts"`
}

type WorkersType

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

func (*WorkersType) Build

func (ws *WorkersType) Build(rids []int64)

func (*WorkersType) BuildRe added in v5.9.5

func (ws *WorkersType) BuildRe(rids []int64)

Jump to

Keyboard shortcuts

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