alert

package
v0.0.0-...-2ded02f Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2017 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var HistoryBigMap = make(map[string]*JudgeItemMap)

这是个线程不安全的大Map,需要提前初始化好

View Source
var RedisConnPool *redis.Pool

Functions

func Alerter

func Alerter(in <-chan string)

func InitAlert

func InitAlert()

func InitHistoryBigMap

func InitHistoryBigMap()

func InitRedisConnPool

func InitRedisConnPool(url string)

func PingRedis

func PingRedis(c redis.Conn, t time.Time) error

Types

type AlertConfig

type AlertConfig struct {
	Enabled   bool
	RuleDB    string
	RedisHost string
}

type AllFunction

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

func (AllFunction) Compute

func (this AllFunction) Compute(L *SafeLinkedList) (isTriggered bool)

type Function

type Function interface {
	Compute(L *SafeLinkedList) (isTriggered bool)
}

func ParseFuncFromString

func ParseFuncFromString(str string, operator string, rightValue float64) (fn Function, err error)

@str: e.g. all(#3) sum(#3) avg(#10) diff(#10)

type JudgeItemMap

type JudgeItemMap struct {
	sync.RWMutex
	M map[string]*SafeLinkedList
}

func NewJudgeItemMap

func NewJudgeItemMap() *JudgeItemMap

func (*JudgeItemMap) BatchDelete

func (this *JudgeItemMap) BatchDelete(keys []string)

func (*JudgeItemMap) CleanStale

func (this *JudgeItemMap) CleanStale(before int64)

func (*JudgeItemMap) Delete

func (this *JudgeItemMap) Delete(key string)

func (*JudgeItemMap) Get

func (this *JudgeItemMap) Get(key string) (*SafeLinkedList, bool)

func (*JudgeItemMap) Len

func (this *JudgeItemMap) Len() int

func (*JudgeItemMap) PushFrontAndMaintain

func (this *JudgeItemMap) PushFrontAndMaintain(key string, val *model.MetricValue, maxCount int, now int64)

func (*JudgeItemMap) Set

func (this *JudgeItemMap) Set(key string, val *SafeLinkedList)

type SafeLinkedList

type SafeLinkedList struct {
	sync.RWMutex
	L *list.List
}

func (*SafeLinkedList) Elem

func (this *SafeLinkedList) Elem(offset int) *list.Element

func (*SafeLinkedList) Front

func (this *SafeLinkedList) Front() *list.Element

func (*SafeLinkedList) Len

func (this *SafeLinkedList) Len() int

func (*SafeLinkedList) PushFront

func (this *SafeLinkedList) PushFront(v interface{}) *list.Element

func (*SafeLinkedList) PushFrontAndMaintain

func (this *SafeLinkedList) PushFrontAndMaintain(v *model.MetricValue, maxCount int) bool

@return needJudge 如果是false不需要做judge,因为新上来的数据不合法

func (*SafeLinkedList) ToSlice

func (this *SafeLinkedList) ToSlice() []*model.MetricValue

func (*SafeLinkedList) Values

func (this *SafeLinkedList) Values() []float64

Jump to

Keyboard shortcuts

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