autodiscoveryimpl

package
v0.0.0-...-2feb83d Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Overview

Package autodiscoveryimpl implements the agent's autodiscovery mechanism.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetConfigErrors

func GetConfigErrors() map[string]string

GetConfigErrors gets the config errors

func GetResolveWarnings

func GetResolveWarnings() map[string][]string

GetResolveWarnings get the resolve warnings/errors

func Module

func Module() fxutil.Module

Module defines the fx options for this component.

func OptionalModule

func OptionalModule() fxutil.Module

OptionalModule defines the fx options when ac should be used as an optional and not started

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 (*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

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) GetProviderCatalog

func (ac *AutoConfig) GetProviderCatalog() map[string]providers.ConfigProviderFactory

GetProviderCatalog returns all registered ConfigProviderFactory.

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

func (ac *AutoConfig) HasRunOnce() bool

HasRunOnce returns true if the AutoConfig has ran once.

func (*AutoConfig) IsStarted

func (ac *AutoConfig) IsStarted() bool

IsStarted returns true if the AutoConfig has been started.

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

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

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) Start

func (ac *AutoConfig) Start()

Start will listen to the service channels before anything is sent to them Usually, Start and Stop methods should not be in the component interface as it should be handled using Lifecycle hooks. We make exceptions here because we need to disable it at runtime.

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.

Jump to

Keyboard shortcuts

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