config

package
v2.3.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2019 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	HTTPRelays []HTTPConfig `toml:"http"`
	UDPRelays  []UDPConfig  `toml:"udp"`
	Filters    Filters      `toml:"filter"`
	Verbose    bool
}

Config is an object created from a configuration file It is a list of HTTP and/or UDP relays Each relay has its own list of backends

func LoadConfigFile

func LoadConfigFile(filename string) (Config, error)

LoadConfigFile parses the specified file into a Config object

type Filter

type Filter struct {
	// Type is how the regex result will be interpreted
	Type string `toml:"type"`

	// TagExpression is a valid Go regex
	// It will be applied on each tag of any request to the backend
	TagExpression string `toml:"tag-expression"`

	// MeasurementExpression is a valid Go regex
	// It will be applied on the measurement of any request to the backend
	MeasurementExpression string `toml:"measurement-expression"`

	// TagRegexp is the compiled tag regexp
	TagRegexp *regexp.Regexp

	// MeasurementRegexp is the compiled measurement regexp
	MeasurementRegexp *regexp.Regexp

	// Outputs are the endoints the regex are applied on
	Outputs []string `toml:"outputs"`
}

Filter represents a regex which may be applied to the incoming requests

type Filters

type Filters []Filter

Filters is a type representing an array of Filter, wow

func (Filters) LoadRegexps

func (fs Filters) LoadRegexps() error

LoadRegexps will try to compile all the eventual regular expressions for each filter Any error here is critical

type HTTPConfig

type HTTPConfig struct {
	// Name identifies the HTTP relay
	Name string `toml:"name"`

	// Addr should be set to the desired listening host:port
	Addr string `toml:"bind-addr"`

	// Set certificate in order to handle HTTPS requests
	SSLCombinedPem string `toml:"ssl-combined-pem"`

	// Default retention policy to set for forwarded requests
	DefaultRetentionPolicy string `toml:"default-retention-policy"`

	DefaultPingResponse int `toml:"default-ping-response"`

	// Rate limit on specific HTTP relay
	RateLimit int `toml:"rate-limit"`

	// Burst allowed by rate limit
	BurstLimit int `toml:"burst-limit"`

	// Outputs is a list of backed servers where writes will be forwarded
	Outputs []HTTPOutputConfig `toml:"output"`

	HealthTimeout int64 `toml:"health-timeout-ms"`
}

HTTPConfig represents an HTTP relay

type HTTPEndpointConfig

type HTTPEndpointConfig struct {
	// Must be the standard write endpoint in influxdb.
	Write string `toml:"write"`
	// Must be the prometheus specific influxdb endpoint
	PromWrite string `toml:"write_prom"`
	// Must be the ping endpoint
	Ping string `toml:"ping"`
	// Must be the query influxdb endpoint
	Query string `toml:"query"`
}

HTTPEndpointConfig details the remote endpoints to use

type HTTPOutputConfig

type HTTPOutputConfig struct {
	// Name of the backend server
	Name string `toml:"name"`

	// Location should be set to the hostname for the influxdb endpoint (for example https://influxdb.com/)
	Location string `toml:"location"`

	// Endpoints should contain the path to the different influxdb endpoints used
	Endpoints HTTPEndpointConfig `toml:"endpoints"`

	// Timeout sets a per-backend timeout for write requests (default: 10s)
	// The format used is the same seen in time.ParseDuration
	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"`
}

HTTPOutputConfig represents the specification of an HTTP backend target

type Input

type Input string

Input type of source

const (
	// TypeInfluxdb input type
	TypeInfluxdb Input = "influxdb"
	// TypePrometheus input type
	TypePrometheus Input = "prometheus"
)

type UDPConfig

type UDPConfig struct {
	// Name identifies the UDP relay
	Name string `toml:"name"`

	// Addr is where the UDP relay will listen for packets
	Addr string `toml:"bind-addr"`

	// Precision sets the precision of the timestamps (input and output)
	Precision string `toml:"precision"`

	// ReadBuffer sets the socket buffer for incoming connections
	ReadBuffer int `toml:"read-buffer"`

	// Outputs is a list of backend servers where writes will be forwarded
	Outputs []UDPOutputConfig `toml:"output"`
}

UDPConfig represents a UDP relay

type UDPOutputConfig

type UDPOutputConfig struct {
	// Name identifies the UDP backend
	Name string `toml:"name"`

	// Location should be set to the host:port of the backend server
	Location string `toml:"location"`

	// MTU sets the maximum output payload size, default is 1024
	MTU int `toml:"mtu"`
}

UDPOutputConfig represents the specification of a UDP backend target

Jump to

Keyboard shortcuts

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