config

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2018 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadConfigFromFile

func LoadConfigFromFile(config *Config, filename string) error

LoadConfigFromFile fills a configuration object (passed as parameter) with values read from a configuration file (pass as parameter by filename). The configuration file needs to be in HCL format.

func LoadConfigFromFlags

func LoadConfigFromFlags(config *Config, flags *StartupFlags) error

LoadConfigFromFlags fills a configuration object (passed as parameter) with values from command-line flags.

func LoadConfigFromStream added in v1.2.0

func LoadConfigFromStream(config *Config, stream io.Reader, typ ConfigType) error

LoadConfigFromStream fills a configuration object (passed as parameter) with values read from a Reader interface (passed as parameter).

Types

type Config

type Config struct {
	Listen                     ListenConfig
	Consul                     ConsulConfig
	Namespaces                 []NamespaceConfig `hcl:"namespace"`
	EnableExperimentalFeatures bool              `hcl:"enable_experimental"`
}

Config models the application's configuration

func (*Config) StabilityWarnings added in v1.1.0

func (c *Config) StabilityWarnings() error

type ConfigType added in v1.2.0

type ConfigType int
const (
	TYPE_HCL ConfigType = iota
	TYPE_YAML
)

type ConsulConfig

type ConsulConfig struct {
	Enable     bool
	Address    string
	Datacenter string
	Scheme     string
	Token      string
	Service    ConsulServiceConfig
}

type ConsulServiceConfig

type ConsulServiceConfig struct {
	ID   string
	Name string
	Tags []string
}

type ListenConfig

type ListenConfig struct {
	Port    int
	Address string
}

ListenConfig is a struct describing the built-in webserver configuration

type NamespaceConfig

type NamespaceConfig struct {
	Name           string            `hcl:",key"`
	SourceFiles    []string          `hcl:"source_files" yaml:"source_files"`
	Format         string            `hcl:"format"`
	Labels         map[string]string `hcl:"labels"`
	RelabelConfigs []RelabelConfig   `hcl:"relabel" yaml:"relabel_configs"`

	OrderedLabelNames  []string
	OrderedLabelValues []string
}

NamespaceConfig is a struct describing single metric namespaces

func (*NamespaceConfig) Compile added in v1.1.0

func (c *NamespaceConfig) Compile() error

func (*NamespaceConfig) MustCompile added in v1.1.0

func (c *NamespaceConfig) MustCompile()

func (*NamespaceConfig) OrderLabels added in v1.0.1

func (c *NamespaceConfig) OrderLabels()

OrderLabels builds two lists of label keys and values, ordered by label name

func (*NamespaceConfig) StabilityWarnings added in v1.1.0

func (c *NamespaceConfig) StabilityWarnings() error

type RelabelConfig added in v1.1.0

type RelabelConfig struct {
	TargetLabel string              `hcl:",key" yaml:"target_label"`
	SourceValue string              `hcl:"from" yaml:"from"`
	Whitelist   []string            `hcl:"whitelist"`
	Matches     []RelabelValueMatch `hcl:"match"`
	Split       int                 `hcl:"split"`

	WhitelistExists bool
	WhitelistMap    map[string]interface{}
}

RelabelConfig is a struct describing a single re-labeling configuration for taking over label values from an access log line into a Prometheus metric

func (*RelabelConfig) Compile added in v1.1.0

func (c *RelabelConfig) Compile() error

type RelabelValueMatch added in v1.1.0

type RelabelValueMatch struct {
	RegexpString string `hcl:",key" yaml:"regexp"`
	Replacement  string `hcl:"replacement"`

	CompiledRegexp *regexp.Regexp
}

type StartupFlags

type StartupFlags struct {
	ConfigFile                 string
	Filenames                  []string
	Format                     string
	Namespace                  string
	ListenPort                 int
	EnableExperimentalFeatures bool
}

StartupFlags is a struct containing options that can be passed via the command line

Jump to

Keyboard shortcuts

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