Documentation
¶
Index ¶
- Variables
- func BuildFindByIdsDSLBody(ids []string) string
- func GetMetricsOpRedisFingerprint(uniqueId string, path string, cmd string, key string, statusCode int) string
- func GetMetricsWebhookNotifyFingerprint(uniqueId string, path string, statusCode int) string
- type AppConfig
- type EsConfig
- type FlagOption
- type Rule
- func (rl *Rule) GetEsAddress() string
- func (rl *Rule) GetMetricsOpRedisFingerprint(cmd string, key string, statusCode int) string
- func (rl *Rule) GetMetricsQueryFingerprint(statusCode int) string
- func (rl *Rule) GetQueryStringCountDSL(start time.Time, end time.Time) string
- func (rl *Rule) GetQueryStringDSL(from int, size int, start time.Time, end time.Time) string
Constants ¶
This section is empty.
Variables ¶
View Source
var AppYamlSchema = `` /* 1482-byte string literal not displayed */
View Source
var RuleYamlSchema = `` /* 1249-byte string literal not displayed */
Functions ¶
func BuildFindByIdsDSLBody ¶
Types ¶
type AppConfig ¶
type AppConfig struct { Exporter struct { ListenAddr string `yaml:"listen_addr" default:":9003"` Enabled bool `yaml:"enabled" default:"true"` } `yaml:"exporter"` Loader struct { Type string `yaml:"type" default:"FileLoader"` Config map[string]any `yaml:"config"` } `yaml:"loader"` Alert struct { Alertmanager struct { Url string `yaml:"url"` BasicAuth struct { Username string `yaml:"username"` Password string `yaml:"password"` } `yaml:"basic_auth"` } `yaml:"alertmanager"` Generator struct { BaseUrl string `yaml:"base_url"` Expire xtime.TimeLimit `yaml:"expire"` } `yaml:"generator"` } `yaml:"alert"` Redis struct { Addr string `yaml:"addr" default:"127.0.0.1"` Port int `yaml:"port" default:"6379"` Password string `yaml:"password"` Db int `yaml:"db" default:"0"` PoolSize int `yaml:"pool_size" default:"512"` ReadTimeout int `yaml:"read_timeout" default:"30"` WriteTimeout int `yaml:"write_timeout" default:"30"` DialTimeout int `yaml:"dial_timeout" default:"5"` } `yaml:"redis"` RunEvery xtime.TimeLimit `yaml:"run_every"` BufferTime xtime.TimeLimit `yaml:"buffer_time"` AlertTimeLimit xtime.TimeLimit `yaml:"alert_time_limit"` MaxScrollingCount uint `yaml:"max_scrolling_count" default:"5"` }
AppConfig is application global configure
var AppConf *AppConfig
func GetAppConfig ¶
type FlagOption ¶
type FlagOption struct { ConfigPath string `short:"c" long:"config" description:"config.yaml path" default:"./config.yaml"` Debug bool `long:"debug" description:"debug log level"` Verbose string `short:"v" long:"verbose" description:"log level: debug、info、warn、error" default:"info"` Rule string `long:"rule" description:"will only run the given single rule. The rule file may be a complete file path"` Zone string `long:"zone" description:"time zone, e.g like PRC、UTC" default:"PRC"` }
FlagOption is application run args
func (FlagOption) GetLogLevel ¶
func (f FlagOption) GetLogLevel() log.Level
GetLogLevel can get application log level
func (FlagOption) IsDebug ¶
func (f FlagOption) IsDebug() bool
type Rule ¶
type Rule struct { UniqueId string `yaml:"unique_id"` Enabled bool `yaml:"enabled" default:"true"` ES EsConfig `yaml:"es"` Index string `yaml:"index"` RunEvery xtime.TimeLimit `yaml:"run_every"` Query struct { Type string `yaml:"type"` Config struct { Timeframe xtime.TimeLimit `yaml:"timeframe"` NumEvents uint `yaml:"num_events"` } `yaml:"config"` QueryString string `yaml:"query_string"` Labels map[string]string `yaml:"labels"` Annotations map[string]string `yaml:"annotations"` } `yaml:"query"` RawContent string FilePath string }
func (*Rule) GetEsAddress ¶
func (*Rule) GetMetricsOpRedisFingerprint ¶
func (*Rule) GetMetricsQueryFingerprint ¶
func (*Rule) GetQueryStringCountDSL ¶
Click to show internal directories.
Click to hide internal directories.