sources

package
v3.1.13+incompatible Latest Latest
Warning

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

Go to latest
Published: May 31, 2018 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package sources contains all of the config source logic. This includes logic to get config content from various sources such as the filesystem or a KV store. It also contains the logic for filling in dynamic values in config.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadConfig

func ReadConfig(configPath string, stop <-chan struct{}) ([]byte, <-chan []byte, error)

ReadConfig reads in the main agent config file and optionally watches for changes on it. It will be returned immediately, along with a channel that will be sent any updated config content if watching is enabled.

func ReadDynamicValues

func ReadDynamicValues(configContent []byte, stop <-chan struct{}) ([]byte, <-chan []byte, error)

ReadDynamicValues takes the config file content and processes it for any dynamic values of the form `{"#from": ...`. It returns a YAML document that contains the rendered values. It will optionally watch the sources of any dynamic values configured and send updated YAML docs on the returned channel.

Types

type RawDynamicValueSpec

type RawDynamicValueSpec interface{}

RawDynamicValueSpec is a string that should deserialize to a dynamic value path (e.g. {"#from": "/path/to/value"}).

type SourceConfig

type SourceConfig struct {
	// Whether to watch config sources for changes.  If this is `true` and any
	// of the config changes (either the main agent.yaml, or remote config
	// values), the agent will dynamically reconfigure itself with minimal
	// disruption.  This is generally better than restarting the agent on
	// config changes since that can result in larger gaps in metric data.  The
	// main disadvantage of watching is slightly greater network and compute
	// resource usage. This option itself ironically enough is not subject to
	// watching and changing it to false after the agent was started with it
	// true will require an agent restart.
	Watch bool `yaml:"watch" default:"true"`
	// Configuration for other file sources
	File file.Config `yaml:"file" default:"{}"`
	// Configuration for a Zookeeper remote config source
	Zookeeper *zookeeper.Config `yaml:"zookeeper"`
	// Configuration for an Etcd 2 remote config source
	Etcd2 *etcd2.Config `yaml:"etcd2"`
	// Configuration for a Consul remote config source
	Consul *consul.Config `yaml:"consul"`
}

SourceConfig represents configuration for various config sources that we support.

func (*SourceConfig) SourceInstances

func (sc *SourceConfig) SourceInstances() (map[string]types.ConfigSource, error)

SourceInstances returns a map of instantiated sources based on the config

Directories

Path Synopsis
Package zookeeper contains the logic for using Zookeeper as a config source.
Package zookeeper contains the logic for using Zookeeper as a config source.

Jump to

Keyboard shortcuts

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