Documentation
¶
Index ¶
- Variables
- func CheckSecret(t *testing.T, rawCfg string, originalValue string)
- func LoadBytes(buf []byte, expandEnvVars bool, c *Config) error
- func LoadDynamicConfiguration(url string, expandvar bool, c *Config) error
- func LoadFile(filename string, expandEnvVars bool, c *Config) error
- func LoadRemote(url string, expandEnvVars bool, c *Config) error
- type Config
- type Datasource
- type DynamicLoader
- type Integrations
- type IntegrationsGlobals
- type LoaderConfig
- type VersionedIntegrations
Constants ¶
This section is empty.
Variables ¶
var DefaultConfig = Config{
Server: server.DefaultConfig,
ServerFlags: server.DefaultFlags,
Metrics: metrics.DefaultConfig,
Integrations: DefaultVersionedIntegrations,
EnableConfigEndpoints: false,
EnableUsageReport: true,
}
DefaultConfig holds default settings for all the subsystems.
var DefaultVersionedIntegrations = VersionedIntegrations{
// contains filtered or unexported fields
}
DefaultVersionedIntegrations is the default config for integrations.
Functions ¶
func CheckSecret ¶ added in v0.20.1
func CheckSecret(t *testing.T, rawCfg string, originalValue string)
CheckSecret is a helper function to ensure the original value is overwritten with <secret>
func LoadBytes ¶ added in v0.4.0
func LoadBytes(buf []byte, expandEnvVars bool, c *Config) error
LoadBytes unmarshals a config from a buffer. Defaults are not applied to the file and must be done manually if LoadBytes is called directly.
func LoadDynamicConfiguration ¶ added in v0.22.9
func LoadDynamicConfiguration(url string, expandvar bool, c *Config) error
LoadDynamicConfiguration is used to load configuration from a variety of sources using dynamic loader, this is a templated approach
func LoadFile ¶
func LoadFile(filename string, expandEnvVars bool, c *Config) error
LoadFile reads a file and passes the contents to Load
func LoadRemote ¶ added in v0.22.0
func LoadRemote(url string, expandEnvVars bool, c *Config) error
LoadRemote reads a config from url
Types ¶
type Config ¶
type Config struct {
Server server.Config `yaml:"server,omitempty"`
Metrics metrics.Config `yaml:"metrics,omitempty"`
Integrations VersionedIntegrations `yaml:"integrations,omitempty"`
Traces traces.Config `yaml:"traces,omitempty"`
Logs *logs.Config `yaml:"logs,omitempty"`
// Flag-only fields
ServerFlags server.Flags `yaml:"-"`
// Deprecated fields user has used. Generated during UnmarshalYAML.
Deprecations []string `yaml:"-"`
// Remote config options
BasicAuthUser string `yaml:"-"`
BasicAuthPassFile string `yaml:"-"`
// Toggle for config endpoint(s)
EnableConfigEndpoints bool `yaml:"-"`
// Report enabled features options
EnableUsageReport bool `yaml:"-"`
EnabledFeatures []string `yaml:"-"`
}
Config contains underlying configurations for the agent
func Load ¶
func Load(fs *flag.FlagSet, args []string) (*Config, error)
Load loads a config file from a flagset. Flags will be registered to the flagset before parsing them with the values specified by args.
func (*Config) LogDeprecations ¶ added in v0.19.0
func (c *Config) LogDeprecations(l log.Logger)
LogDeprecations will log use of any deprecated fields to l as warn-level messages.
func (Config) MarshalYAML ¶ added in v0.20.1
func (c Config) MarshalYAML() (interface{}, error)
MarshalYAML implements yaml.Marshaler.
func (*Config) RegisterFlags ¶
func (c *Config) RegisterFlags(f *flag.FlagSet)
RegisterFlags registers flags in underlying configs
func (*Config) UnmarshalYAML ¶ added in v0.14.0
func (c *Config) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements yaml.Unmarshaler.
type Datasource ¶ added in v0.22.9
type Datasource struct {
Name string `yaml:"name"`
URL string `yaml:"url"`
}
Datasource is used for gomplate and can be used for a variety of resources.
type DynamicLoader ¶ added in v0.22.9
type DynamicLoader struct {
// contains filtered or unexported fields
}
DynamicLoader is used to load configs from a variety of sources and squash them together. This is used by the dynamic configuration feature to load configurations from a set of templates and then run them through gomplate producing an end result.
func NewDynamicLoader ¶ added in v0.22.9
func NewDynamicLoader() (*DynamicLoader, error)
NewDynamicLoader instantiates a new DynamicLoader.
func (*DynamicLoader) LoadConfig ¶ added in v0.22.9
func (c *DynamicLoader) LoadConfig(cfg LoaderConfig) error
LoadConfig loads an already created LoaderConfig into the DynamicLoader.
func (*DynamicLoader) LoadConfigByPath ¶ added in v0.22.9
func (c *DynamicLoader) LoadConfigByPath(path string) error
LoadConfigByPath creates a config based on a path.
func (*DynamicLoader) ProcessConfigs ¶ added in v0.22.9
func (c *DynamicLoader) ProcessConfigs(cfg *Config) error
ProcessConfigs loads the configurations in a predetermined order to handle functioning correctly.
type Integrations ¶ added in v0.22.0
type Integrations interface {
ApplyConfig(*VersionedIntegrations, IntegrationsGlobals) error
WireAPI(*mux.Router)
Stop()
}
Integrations is an abstraction over both the v1 and v2 systems.
func NewIntegrations ¶ added in v0.22.0
func NewIntegrations(logger log.Logger, cfg *VersionedIntegrations, globals IntegrationsGlobals) (Integrations, error)
NewIntegrations creates a new subsystem. globals should be provided regardless of useV2. globals.SubsystemOptions will be automatically set if cfg.Version is set to IntegrationsVersion2.
type IntegrationsGlobals ¶ added in v0.22.0
type IntegrationsGlobals = v2.Globals
IntegrationsGlobals is a global struct shared across integrations.
type LoaderConfig ¶ added in v0.22.9
type LoaderConfig struct {
// Sources is used to define sources for variables using gomplate
Sources []Datasource `yaml:"datasources"`
// TemplatePaths is the "directory" to look for templates in, they will be found and matched to configs but various
// naming conventions. They can be S3/gcp, or file based resources. The directory structure is NOT walked.
TemplatePaths []string `yaml:"template_paths"`
AgentFilter string `yaml:"agent_filter,omitempty"`
ServerFilter string `yaml:"server_filter,omitempty"`
MetricsFilter string `yaml:"metrics_filter,omitempty"`
MetricsInstanceFilter string `yaml:"metrics_instance_filter,omitempty"`
IntegrationsFilter string `yaml:"integrations_filter,omitempty"`
LogsFilter string `yaml:"logs_filter,omitempty"`
TracesFilter string `yaml:"traces_filter,omitempty"`
}
LoaderConfig is used by dynamic configuration
type VersionedIntegrations ¶ added in v0.22.0
type VersionedIntegrations struct {
// ExtraIntegrations is used when adding any integrations NOT in the default agent configuration
ExtraIntegrations []v2.Config
// contains filtered or unexported fields
}
VersionedIntegrations abstracts the subsystem configs for integrations v1 and v2. VersionedIntegrations can only be unmarshaled as part of Load.
func (*VersionedIntegrations) ApplyDefaults ¶ added in v0.22.0
func (c *VersionedIntegrations) ApplyDefaults(sflags *server.Flags, mcfg *metrics.Config) error
ApplyDefaults applies defaults to the subsystem based on globals.
func (VersionedIntegrations) IsZero ¶ added in v0.22.0
func (c VersionedIntegrations) IsZero() bool
IsZero implements yaml.IsZeroer.
func (VersionedIntegrations) MarshalYAML ¶ added in v0.22.0
func (c VersionedIntegrations) MarshalYAML() (interface{}, error)
MarshalYAML implements yaml.Marshaler.
func (*VersionedIntegrations) UnmarshalYAML ¶ added in v0.22.0
func (c *VersionedIntegrations) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements yaml.Unmarshaler. Full unmarshaling is deferred until setVersion is invoked.