Documentation ¶
Index ¶
- Variables
- func CollectDefaultMetrics(c integration.Config) bool
- func GetInventoryChecksContext() (inventorychecks.Component, error)
- func GetMetadata(c Info, includeConfig bool) map[string]interface{}
- func InitializeInventoryChecksContext(ic inventorychecks.Component)
- func IsJMXConfig(config integration.Config) bool
- func IsJMXInstance(name string, instance integration.Data, initConfig integration.Data) bool
- func ReleaseContext()
- func Retry(retryDuration time.Duration, retries int, callback func() error, ...) (err error)
- type Check
- type Info
- type Loader
- type MockInfo
- type RetryableError
Constants ¶
This section is empty.
Variables ¶
var ErrSkipCheckInstance = errors.New("refused to load the check instance")
ErrSkipCheckInstance is returned from Configure() when a check is intentionally refusing to load a check instance, and NOT due to an error. The distinction is important for deciding whether or not to log the error and report it on the status page.
Loaders should check for this error after calling Configure() and should not log it as an error. The scheduler reports this error to the agent status if and only if all loaders fail to load the check instance.
Usage example: one version of the check is written in Python, and another is written in Golang. Each loader is called on the given configuration, and will reject the configuration if it does not match the right version, without raising errors to the log or agent status. If another error is returned then the errors will be properly logged and reported in the agent status.
Functions ¶
func CollectDefaultMetrics ¶
func CollectDefaultMetrics(c integration.Config) bool
CollectDefaultMetrics returns if the config is for a JMX check which has collect_default_metrics: true
func GetInventoryChecksContext ¶
func GetInventoryChecksContext() (inventorychecks.Component, error)
GetInventoryChecksContext returns a reference to the inventorychecks component for Python and Go checks to use.
func GetMetadata ¶
GetMetadata returns information about a specific check instances. If 'includeConfig' it true, the instance configuration will be scrubbed and included in the returned map
func InitializeInventoryChecksContext ¶
func InitializeInventoryChecksContext(ic inventorychecks.Component)
InitializeInventoryChecksContext set the reference to inventorychecks in checkContext
func IsJMXConfig ¶
func IsJMXConfig(config integration.Config) bool
IsJMXConfig checks if a certain YAML config contains at least one instance of a JMX config
func IsJMXInstance ¶
func IsJMXInstance(name string, instance integration.Data, initConfig integration.Data) bool
IsJMXInstance checks if a certain YAML instance is a JMX config
func ReleaseContext ¶
func ReleaseContext()
ReleaseContext reset to nil all the references hold by the current context
Types ¶
type Check ¶
type Check interface { // Run runs the check Run() error // Stop stops the check if it's running Stop() // Cancel cancels the check. Cancel is called when the check is unscheduled: // - unlike Stop, it is called even if the check is not running when it's unscheduled // - if the check is running, Cancel is called after Stop and may be called before the call to Stop completes Cancel() // String provides a printable version of the check name String() string // Configure configures the check Configure(senderManger sender.SenderManager, integrationConfigDigest uint64, config, initConfig integration.Data, source string) error // Interval returns the interval time for the check Interval() time.Duration // ID provides a unique identifier for every check instance ID() checkid.ID // GetWarnings returns the last warning registered by the check GetWarnings() []error // GetSenderStats returns the stats from the last run of the check. GetSenderStats() (stats.SenderStats, error) // Version returns the version of the check if available Version() string // ConfigSource returns the configuration source of the check ConfigSource() string // IsTelemetryEnabled returns if telemetry is enabled for this check IsTelemetryEnabled() bool // InitConfig returns the init_config configuration of the check InitConfig() string // InstanceConfig returns the instance configuration of the check InstanceConfig() string // GetDiagnoses returns the diagnoses cached in last run or diagnose explicitly GetDiagnoses() ([]diagnosis.Diagnosis, error) }
Check is an interface for types capable to run checks
type Info ¶
type Info interface { // String provides a printable version of the check name String() string // Interval returns the interval time for the check Interval() time.Duration // ID provides a unique identifier for every check instance ID() checkid.ID // Version returns the version of the check if available Version() string // ConfigSource returns the configuration source of the check ConfigSource() string // InitConfig returns the init_config configuration of the check InitConfig() string // InstanceConfig returns the instance configuration of the check InstanceConfig() string }
Info is an interface to pull information from types capable to run checks. This is a subsection from the Check interface with only read only method.
type Loader ¶
type Loader interface { Name() string Load(senderManager sender.SenderManager, config integration.Config, instance integration.Data) (Check, error) }
Loader is the interface wrapping the operations to load a check from different sources, like Python modules or Go objects.
A single check is loaded for the given `instance` YAML.
type MockInfo ¶
type MockInfo struct { Name string CheckID checkid.ID Source string InitConf string InstanceConf string }
MockInfo is a mock for test using check.Info interface
func (MockInfo) ConfigSource ¶
ConfigSource returns the source of the check
func (MockInfo) InitConfig ¶
InitConfig returns the init_config of the check
func (MockInfo) InstanceConfig ¶
InstanceConfig returns the instance config of the check
type RetryableError ¶
type RetryableError struct {
Err error
}
RetryableError is the error type that Retry interprets as a request to retry the callback
func (RetryableError) Error ¶
func (e RetryableError) Error() string