g

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2017 License: Apache-2.0, Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VERSION         = "0.5.9"
	GAUGE           = "GAUGE"
	DERIVE          = "DERIVE"
	COUNTER         = "COUNTER"
	DEFAULT_STEP    = 60      //s
	MIN_STEP        = 30      //s
	CLEAN_CACHE     = 86400   //s the step that clean GraphItems/historyCache Cache
	CACHE_DELAY     = 1800    //s
	CACHE_TIME      = 1800000 //ms
	FLUSH_DISK_STEP = 1000    //ms
	FLUSH_MIN_COUNT = 6       //  flush counter to disk when its number of monitoring data greater than FLUSH_MIN_COUNT
	FLUSH_MAX_WAIT  = 86400   //s flush counter to disk if it not be flushed within FLUSH_MAX_WAIT seconds
)
View Source
const (
	GRAPH_F_MISS uint32 = 1 << iota
	GRAPH_F_ERR
	GRAPH_F_SENDING
	GRAPH_F_FETCHING
)
View Source
const (
	COMMIT = "gitversion"
)

Variables

View Source
var (
	ConfigFile string
)
View Source
var DB *sql.DB

Functions

func FormRrdCacheKey

func FormRrdCacheKey(md5 string, dsType string, step int) string

生成rrd缓存数据的key

func GetDbConn

func GetDbConn(connName string) (c *sql.DB, e error)

func InitDB

func InitDB()

func InitLog

func InitLog(level string) (err error)

func IsRrdFileExist

func IsRrdFileExist(filename string) bool

rrd文件是否存在

func IsValidString

func IsValidString(str string) bool

判断是否为有效字符串(不包含指定字符和多字节字符)

func ParseConfig

func ParseConfig(cfg string)

func RrdFileName

func RrdFileName(baseDir string, md5 string, dsType string, step int) string

RRDTOOL UTILS 监控数据对应的rrd文件名称

func SplitRrdCacheKey

func SplitRrdCacheKey(ckey string) (md5 string, dsType string, step int, err error)

Types

type DBConfig

type DBConfig struct {
	Dsn     string `json:"dsn"`
	MaxIdle int    `json:"maxIdle"`
}

type File

type File struct {
	Filename string
	Body     []byte
}

type GlobalConfig

type GlobalConfig struct {
	Pid         string      `json:"pid"`
	Debug       bool        `json:"debug"`
	Http        *HttpConfig `json:"http"`
	Rpc         *RpcConfig  `json:"rpc"`
	RRD         *RRDConfig  `json:"rrd"`
	DB          *DBConfig   `json:"db"`
	CallTimeout int32       `json:"callTimeout"`
	Migrate     struct {
		Concurrency int               `json:"concurrency"` //number of multiple worker per node
		Enabled     bool              `json:"enabled"`
		Replicas    int               `json:"replicas"`
		Cluster     map[string]string `json:"cluster"`
	} `json:"migrate"`
}

func Config

func Config() *GlobalConfig

type HttpConfig

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

type RRDConfig

type RRDConfig struct {
	Storage string `json:"storage"`
}

type RpcConfig

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

Jump to

Keyboard shortcuts

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