g

package
v3.15.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2018 License: Apache-2.0, Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

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 (
	HbsClient     *SingleConnRpcClient
	StrategyMap   = &SafeStrategyMap{M: make(map[string][]model.Strategy)}
	ExpressionMap = &SafeExpressionMap{M: make(map[string][]*model.Expression)}
	LastEvents    = &SafeEventMap{M: make(map[string]*model.Event)}
)
View Source
var (
	ConfigFile string
)
View Source
var RedisConnPool *redis.Pool

Functions

func InitHbsClient

func InitHbsClient()

func InitLastEvents

func InitLastEvents()

func InitRedisConnPool

func InitRedisConnPool()

func ParseConfig

func ParseConfig(cfg string)

func PingRedis

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

Types

type AlarmConfig

type AlarmConfig struct {
	Enabled             bool         `json:"enabled"`
	MinInterval         int64        `json:"minInterval"`
	QueuePattern        string       `json:"queuePattern"`
	AllowReSet          bool         `json:"allow_reset"`
	StoreEventToFile    bool         `json:"store_event_to_file"`
	EventsStoreFilePath string       `json:"events_store_file_path"`
	Redis               *RedisConfig `json:"redis"`
}

type GlobalConfig

type GlobalConfig struct {
	Debug     bool         `json:"debug"`
	DebugHost string       `json:"debugHost"`
	RootDir   string       `json:"root_dir"`
	Remain    int          `json:"remain"`
	Http      *HttpConfig  `json:"http"`
	Rpc       *RpcConfig   `json:"rpc"`
	Hbs       *HbsConfig   `json:"hbs"`
	Alarm     *AlarmConfig `json:"alarm"`
}

func Config

func Config() *GlobalConfig

type HbsConfig

type HbsConfig struct {
	Servers  []string `json:"servers"`
	Timeout  int64    `json:"timeout"`
	Interval int64    `json:"interval"`
}

type HttpConfig

type HttpConfig struct {
	Enabled bool   `json:"enabled"`
	Listen  string `json:"listen"`
}

type RedisConfig

type RedisConfig struct {
	Dsn          string `json:"dsn"`
	MaxIdle      int    `json:"maxIdle"`
	ConnTimeout  int    `json:"connTimeout"`
	ReadTimeout  int    `json:"readTimeout"`
	WriteTimeout int    `json:"writeTimeout"`
}

type RpcConfig

type RpcConfig struct {
	Enabled bool   `json:"enabled"`
	Listen  string `json:"listen"`
}

type SafeEventMap

type SafeEventMap struct {
	sync.RWMutex
	M map[string]*model.Event
}

func (*SafeEventMap) Delete

func (this *SafeEventMap) Delete(key string) bool

func (*SafeEventMap) Get

func (this *SafeEventMap) Get(key string) (*model.Event, bool)

func (*SafeEventMap) GetAll

func (this *SafeEventMap) GetAll() map[string]*model.Event

func (*SafeEventMap) Set

func (this *SafeEventMap) Set(key string, event *model.Event)

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 SafeStrategyMap

type SafeStrategyMap struct {
	sync.RWMutex
	// endpoint:metric => [strategy1, strategy2 ...]
	M map[string][]model.Strategy
}

func (*SafeStrategyMap) Get

func (this *SafeStrategyMap) Get() map[string][]model.Strategy

func (*SafeStrategyMap) ReInit

func (this *SafeStrategyMap) ReInit(m map[string][]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

Jump to

Keyboard shortcuts

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