Documentation ¶
Index ¶
- Constants
- func IsConfigJMX(name string, initConf ConfigData) bool
- func Retry(retryDuration time.Duration, retries int, callback func() error, ...) (err error)
- type Check
- type Config
- func (c *Config) AddMetrics(metrics ConfigData) error
- func (c *Config) CollectDefaultMetrics() bool
- func (c *Config) Digest() string
- func (c *Config) Equal(config *Config) bool
- func (c *Config) GetTemplateVariablesForInstance(i int) (vars [][]byte)
- func (c *Config) IsTemplate() bool
- func (c *Config) String() string
- type ConfigData
- type ConfigJSONMap
- type ConfigRawMap
- type ID
- type Loader
- type RetryableError
- type Stats
Constants ¶
const ( // DefaultCheckInterval is the interval in seconds the scheduler should apply // when no value was provided in Check configuration. DefaultCheckInterval time.Duration = 15 * time.Second )
Variables ¶
This section is empty.
Functions ¶
func IsConfigJMX ¶
func IsConfigJMX(name string, initConf ConfigData) bool
IsConfigJMX checks if a certain YAML config is a JMX config
Types ¶
type Check ¶
type Check interface { Run() error // run the check Stop() // stop the check if it's running String() string // provide a printable version of the check name Configure(config, initConfig ConfigData) error // configure the check from the outside Interval() time.Duration // return the interval time for the check ID() ID // provide a unique identifier for every check instance GetWarnings() []error // return the last warning registered by the check GetMetricStats() (map[string]int64, error) // get metric stats from the sender }
Check is an interface for types capable to run checks
type Config ¶
type Config struct { Name string // the name of the check Instances []ConfigData // array of Yaml configurations InitConfig ConfigData // the init_config in Yaml (python check only) MetricConfig ConfigData // the metric config in Yaml (jmx check only) LogsConfig ConfigData // the logs config in Yaml (logs-agent only) ADIdentifiers []string // the list of AutoDiscovery identifiers (optional) }
Config is a generic container for configuration files
func (*Config) AddMetrics ¶
func (c *Config) AddMetrics(metrics ConfigData) error
AddMetrics adds metrics to a check configuration
func (*Config) CollectDefaultMetrics ¶
CollectDefaultMetrics returns if the config is for a JMX check which has collect_default_metrics: true
func (*Config) Digest ¶
Digest returns an hash value representing the data stored in this configuration
func (*Config) GetTemplateVariablesForInstance ¶
GetTemplateVariablesForInstance returns a slice of raw template variables it found in a config instance template.
func (*Config) IsTemplate ¶
IsTemplate returns if the config has AD identifiers and template variables
type ConfigData ¶
type ConfigData []byte
ConfigData contains YAML code
func (*ConfigData) MergeAdditionalTags ¶
func (c *ConfigData) MergeAdditionalTags(tags []string) error
MergeAdditionalTags merges additional tags to possible existing config tags
type ConfigJSONMap ¶
type ConfigJSONMap map[string]interface{}
ConfigJSONMap is the generic type to hold YAML configurations
type ConfigRawMap ¶
type ConfigRawMap map[interface{}]interface{}
ConfigRawMap is the generic type to hold YAML configurations
type ID ¶
type ID string
ID is the representation of the unique ID of a Check instance
func BuildID ¶
func BuildID(checkName string, instance, initConfig ConfigData) ID
BuildID returns an unique ID for a check name and its configuration
func Identify ¶
func Identify(check Check, instance ConfigData, initConfig ConfigData) ID
Identify returns an unique ID for a check and its configuration
type Loader ¶
Loader is the interface wrapping the operations to load a check from different sources, like Python modules or Go objects.
A check is loaded for every `instance` found in the configuration file. Load is supposed to break down instances and return different checks.
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
type Stats ¶
type Stats struct { CheckName string CheckID ID TotalRuns uint64 TotalErrors uint64 TotalWarnings uint64 Metrics int64 Events int64 ServiceChecks int64 TotalMetrics int64 TotalEvents int64 TotalServiceChecks int64 ExecutionTimes [32]int64 // circular buffer of recent run durations, most recent at [(TotalRuns+31) % 32] LastExecutionTime int64 // most recent run duration, provided for convenience LastError string // error that occurred in the last run, if any LastWarnings []string // warnings that occurred in the last run, if any UpdateTimestamp int64 // latest update to this instance, unix timestamp in seconds // contains filtered or unexported fields }
Stats holds basic runtime statistics about check instances