Documentation ¶
Index ¶
- func CollectDefaultMetrics(c integration.Config) bool
- func IDToCheckName(id ID) string
- func IsJMXConfig(config integration.Config) bool
- func IsJMXInstance(name string, instance integration.Data, initConfig 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
- type StubCheck
- func (c *StubCheck) Cancel()
- func (c *StubCheck) ConfigSource() string
- func (c *StubCheck) Configure(integration.Data, integration.Data, string) error
- func (c *StubCheck) GetMetricStats() (map[string]int64, error)
- func (c *StubCheck) GetWarnings() []error
- func (c *StubCheck) ID() ID
- func (c *StubCheck) Interval() time.Duration
- func (c *StubCheck) IsTelemetryEnabled() bool
- func (c *StubCheck) Run() error
- func (c *StubCheck) Stop()
- func (c *StubCheck) String() string
- func (c *StubCheck) Version() string
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(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
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(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() ID // GetWarnings returns the last warning registered by the check GetWarnings() []error // GetMetricStats gets metric stats from the sender GetMetricStats() (map[string]int64, 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 }
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 { Name() string Load(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 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 CheckConfigSource string CheckID ID TotalRuns uint64 TotalErrors uint64 TotalWarnings uint64 MetricSamples int64 Events int64 ServiceChecks int64 TotalMetricSamples uint64 TotalEvents uint64 TotalServiceChecks uint64 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 LastSuccessDate int64 // most recent successful execution date, unix timestamp in seconds 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
type StubCheck ¶
type StubCheck struct{}
StubCheck stubs a check, should only be used in tests
func (*StubCheck) ConfigSource ¶
ConfigSource returns the empty string
func (*StubCheck) Configure ¶
func (c *StubCheck) Configure(integration.Data, integration.Data, string) error
Configure is a noop
func (*StubCheck) GetMetricStats ¶
GetMetricStats returns an empty map
func (*StubCheck) GetWarnings ¶
GetWarnings returns an empty slice
func (*StubCheck) IsTelemetryEnabled ¶
IsTelemetryEnabled returns false