judge

package
v0.0.0-...-b6b44b4 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2020 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	EVENT_ALERT   = "alert"
	EVENT_RECOVER = "recovery"
)

Functions

func AsyncJudge

func AsyncJudge(sema *semaphore.Semaphore, stra *model.Stra, exps []model.Exp, historyData []*dataobj.HistoryData, firstItem *dataobj.JudgeItem, now int64, history []dataobj.History, info string, value string, extra string, status []bool)

func GetData

func GetData(stra *model.Stra, exp model.Exp, firstItem *dataobj.JudgeItem, now int64, sameTag bool) ([]*dataobj.TsdbQueryResponse, error)

func GetReqs

func GetReqs(stra *model.Stra, metric string, endpoints []string, now int64) []*dataobj.QueryData

func GetStra

func GetStra(sid int64) (*model.Stra, bool)

func Judge

func Judge(stra *model.Stra, exps []model.Exp, historyData []*dataobj.HistoryData, firstItem *dataobj.JudgeItem, now int64, history []dataobj.History, info string, value string, extra string, status []bool)

func NodataJudge

func NodataJudge(concurrency int)

func ToJudge

func ToJudge(historyMap *cache.JudgeItemMap, key string, val *dataobj.JudgeItem, now int64)

Types

type AllFunction

type AllFunction struct {
	Function
	Limit      int
	Operator   string
	RightValue float64
}

func (AllFunction) Compute

func (f AllFunction) Compute(vs []*dataobj.HistoryData) (leftValue dataobj.JsonFloat, isTriggered bool)

type AvgFunction

type AvgFunction struct {
	Function
	Limit      int
	Operator   string
	RightValue float64
}

func (AvgFunction) Compute

func (f AvgFunction) Compute(vs []*dataobj.HistoryData) (leftValue dataobj.JsonFloat, isTriggered bool)

type CAvgAbsFunction

type CAvgAbsFunction struct {
	Function
	Limit        int
	Operator     string
	RightValue   float64
	CompareValue float64
}

func (CAvgAbsFunction) Compute

func (f CAvgAbsFunction) Compute(vs []*dataobj.HistoryData) (leftValue dataobj.JsonFloat, isTriggered bool)

type CAvgFunction

type CAvgFunction struct {
	Function
	Limit        int
	Operator     string
	RightValue   float64
	CompareValue float64
}

func (CAvgFunction) Compute

func (f CAvgFunction) Compute(vs []*dataobj.HistoryData) (leftValue dataobj.JsonFloat, isTriggered bool)

type CAvgRateAbsFunction

type CAvgRateAbsFunction struct {
	Function
	Limit        int
	Operator     string
	RightValue   float64
	CompareValue float64
}

func (CAvgRateAbsFunction) Compute

func (f CAvgRateAbsFunction) Compute(vs []*dataobj.HistoryData) (leftValue dataobj.JsonFloat, isTriggered bool)

type CAvgRateFunction

type CAvgRateFunction struct {
	Function
	Limit        int
	Operator     string
	RightValue   float64
	CompareValue float64
}

func (CAvgRateFunction) Compute

func (f CAvgRateFunction) Compute(vs []*dataobj.HistoryData) (leftValue dataobj.JsonFloat, isTriggered bool)

type DiffFunction

type DiffFunction struct {
	Function
	Limit      int
	Operator   string
	RightValue float64
}

func (DiffFunction) Compute

func (f DiffFunction) Compute(vs []*dataobj.HistoryData) (leftValue dataobj.JsonFloat, isTriggered bool)

只要有一个点的diff触发阈值,就报警

type Function

type Function interface {
	Compute(vs []*dataobj.HistoryData) (leftValue dataobj.JsonFloat, isTriggered bool)
}

func ParseFuncFromString

func ParseFuncFromString(str string, span []interface{}, operator string, rightValue float64) (fn Function, err error)

type HappenFunction

type HappenFunction struct {
	Function
	Num        int
	Limit      int
	Operator   string
	RightValue float64
}

func (HappenFunction) Compute

func (f HappenFunction) Compute(vs []*dataobj.HistoryData) (leftValue dataobj.JsonFloat, isTriggered bool)

type MaxFunction

type MaxFunction struct {
	Function
	Limit      int
	Operator   string
	RightValue float64
}

func (MaxFunction) Compute

func (f MaxFunction) Compute(vs []*dataobj.HistoryData) (leftValue dataobj.JsonFloat, isTriggered bool)

type MinFunction

type MinFunction struct {
	Function
	Limit      int
	Operator   string
	RightValue float64
}

func (MinFunction) Compute

func (f MinFunction) Compute(vs []*dataobj.HistoryData) (leftValue dataobj.JsonFloat, isTriggered bool)

type NodataFunction

type NodataFunction struct {
	Function
}

func (NodataFunction) Compute

func (f NodataFunction) Compute(vs []*dataobj.HistoryData) (leftValue dataobj.JsonFloat, isTriggered bool)

type PDiffFunction

type PDiffFunction struct {
	Function
	Limit      int
	Operator   string
	RightValue float64
}

pdiff(#3)

func (PDiffFunction) Compute

func (f PDiffFunction) Compute(vs []*dataobj.HistoryData) (leftValue dataobj.JsonFloat, isTriggered bool)

type SumFunction

type SumFunction struct {
	Function
	Limit      int
	Operator   string
	RightValue float64
}

func (SumFunction) Compute

func (f SumFunction) Compute(vs []*dataobj.HistoryData) (leftValue dataobj.JsonFloat, isTriggered bool)

Jump to

Keyboard shortcuts

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