config

package
v0.0.0-...-9a904f4 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2018 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigFileWatcher

func ConfigFileWatcher()

配置文件监控,可以实现热更新

Types

type Config

type Config struct {
	Metric     string      //度量名称,比如log.console 或者log
	Timer      int         // 每隔多长时间(秒)上报
	Host       string      //主机名称
	Agent      string      //agent api url
	WatchFiles []WatchFile `json:"files"`
	LogLevel   string
}
var (
	Cfg *Config
)

func ReadConfig

func ReadConfig(configFile string) (*Config, error)

type PushData

type PushData struct {
	Metric    string  `json:"metric"`    //统计纬度
	Endpoint  string  `json:"endpoint"`  //主机
	Timestamp int64   `json:"timestamp"` //unix时间戳,秒
	Value     float64 `json:"value"`     // 代表该metric在当前时间点的值
	Step      int     `json:"step"`      //  表示该数据采集项的汇报周期,这对于后续的配置监控策略很重要,必须明确指定。

	CounterType string `json:"counterType"` //只能是COUNTER或者GAUGE二选一,前者表示该数据采集项为计时器类型,后者表示其为原值 (注意大小写)
	//GAUGE:即用户上传什么样的值,就原封不动的存储
	//COUNTER:指标在存储和展现的时候,会被计算为speed,即(当前值 - 上次值)/ 时间间隔
	Tags string `json:"tags"` //一组逗号分割的键值对, 对metric进一步描述和细化, 可以是空字符串. 比如idc=lg,比如service=xbox等,多个tag之间用逗号分割
}

说明:这7个字段都是必须指定

type WatchFile

type WatchFile struct {
	Path       string //路径
	Prefix     string //log前缀
	Suffix     string //log后缀
	Keywords   []keyWord
	PathIsFile bool       //path 是否是文件
	ResultFile resultFile `json:"-"`
}

Jump to

Keyboard shortcuts

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