cron

package
v0.0.0-...-a9119a5 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2022 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PolyTimeStep           = 30
	CounterTimeStep        = 30
	CounterType            = "COUNTER"
	GAUGEType              = "GAUGE"
	PolyStringSep          = "||"
	MultiPolySep           = "@@"
	RedisLockTimeout       = 55
	MaxQueueSize           = 400000 // 最多的为所有机器的点 不会超过40w
	RedisHMapTimeout       = 60 * 60
	RunPolyInterval        = 60
	PloyMetricStrategyLock = "ploy_metric_strategy_lock"
	EndPolyStrategyHashKey = "end_poly_strategy_hash_key"
	FalconGroupPolyType    = "falcon_group"
	AmsTagPolyType         = "ams_tag"
)
View Source
const (
	SEP = PolyStringSep
)

Variables

View Source
var (
	EndPolyMetricMap            = sync.Map{}
	EndPolyAmsTagMetricMap      = sync.Map{}
	EndPolyFalconGroupMetricMap = sync.Map{}
	PolyWorkerQueueMap          = sync.Map{}
	PolyTypeMap                 = sync.Map{}
	PolyDbConfigMap             = sync.Map{}
	PolyHistoryDataMap          = sync.Map{}
	GroupPolyMethod             = []string{"sum", "avg", "max", "min", "tp50", "tp90", "tp99"}
)

Functions

func AggAllEndMap

func AggAllEndMap()

func AsyncPushKafka

func AsyncPushKafka(polyType, polyName, endpoint, counter, method string, value float64)

func CommonInitQueue

func CommonInitQueue(poly_type string) (map[string][]*model.PolyMetric, int)

func CreatePloyQueueIfNeed

func CreatePloyQueueIfNeed(name string)

func GeneralPolyMethods

func GeneralPolyMethods(Name string, Q *nlist.SafeListLimited)

func InitGroupStrategy

func InitGroupStrategy()

func MultiRunWorker

func MultiRunWorker(gp *GeneralPoly)

func PushToProme

func PushToProme(metric, polyName string, dataMap map[string]float64)

func RenewAmsTagStrategy

func RenewAmsTagStrategy()

更新ams_tag类型的策略

func RenewFalconGroupStrategy

func RenewFalconGroupStrategy()

func RpcCallNumpApi

func RpcCallNumpApi(metric, polyName string, endList []SingleEnd)

func RunAllPoly

func RunAllPoly()

func RunFalconGroupSql

func RunFalconGroupSql(grpName string) (ends []string)

func SyncGroupStrategyFromDb

func SyncGroupStrategyFromDb()

func SyncStrategyToCache

func SyncStrategyToCache()

Types

type GeneralPoly

type GeneralPoly struct {
	Result     chan interface{}
	ArgMap     map[string][]*model.PolyMetric
	MaxWorker  int64
	ActionFunc func(name string, strategys []*model.PolyMetric)
	Type       string
	Num        int
}

func (*GeneralPoly) AmsTagHttpwork

func (this *GeneralPoly) AmsTagHttpwork(name string, strategys []*model.PolyMetric)

func (*GeneralPoly) FalconGroupwork

func (this *GeneralPoly) FalconGroupwork(name string, strategys []*model.PolyMetric)

func (*GeneralPoly) NewWorkPool

func (this *GeneralPoly) NewWorkPool()

type GroupRes

type GroupRes struct {
	Name    string
	Counter string
	Ends    []string
}

type NumpReq

type NumpReq struct {
	Metric    string             `json:"metric"`
	PolyName  string             `json:"poly_name"`
	TimeStamp int64              `json:"time_stamp"`
	ValueDict map[float64]string `json:"value_dict"`
}

type NumpReqNew

type NumpReqNew struct {
	Metric    string      `json:"metric"`
	PolyName  string      `json:"poly_name"`
	TimeStamp int64       `json:"time_stamp"`
	ValueList []SingleEnd `json:"value_list"`
}

type PolyTickerWorker

type PolyTickerWorker struct {
	Queue    *nlist.SafeListLimited
	Name     string
	Ticker   *time.Ticker
	Quit     chan struct{}
	Started  bool
	Interval int
}

func (*PolyTickerWorker) Start

func (this *PolyTickerWorker) Start()

func (*PolyTickerWorker) WorkerRun

func (this *PolyTickerWorker) WorkerRun()

type SingleEnd

type SingleEnd struct {
	Endpoint string  `json:"endpoint"`
	Value    float64 `json:"value"`
}

Jump to

Keyboard shortcuts

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