config

package
v5.15.1 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2023 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	C = new(Config)
)
View Source
var PromOptions = &PromOptionsStruct{Data: make(map[string]PromOption)}

Data key is cluster name

View Source
var ReaderClients = &PromClientMap{Clients: make(map[string]prom.API)}

Functions

func DealConfigCrypto added in v5.14.0

func DealConfigCrypto(key string)

func GetOutboundIP

func GetOutboundIP() net.IP

Get preferred outbound ip of this machine

func InitReader added in v5.11.0

func InitReader() error

func MustLoad

func MustLoad(key string, fpaths ...string)

Types

type Alerting

type Alerting struct {
	Timeout               int64
	TemplatesDir          string
	NotifyConcurrency     int
	NotifyBuiltinChannels []string
	CallScript            CallScript
	CallPlugin            CallPlugin
	RedisPub              RedisPub
	Webhook               Webhook
}

func (*Alerting) ListTpls added in v5.15.0

func (a *Alerting) ListTpls() (map[string]*template.Template, error)

type CallPlugin added in v5.5.0

type CallPlugin struct {
	Enable     bool
	PluginPath string
	Caller     string
}

type CallScript added in v5.4.0

type CallScript struct {
	Enable     bool
	ScriptPath string
}

type Config

type Config struct {
	RunMode            string
	ClusterName        string // 监控对象上报时,指定的集群名称
	BusiGroupLabelKey  string
	EngineDelay        int64
	DisableUsageReport bool
	ReaderFrom         string
	LabelRewrite       bool
	ForceUseServerTS   bool
	Log                logx.Config
	HTTP               httpx.Config
	BasicAuth          gin.Accounts
	SMTP               SMTPConfig
	Heartbeat          HeartbeatConfig
	Alerting           Alerting
	NoData             NoData
	Redis              storage.RedisConfig
	DB                 ormx.DBConfig
	WriterOpt          WriterGlobalOpt
	Writers            []WriterOptions
	Reader             PromOption
	Readers            []PromOption
	Ibex               Ibex
}

func (*Config) IsDebugMode

func (c *Config) IsDebugMode() bool

type HeartbeatConfig

type HeartbeatConfig struct {
	IP       string
	Interval int64
	Endpoint string
}

type Ibex

type Ibex struct {
	Address       string
	BasicAuthUser string
	BasicAuthPass string
	Timeout       int64
}

type NoData

type NoData struct {
	Metric   string
	Interval int64
}

type PromClientMap added in v5.14.3

type PromClientMap struct {
	sync.RWMutex
	Clients map[string]prom.API
}

func (*PromClientMap) Del added in v5.14.3

func (pc *PromClientMap) Del(cluster string)

func (*PromClientMap) GetCli added in v5.14.3

func (pc *PromClientMap) GetCli(cluster string) prom.API

func (*PromClientMap) GetClusterNames added in v5.14.3

func (pc *PromClientMap) GetClusterNames() []string

func (*PromClientMap) Hit added in v5.14.5

func (pc *PromClientMap) Hit(cluster string) []string

Hit 根据当前有效的cluster和规则的cluster配置计算有效的cluster列表

func (*PromClientMap) IsNil added in v5.14.3

func (pc *PromClientMap) IsNil(cluster string) bool

func (*PromClientMap) Reset added in v5.14.3

func (pc *PromClientMap) Reset()

func (*PromClientMap) Set added in v5.14.3

func (pc *PromClientMap) Set(clusterName string, c prom.API)

type PromOption added in v5.11.0

type PromOption struct {
	ClusterName   string
	Url           string
	BasicAuthUser string
	BasicAuthPass string

	Timeout     int64
	DialTimeout int64

	UseTLS bool
	tls.ClientConfig

	MaxIdleConnsPerHost int

	Headers []string
}

func (*PromOption) Equal added in v5.11.0

func (po *PromOption) Equal(target PromOption) bool

type PromOptionsStruct added in v5.11.0

type PromOptionsStruct struct {
	Data map[string]PromOption
	sync.RWMutex
}

func (*PromOptionsStruct) Del added in v5.14.3

func (pos *PromOptionsStruct) Del(clusterName string)

func (*PromOptionsStruct) Get added in v5.11.0

func (pos *PromOptionsStruct) Get(clusterName string) (PromOption, bool)

func (*PromOptionsStruct) Set added in v5.11.0

func (pos *PromOptionsStruct) Set(clusterName string, po PromOption)

type RedisPub

type RedisPub struct {
	Enable        bool
	ChannelPrefix string
	ChannelKey    string
}

type SMTPConfig added in v5.4.0

type SMTPConfig struct {
	Host               string
	Port               int
	User               string
	Pass               string
	From               string
	InsecureSkipVerify bool
	Batch              int
}

type Webhook added in v5.4.0

type Webhook struct {
	Enable          bool
	Url             string
	BasicAuthUser   string
	BasicAuthPass   string
	Timeout         string
	TimeoutDuration time.Duration
	Headers         []string
}

type WriterGlobalOpt added in v5.9.2

type WriterGlobalOpt struct {
	QueueCount   int
	QueueMaxSize int
	QueuePopSize int
	ShardingKey  string
}

type WriterOptions added in v5.9.2

type WriterOptions struct {
	ClusterName   string
	Url           string
	BasicAuthUser string
	BasicAuthPass string

	Timeout               int64
	DialTimeout           int64
	TLSHandshakeTimeout   int64
	ExpectContinueTimeout int64
	IdleConnTimeout       int64
	KeepAlive             int64

	MaxConnsPerHost     int
	MaxIdleConns        int
	MaxIdleConnsPerHost int

	Headers []string

	WriteRelabels []*models.RelabelConfig
}

Jump to

Keyboard shortcuts

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