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 STSTestCheck
- func (c *STSTestCheck) ConfigSource() string
- func (c *STSTestCheck) Configure(integration.Data, integration.Data, string) error
- func (c *STSTestCheck) GetMetricStats() (map[string]int64, error)
- func (c *STSTestCheck) GetWarnings() []error
- func (c *STSTestCheck) ID() ID
- func (c *STSTestCheck) Interval() time.Duration
- func (c *STSTestCheck) IsTelemetryEnabled() bool
- func (c *STSTestCheck) Run() error
- func (c *STSTestCheck) Stop()
- func (c *STSTestCheck) String() string
- func (c *STSTestCheck) Version() string
- 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) GetFeatures() features.Features
- 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) SetFeatures(features features.Features)
- 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 ¶
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 // Set the StackState features SetFeatures(features features.Features) // Get the StackState features GetFeatures() features.Features }
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 STSTestCheck ¶
type STSTestCheck struct {
Name string
}
STSTestCheck is a test implementation of the Check interface
func (*STSTestCheck) ConfigSource ¶
func (c *STSTestCheck) ConfigSource() string
ConfigSource returns test-config-source
func (*STSTestCheck) Configure ¶
func (c *STSTestCheck) Configure(integration.Data, integration.Data, string) error
Configure returns nil, noop
func (*STSTestCheck) GetMetricStats ¶
func (c *STSTestCheck) GetMetricStats() (map[string]int64, error)
GetMetricStats returns an empty map
func (*STSTestCheck) GetWarnings ¶
func (c *STSTestCheck) GetWarnings() []error
GetWarnings returns an empty []error
func (*STSTestCheck) IsTelemetryEnabled ¶
func (c *STSTestCheck) IsTelemetryEnabled() bool
IsTelemetryEnabled false for STSTestCheck
func (*STSTestCheck) String ¶
func (c *STSTestCheck) String() string
String returns the Check Name as a string
func (*STSTestCheck) Version ¶
func (c *STSTestCheck) Version() string
Version returns a empty string
type SenderStats ¶
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 (SenderStats) Copy ¶
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 ¶
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) GetFeatures ¶
GetFeatures is a noop
func (*StubCheck) GetSenderStats ¶
func (c *StubCheck) GetSenderStats() (SenderStats, error)
GetSenderStats returns an empty map
func (*StubCheck) GetWarnings ¶
GetWarnings returns an empty slice
func (*StubCheck) IsTelemetryEnabled ¶
IsTelemetryEnabled returns false
func (*StubCheck) SetFeatures ¶
SetFeatures is a noop