config

package
v0.0.0-...-decdc4a Latest Latest
Warning

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

Go to latest
Published: May 24, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateKey

func ValidateKey(name string, key RuleKey) error

Types

type ClusterType

type ClusterType string
const (
	ClType_HA     ClusterType = "HA"
	ClType_Single ClusterType = "Single"
	ClType_LB     ClusterType = "LB"
)

type Config

type Config struct {
	Influxdb      []*InfluxDBBackend `toml:"influxdb"`
	Influxcluster []*Influxcluster   `toml:"influxcluster"`
	HTTPConfig    []*HTTPConfig      `toml:"http"`
}

func LoadConfigFile

func LoadConfigFile(filename string) (*Config, error)

LoadConfigFile parses the specified file into a Config object

func (*Config) GetInfluxCluster

func (c *Config) GetInfluxCluster(name string) *Influxcluster

func (*Config) GetInfluxDBBackend

func (c *Config) GetInfluxDBBackend(name string) *InfluxDBBackend

type EndPSFormat

type EndPSFormat string
const (
	EndPSFormat_IQL    EndPSFormat = "IQL"        //Influx Query Language
	EndPSFormat_ILP    EndPSFormat = "ILP"        //Influx Line Protocol
	EndPSFormat_promwr EndPSFormat = "prom-write" // Prometheus Write
)

type EndPType

type EndPType string
const (
	EndPType_RD EndPType = "RD"
	EndPType_WR EndPType = "WR"
)

type Endpoint

type Endpoint struct {
	URI          []string    `toml:"uri"`
	Type         EndPType    `toml:"type"`
	SourceFormat EndPSFormat `toml:"source_format"`
	Route        []*Route    `toml:"route"`
}

func (*Endpoint) ValidateCfg

func (e *Endpoint) ValidateCfg(cfg *Config) error

type Filter

type Filter struct {
	Name  string  `toml:"name"`
	Key   RuleKey `toml:"key"`
	Match string  `toml:"match"`
}

func (*Filter) ValidateCfg

func (f *Filter) ValidateCfg(cfg *Config) error

type HTTPConfig

type HTTPConfig struct {
	Name       string      `toml:"name"`
	BindAddr   string      `toml:"bind-addr"`
	LogFile    string      `toml:"log-file"`
	LogLevel   string      `toml:"log-level"`
	AccessLog  string      `toml:"access-log"`
	RateLimit  int         `toml:"rate-limit,omitempty"`
	BurstLimit int         `toml:"burst-limit,omitempty"`
	Endpoint   []*Endpoint `toml:"endpoint"`
	// Set certificate in order to handle HTTPS requests
	TLSCert string `toml:"tls_cert"`
	TLSKey  string `toml:"tls_key"`
	// Default retention policy to set for forwarded requests
	DefaultRetentionPolicy string `toml:"default-retention-policy"`
}

func (*HTTPConfig) ValidateCfg

func (h *HTTPConfig) ValidateCfg(cfg *Config) error

type InfluxDBBackend

type InfluxDBBackend struct {
	Name     string `toml:"name"`
	Location string `toml:"location"`
	PingURI  string `toml:"ping"`
	Timeout  string `toml:"timeout"`
	// Buffer failed writes up to maximum count (default: 0, retry/buffering disabled)
	BufferSizeMB int `toml:"buffer-size-mb"`

	// Maximum batch size in KB (default: 512)
	MaxBatchKB int `toml:"max-batch-kb"`

	// Maximum delay between retry attempts
	// The format used is the same seen in time.ParseDuration (default: 10s)
	MaxDelayInterval string `toml:"max-delay-interval"`

	// Skip TLS verification in order to use self signed certificate
	// WARNING: It's insecure, use it only for developing and don't use in production
	SkipTLSVerification bool `toml:"skip-tls-verification"`
}

func (*InfluxDBBackend) ValidateCfg

