Documentation ¶
Overview ¶
Package autodiscovery implements the agent's autodiscovery mechanism.
Index ¶
- func GetConfigErrors() map[string]string
- func GetResolveWarnings() map[string][]string
- type AutoConfig
- func (ac *AutoConfig) AddConfigProvider(provider providers.ConfigProvider, shouldPoll bool, pollInterval time.Duration)
- func (ac *AutoConfig) AddListeners(listenerConfigs []config.Listeners)
- func (ac *AutoConfig) AddScheduler(name string, s scheduler.Scheduler, replayConfigs bool)
- func (ac *AutoConfig) ForceRanOnceFlag()
- func (ac *AutoConfig) GetAllConfigs() []integration.Config
- func (ac *AutoConfig) GetAutodiscoveryErrors() map[string]map[string]providers.ErrorMsgSet
- func (ac *AutoConfig) GetIDOfCheckWithEncryptedSecrets(checkID checkid.ID) checkid.ID
- func (ac *AutoConfig) GetUnresolvedTemplates() map[string][]integration.Config
- func (ac *AutoConfig) HasRunOnce() bool
- func (ac *AutoConfig) LoadAndRun(ctx context.Context)
- func (ac *AutoConfig) LoadedConfigs() []integration.Config
- func (ac *AutoConfig) MapOverLoadedConfigs(f func(map[string]integration.Config))
- func (ac *AutoConfig) RemoveScheduler(name string)
- func (ac *AutoConfig) Stop()
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 implements the agent's autodiscovery mechanism. It is responsible to collect integrations configurations from different sources and then "schedule" or "unschedule" them by notifying subscribers. See the module README for details.
func NewAutoConfig ¶
func NewAutoConfig(scheduler *scheduler.MetaScheduler, secretResolver secrets.Component) *AutoConfig
NewAutoConfig creates an AutoConfig instance and starts it.
func NewAutoConfigNoStart ¶
func NewAutoConfigNoStart(scheduler *scheduler.MetaScheduler, secretResolver secrets.Component) *AutoConfig
NewAutoConfigNoStart creates an AutoConfig instance.
func (*AutoConfig) AddConfigProvider ¶
func (ac *AutoConfig) AddConfigProvider(provider providers.ConfigProvider, shouldPoll bool, pollInterval time.Duration)
AddConfigProvider adds a new configuration provider to AutoConfig. Callers must pass a flag to indicate whether the configuration provider expects to be polled and at which interval or it's fine for it to be invoked only once in the Agent lifetime. If the config provider is polled, the routine is scheduled right away
func (*AutoConfig) AddListeners ¶
func (ac *AutoConfig) AddListeners(listenerConfigs []config.Listeners)
AddListeners tries to initialise the listeners listed in the given configs. A first try is done synchronously. If a listener fails with a ErrWillRetry, the initialization will be re-triggered later until success or ErrPermaFail.
func (*AutoConfig) AddScheduler ¶
func (ac *AutoConfig) AddScheduler(name string, s scheduler.Scheduler, replayConfigs bool)
AddScheduler a new scheduler to receive configurations.
Previously scheduled configurations that have not subsequently been unscheduled can be replayed with the replayConfigs flag. This replay occurs immediately, before the AddScheduler call returns.
func (*AutoConfig) ForceRanOnceFlag ¶
func (ac *AutoConfig) ForceRanOnceFlag()
ForceRanOnceFlag sets the ranOnce flag. This is used for testing other components that depend on this value.
func (*AutoConfig) GetAllConfigs ¶
func (ac *AutoConfig) GetAllConfigs() []integration.Config
GetAllConfigs returns all resolved and non-template configs known to AutoConfig.
func (*AutoConfig) GetAutodiscoveryErrors ¶ added in v0.9.0
func (ac *AutoConfig) GetAutodiscoveryErrors() map[string]map[string]providers.ErrorMsgSet
GetAutodiscoveryErrors fetches AD errors from each ConfigProvider. The resulting data structure maps provider name to resource name to a set of unique error messages. The resource names do not match other identifiers and are only intended for display in diagnostic tools like `agent status`.
func (*AutoConfig) GetIDOfCheckWithEncryptedSecrets ¶
func (ac *AutoConfig) GetIDOfCheckWithEncryptedSecrets(checkID checkid.ID) checkid.ID
GetIDOfCheckWithEncryptedSecrets returns the ID that a checkID had before decrypting its secrets. Returns empty if the check with the given ID does not have any secrets.
func (*AutoConfig) GetUnresolvedTemplates ¶
func (ac *AutoConfig) GetUnresolvedTemplates() map[string][]integration.Config
GetUnresolvedTemplates returns all templates in the cache, in their unresolved state.
func (*AutoConfig) HasRunOnce ¶ added in v0.9.0
func (ac *AutoConfig) HasRunOnce() bool
HasRunOnce returns true if the AutoConfig has ran once.
func (*AutoConfig) LoadAndRun ¶
func (ac *AutoConfig) LoadAndRun(ctx context.Context)
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) LoadedConfigs ¶ added in v0.9.0
func (ac *AutoConfig) LoadedConfigs() []integration.Config
LoadedConfigs returns a slice of all loaded configs. Loaded configs are non-template configs, either as received from a config provider or as resolved from a template and a service. They do not include service configs.
The returned slice is freshly created and will not be modified after return.
func (*AutoConfig) MapOverLoadedConfigs ¶ added in v0.9.0
func (ac *AutoConfig) MapOverLoadedConfigs(f func(map[string]integration.Config))
MapOverLoadedConfigs calls the given function with the map of all loaded configs (those that would be returned from LoadedConfigs).
This is done with the config store locked, so callers should perform minimal work within f.
func (*AutoConfig) RemoveScheduler ¶
func (ac *AutoConfig) RemoveScheduler(name string)
RemoveScheduler allows to remove a scheduler from the AD system.
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.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
common
|
|
types
Package types implements common structs used in the Autodiscovery code.
|
Package types implements common structs used in the Autodiscovery code. |
utils
Package utils implements helper methods used in the Autodiscovery code.
|
Package utils implements helper methods used in the Autodiscovery code. |
Package configresolver resolves config templates using information from a service.
|
Package configresolver resolves config templates using information from a service. |
Package integration contains the type that represents a configuration.
|
Package integration contains the type that represents a configuration. |
names
Package names defines the name of each config provider ("container", "cluster-checks", "file", etc.).
|
Package names defines the name of each config provider ("container", "cluster-checks", "file", etc.). |
Package scheduler provides the `Scheduler` interface that should be implemented for any scheduler that wants to plug in `autodiscovery`.
|
Package scheduler provides the `Scheduler` interface that should be implemented for any scheduler that wants to plug in `autodiscovery`. |
Package telemetry defines the Autodiscovery telemetry metrics.
|
Package telemetry defines the Autodiscovery telemetry metrics. |