Documentation ¶
Index ¶
- Constants
- Variables
- func CheckNeedJudge(hostname, metric string) (filterSS []*model.Strategy)
- func GetOneStrategy(hostname string) []*model.Strategy
- func GetOneUnionStrategy(id int) []*model.Strategy
- func InitHbsClient()
- func InitRedisCluster()
- func InitRedisConnPool()
- func InitUnionJudgeClientAndRing()
- func JudgeHostStrategies(hostname string) []*model.Strategy
- func ParseConfig(cfg string)
- func PingRedis(c redis.Conn, t time.Time) error
- type AlarmConfig
- type GlobalConfig
- type HbsConfig
- type HttpConfig
- type RedisConfig
- type RpcConfig
- type SafeEventMap
- type SafeExpressionMap
- type SafeFilterMap
- type SafeStrategyMap
- type SafeUnionStrategies
- type SingleConnRpcClient
- type UnionJudge
Constants ¶
View Source
const SEP = "|||"
View Source
const TIMEOUT = 60 * 20
View Source
const (
VERSION = "2.0.2"
)
change log 2.0.1: bugfix HistoryData limit 2.0.2: clean stale data
Variables ¶
View Source
var ( GlobalCacheTtl = 60 * 2 * time.Second HostSSCache = cache.New(GlobalCacheTtl, GlobalCacheTtl) )
View Source
var ( HbsClient *SingleConnRpcClient JudgeNodeRing *rings.ConsistentHashNodeRing StrategyMap = &SafeStrategyMap{M: make(map[string][]model.Strategy)} UnionStrategyMap = &SafeUnionStrategies{M: make(map[int][]*model.Strategy)} ExpressionMap = &SafeExpressionMap{M: make(map[string][]*model.Expression)} LastEvents = &SafeEventMap{M: make(map[string]*model.Event)} FilterMap = &SafeFilterMap{M: make(map[string]string)} UnionJudgeConnPools *backend.SafeRpcConnPools UnionLastEvents = &SafeEventMap{M: make(map[string]*model.Event)} )
View Source
var (
ConfigFile string
)
View Source
var Logger = utils.InitLogger()
View Source
var RedisCluster *redisc.Cluster
View Source
var RedisConnPool *redis.Pool
Functions ¶
func CheckNeedJudge ¶
func GetOneStrategy ¶
func GetOneUnionStrategy ¶
func InitHbsClient ¶
func InitHbsClient()
func InitRedisConnPool ¶
func InitRedisConnPool()
func InitUnionJudgeClientAndRing ¶
func InitUnionJudgeClientAndRing()
func JudgeHostStrategies ¶
func ParseConfig ¶
func ParseConfig(cfg string)
Types ¶
type AlarmConfig ¶
type AlarmConfig struct { Enabled bool `json:"enabled"` MinInterval int64 `json:"minInterval"` QueuePattern string `json:"queuePattern"` Redis *RedisConfig `json:"redis"` }
type GlobalConfig ¶
type GlobalConfig struct { Debug bool `json:"debug"` LogLevel string `json:"log_level"` DebugHost string `json:"debugHost"` Remain int `json:"remain"` Http *HttpConfig `json:"http"` Rpc *RpcConfig `json:"rpc"` Hbs *HbsConfig `json:"hbs"` UnionJudgeS *UnionJudge `json:"union_judge_s"` Alarm *AlarmConfig `json:"alarm"` // 这个字段代表这个实例是否是组合策略judge // 组合策略judge不需要同步单个策略 IsUnion bool `json:"is_union"` }
func Config ¶
func Config() *GlobalConfig
type HttpConfig ¶
type RedisConfig ¶
type SafeEventMap ¶
type SafeExpressionMap ¶
type SafeExpressionMap struct { sync.RWMutex // metric:tag1 => [exp1, exp2 ...] // metric:tag2 => [exp1, exp2 ...] M map[string][]*model.Expression }
func (*SafeExpressionMap) Get ¶
func (this *SafeExpressionMap) Get() map[string][]*model.Expression
func (*SafeExpressionMap) ReInit ¶
func (this *SafeExpressionMap) ReInit(m map[string][]*model.Expression)
type SafeFilterMap ¶
func (*SafeFilterMap) Exists ¶
func (this *SafeFilterMap) Exists(key string) bool
func (*SafeFilterMap) ReInit ¶
func (this *SafeFilterMap) ReInit(m map[string]string)
type SafeStrategyMap ¶
type SafeUnionStrategies ¶
func (*SafeUnionStrategies) GetById ¶
func (this *SafeUnionStrategies) GetById(UnionId int) []*model.Strategy
type SingleConnRpcClient ¶
type SingleConnRpcClient struct { sync.Mutex RpcServers []string Timeout time.Duration // contains filtered or unexported fields }
func (*SingleConnRpcClient) Call ¶
func (this *SingleConnRpcClient) Call(method string, args interface{}, reply interface{}) error
type UnionJudge ¶
Click to show internal directories.
Click to hide internal directories.