Documentation ¶
Index ¶
- func GetConfigErrors() map[string]string
- func GetResolveWarnings() map[string][]string
- type AutoConfig
- func (ac *AutoConfig) AddListener(listener listeners.ServiceListener)
- func (ac *AutoConfig) AddProvider(provider providers.ConfigProvider, shouldPoll bool)
- func (ac *AutoConfig) GetAllConfigs() []integration.Config
- func (ac *AutoConfig) GetLoadedConfigs() map[string]integration.Config
- func (ac *AutoConfig) GetUnresolvedTemplates() map[string]integration.Config
- func (ac *AutoConfig) LoadAndRun()
- func (ac *AutoConfig) StartPolling()
- func (ac *AutoConfig) Stop()
- type ConfigResolver
- type TemplateCache
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetConfigErrors ¶
GetConfigErrors gets the config errors
func GetResolveWarnings ¶
GetResolveWarnings get the resolve warnings/errors
Types ¶
type AutoConfig ¶
type AutoConfig struct {
// contains filtered or unexported fields
}
AutoConfig is responsible to collect integrations configurations from different sources and then schedule or unschedule them. It owns and orchestrates several key modules:
- it owns a reference to the `collector.Collector` that it uses to schedule checks when template or container updates warrant them
- it holds a list of `providers.ConfigProvider`s and poll them according to their policy
- it holds a list of `check.Loader`s to load configurations into `Check` objects
- it holds a list of `listeners.ServiceListener`s` used to listen to container lifecycle events
- it runs the `ConfigResolver` that resolves a configuration template to an actual configuration based on data it extracts from a service that matches it the template
Notice the `AutoConfig` public API speaks in terms of `integration.Config`, meaning that you cannot use it to schedule integrations instances directly.
func NewAutoConfig ¶
func NewAutoConfig(scheduler scheduler.Scheduler) *AutoConfig
NewAutoConfig creates an AutoConfig instance.
func (*AutoConfig) AddListener ¶
func (ac *AutoConfig) AddListener(listener listeners.ServiceListener)
AddListener adds a service listener to AutoConfig.
func (*AutoConfig) AddProvider ¶
func (ac *AutoConfig) AddProvider(provider providers.ConfigProvider, shouldPoll bool)
AddProvider adds a new configuration provider to AutoConfig. Callers must pass a flag to indicate whether the configuration provider expects to be polled or it's fine for it to be invoked only once in the Agent lifetime.
func (*AutoConfig) GetAllConfigs ¶
func (ac *AutoConfig) GetAllConfigs() []integration.Config
GetAllConfigs queries all the providers and returns all the integration configurations found, resolving the ones it can
func (*AutoConfig) GetLoadedConfigs ¶
func (ac *AutoConfig) GetLoadedConfigs() map[string]integration.Config
GetLoadedConfigs returns configs loaded
func (*AutoConfig) GetUnresolvedTemplates ¶
func (ac *AutoConfig) GetUnresolvedTemplates() map[string]integration.Config
GetUnresolvedTemplates returns templates in cache yet to be resolved
func (*AutoConfig) LoadAndRun ¶
func (ac *AutoConfig) LoadAndRun()
LoadAndRun loads all of the integration configs it can find and schedules them. Should always be run once so providers that don't need polling will be queried at least once
func (*AutoConfig) StartPolling ¶
func (ac *AutoConfig) StartPolling()
StartPolling starts the goroutine responsible for polling the providers
func (*AutoConfig) Stop ¶
func (ac *AutoConfig) Stop()
Stop just shuts down AutoConfig in a clean way. AutoConfig is not supposed to be restarted, so this is expected to be called only once at program exit.
type ConfigResolver ¶
type ConfigResolver struct {
// contains filtered or unexported fields
}
ConfigResolver stores services and templates in cache, and matches services it hears about with templates to create valid configs. It is also responsible to send scheduling orders to AutoConfig
func (*ConfigResolver) ResolveTemplate ¶
func (cr *ConfigResolver) ResolveTemplate(tpl integration.Config) []integration.Config
ResolveTemplate attempts to resolve a configuration template using the AD identifiers in the `integration.Config` struct to match a Service.
The function might return more than one configuration for a single template, for example when the `ad_identifiers` section of a config.yaml file contains multiple entries, or when more than one Service has the same identifier, e.g. 'redis'.
The function might return an empty list in the case the configuration has a list of Autodiscovery identifiers for services that are unknown to the resolver at this moment.
type TemplateCache ¶
type TemplateCache struct {
// contains filtered or unexported fields
}
TemplateCache is a data structure to store configuration templates
func (*TemplateCache) Del ¶
func (cache *TemplateCache) Del(tpl integration.Config) error
Del removes a template from the cache
func (*TemplateCache) Get ¶
func (cache *TemplateCache) Get(adID string) ([]integration.Config, error)
Get retrieves a template from the cache
func (*TemplateCache) GetUnresolvedTemplates ¶
func (cache *TemplateCache) GetUnresolvedTemplates() map[string]integration.Config
GetUnresolvedTemplates returns templates yet to be resolved
func (*TemplateCache) Set ¶
func (cache *TemplateCache) Set(tpl integration.Config) error
Set stores or updates a template in the cache