func (ib *InfluxDBBackend) ValidateCfg(cfg *Config) error

type Influxcluster

type Influxcluster struct {
	Name                   string      `toml:"name"`
	Members                []string    `toml:"members,omitempty"`
	Type                   ClusterType `toml:"type,omitempty"`
	RateLimit              int         `toml:"rate-limit,omitempty"`
	BurstLimit             int         `toml:"burst-limit,omitempty"`
	QueryRouterEndpointAPI []string    `toml:"query-router-endpoint-api"`
	DefaultPingResponse    int         `toml:"default-ping-response-code"`
	LogFile                string      `toml:"log-file"`
	LogLevel               string      `toml:"log-level"`
	HealthTimeout          int64       `toml:"health-timeout-ms"`
}

func (*Influxcluster) ValidateCfg

func (ic *Influxcluster) ValidateCfg(cfg *Config) error

type Route

type Route struct {
	Name       string     `toml:"name"`
	Level      RouteLevel `toml:"level"`
	Filter     []*Filter  `toml:"filter"`
	Rule       []*Rule    `toml:"rule"`
	LogInherit bool       `toml:"log-inherit"`
	LogFile    string     `toml:"log-file"`
	LogLevel   string     `toml:"log-level"`
}

func (*Route) ValidateCfg

func (r *Route) ValidateCfg(cfg *Config) error

type RouteLevel

type RouteLevel string
const (
	RouteLvl_http RouteLevel = "http"
	RouteLvl_data RouteLevel = "data"
)

type Rule

type Rule struct {
	Name           string     `toml:"name"`
	Action         RuleAction `toml:"action"`
	Key            RuleKey    `toml:"key"` //	"regexp"
	KeyAux         string     `toml:"key_aux"`
	Match          string     `toml:"match"`
	Value          string     `toml:"value"`
	ValueOnUnMatch string     `toml:"value_on_unmatch"`
	ToCluster      string     `toml:"to_cluster"`
}

func (*Rule) ValidateCfg

func (r *Rule) ValidateCfg(cfg *Config) error

type RuleAction

type RuleAction string
const (
	RuleAct_Route        RuleAction = "route"
	RuleAct_RouteDBfData RuleAction = "route_db_from_data"
	RuleAct_RenameHTTP   RuleAction = "rename_http"
	RuleAct_RenameData   RuleAction = "rename_data"
	RuleAct_DropData     RuleAction = "drop_data"
	RuleAct_Break        RuleAction = "break"
)

type RuleKey

type RuleKey string
const (
	//HTTP Header Based
	RKey_authorization  RuleKey = "authorization"
	RKey_remote_address RuleKey = "remote-address"
	RKey_referer        RuleKey = "referer"
	RKey_user_agent     RuleKey = "user-agent"
	RKey_username       RuleKey = "username"
	//HTTP Parameter Based
	RKey_db          RuleKey = "db"
	RKey_q           RuleKey = "q"
	RKey_epoch       RuleKey = "epoch"
	RKey_chunked     RuleKey = "chunked"
	RKey_chunksize   RuleKey = "chunksize"
	RKey_pretty      RuleKey = "pretty"
	RKey_u           RuleKey = "u"
	RKey_p           RuleKey = "p"
	RKey_rp          RuleKey = "rp"
	RKey_precision   RuleKey = "precision"
	RKey_consistency RuleKey = "consistency"

	//Data Based
	RKey_measurement RuleKey = "measurement"
	RKey_field       RuleKey = "field" //for compatibility old versions, use fieldvalue instead
	RKey_fieldValue  RuleKey = "fieldvalue"
	RKey_fieldName   RuleKey = "fieldname"
	RKey_tag         RuleKey = "tag" //for compatibility old versions, use tagvalue instead
	RKey_tagValue    RuleKey = "tagvalue"
	RKey_tagName     RuleKey = "tagname"
)

Jump to

Keyboard shortcuts

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