Documentation ¶
Index ¶
- Variables
- 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)
- func TranslateEventPlatformEventTypes(aggregatorStats interface{}) (interface{}, error)
- type Check
- type ID
- type Loader
- type RetryableError
- type SenderStats
- 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) GetSenderStats() (SenderStats, 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 ¶
var EventPlatformNameTranslations = map[string]string{
"dbm-samples": "Database Monitoring Query Samples",
"dbm-metrics": "Database Monitoring Query Metrics",
"dbm-activity": "Database Monitoring Activity Samples",
"network-devices-metadata": "Network Devices Metadata",
}
EventPlatformNameTranslations contains human readable translations for event platform event types
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
func Retry ¶
func Retry(retryDuration time.Duration, retries int, callback func() error, friendlyName string) (err error)
Retry retries a callback up to `retries`-times in a `retryDuration` period of time, and bails out if the limit is reached.
func TranslateEventPlatformEventTypes ¶ added in v0.9.0
func TranslateEventPlatformEventTypes(aggregatorStats interface{}) (interface{}, error)
TranslateEventPlatformEventTypes translates the event platform event types in aggregator stats to human readable names
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 // GetSenderStats returns the stats from the last run of the check. GetSenderStats() (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 }
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 SenderStats ¶ added in v0.9.0
type SenderStats struct { MetricSamples int64 Events int64 ServiceChecks int64 HistogramBuckets int64 // EventPlatformEvents tracks the number of events submitted for each eventType EventPlatformEvents map[string]int64 }
SenderStats contains statistics showing the count of various types of telemetry sent by a check sender
func NewSenderStats ¶ added in v0.9.0
func NewSenderStats() SenderStats
NewSenderStats creates a new SenderStats
func (SenderStats) Copy ¶ added in v0.9.0
func (s SenderStats) Copy() (result SenderStats)
Copy creates a copy of the current SenderStats
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 EventPlatformEvents map[string]int64 TotalEventPlatformEvents map[string]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 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 ¶ added in v0.9.0
type StubCheck struct{}
StubCheck stubs a check, should only be used in tests
func (*StubCheck) ConfigSource ¶ added in v0.9.0
ConfigSource returns the empty string
func (*StubCheck) Configure ¶ added in v0.9.0
func (c *StubCheck) Configure(integration.Data, integration.Data, string) error
Configure is a noop
func (*StubCheck) GetSenderStats ¶ added in v0.9.0
func (c *StubCheck) GetSenderStats() (SenderStats, error)
GetSenderStats returns an empty map
func (*StubCheck) GetWarnings ¶ added in v0.9.0
GetWarnings returns an empty slice
func (*StubCheck) IsTelemetryEnabled ¶ added in v0.9.0
IsTelemetryEnabled returns false