Documentation ¶
Index ¶
- func CollectDefaultMetrics(c integration.Config) bool
- func IDToCheckName(id ID) string
- func IsJMXConfig(name string, initConf integration.Data) bool
- func Retry(retryDuration time.Duration, retries int, callback func() error, ...) (err error)
- type Check
- type ID
- type Loader
- type RetryableError
- type Stats
Constants ¶
This section is empty.
Variables ¶
This section is empty.
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 IDToCheckName ¶
IDToCheckName returns the check name from a check ID
func IsJMXConfig ¶
func IsJMXConfig(name string, initConf integration.Data) bool
IsJMXConfig 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 integration.Data) 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 Version() string // return the version of the check if available }
Check is an interface for types capable to run checks
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 integration.Data) ID
BuildID returns an unique ID for a check name and its configuration
func Identify ¶
func Identify(check Check, instance integration.Data, initConfig integration.Data) ID
Identify returns an unique ID for a check and its configuration
type Loader ¶
type Loader interface {
Load(config integration.Config) ([]Check, error)
}
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 CheckVersion string CheckID ID TotalRuns uint64 TotalErrors uint64 TotalWarnings uint64 MetricSamples int64 Events int64 ServiceChecks int64 TotalMetricSamples int64 TotalEvents int64 TotalServiceChecks int64 ExecutionTimes [32]int64 // circular buffer of recent run durations, most recent at [(TotalRuns+31) % 32] AverageExecutionTime int64 // average run duration 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