Skip to content

Commit

Permalink
flag integrations as ha compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
jedupau committed Feb 11, 2025
1 parent 970c555 commit 85ba6a6
Show file tree
Hide file tree
Showing 12 changed files with 54 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -147,3 +147,8 @@ func (c *CheckWrapper) GetDiagnoses() ([]diagnosis.Diagnosis, error) {
func (c *CheckWrapper) IsHAEnabled() bool {
return c.inner.IsHAEnabled()
}

// IsHASupported implements Check#IsHASupported
func (c *CheckWrapper) IsHASupported() bool {
return c.inner.IsHASupported()
}
2 changes: 2 additions & 0 deletions pkg/collector/check/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ type Check interface {
GetDiagnoses() ([]diagnosis.Diagnosis, error)
// IsHAEnabled returns if High Availability is enabled for this check
IsHAEnabled() bool
// IsHASupported returns if the check is compatible with High Availability
IsHASupported() bool
}

// Info is an interface to pull information from types capable to run checks. This is a subsection from the Check
Expand Down
1 change: 1 addition & 0 deletions pkg/collector/check/stats/stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ func NewStats(c StatsCheck) *Stats {
EventPlatformEvents: make(map[string]int64),
TotalEventPlatformEvents: make(map[string]int64),
HAEnabled: c.IsHAEnabled(),
// HACompatible ?
}

// We are interested in a check's run state values even when they are 0 so we
Expand Down
3 changes: 3 additions & 0 deletions pkg/collector/check/stub/stub.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,6 @@ func (c *StubCheck) GetDiagnoses() ([]diagnosis.Diagnosis, error) { return nil,

// IsHAEnabled returns false
func (c *StubCheck) IsHAEnabled() bool { return false }

// IsHASupported returns false
func (c *StubCheck) IsHASupported() bool { return false }
8 changes: 8 additions & 0 deletions pkg/collector/corechecks/checkbase.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,9 @@ func (c *CheckBase) CommonConfigure(senderManager sender.SenderManager, initConf

if commonOptions.HAEnabled != nil {
c.haEnabled = *commonOptions.HAEnabled
if c.haEnabled && !c.IsHASupported() {
return fmt.Errorf("High Availability is enabled for check %s but this integration does not support it", string(c.ID()))
}
}

c.source = source
Expand Down Expand Up @@ -295,3 +298,8 @@ func (c *CheckBase) GetDiagnoses() ([]diagnosis.Diagnosis, error) {
func (c *CheckBase) IsHAEnabled() bool {
return c.haEnabled
}

// IsHASupported returns if the check is compatible with High Availability
func (c *CheckBase) IsHASupported() bool {
return false
}
5 changes: 5 additions & 0 deletions pkg/collector/corechecks/embed/apm/apm.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,11 @@ func (c *APMCheck) IsHAEnabled() bool {
return false
}

// IsHASupported returns if the check is compatible with High Availability
func (c *APMCheck) IsHASupported() bool {
return false
}

// Factory creates a new check factory
func Factory() option.Option[func() check.Check] {
return option.New(newCheck)
Expand Down
5 changes: 5 additions & 0 deletions pkg/collector/corechecks/embed/process/process_agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,11 @@ func (c *ProcessAgentCheck) IsHAEnabled() bool {
return false
}

// IsHASupported returns if the check is compatible with High Availability
func (c *ProcessAgentCheck) IsHASupported() bool {
return false
}

// Factory creates a new check factory
func Factory() option.Option[func() check.Check] {
return option.New(newCheck)
Expand Down
5 changes: 5 additions & 0 deletions pkg/collector/corechecks/longrunning_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@ func (m *mockLongRunningCheck) IsHAEnabled() bool {
return args.Bool(0)
}

func (m *mockLongRunningCheck) IsHASupported() bool {
args := m.Called()
return args.Bool(0)
}

func (m *mockLongRunningCheck) GetSender() (sender.Sender, error) {
args := m.Called()
s := args.Get(0)
Expand Down
5 changes: 5 additions & 0 deletions pkg/collector/corechecks/network-devices/cisco-sdwan/sdwan.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,11 @@ func (c *CiscoSdwanCheck) Interval() time.Duration {
return c.interval
}

// IsHASupported returns true if the check supports HA
func (c *CiscoSdwanCheck) IsHASupported() bool {
return true
}

func boolPointer(b bool) *bool {
return &b
}
Expand Down
5 changes: 5 additions & 0 deletions pkg/collector/corechecks/networkpath/networkpath.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,11 @@ func (c *Check) Configure(senderManager sender.SenderManager, integrationConfigD
return nil
}

// IsHASupported returns true if the check supports HA
func (c *Check) IsHASupported() bool {
return true
}

// Factory creates a new check factory
func Factory(telemetry telemetryComp.Component) option.Option[func() check.Check] {
return option.New(func() check.Check {
Expand Down
5 changes: 5 additions & 0 deletions pkg/collector/corechecks/snmp/snmp.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,11 @@ func (c *Check) GetDiagnoses() ([]diagnosis.Diagnosis, error) {
return c.singleDeviceCk.GetDiagnoses(), nil
}

// IsHASupported returns true if the check supports HA
func (c *Check) IsHASupported() bool {
return true
}

// Factory creates a new check factory
func Factory(agentConfig config.Component) option.Option[func() check.Check] {
return option.New(func() check.Check {
Expand Down
5 changes: 5 additions & 0 deletions pkg/collector/python/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,11 @@ func (c *PythonCheck) IsHAEnabled() bool {
return c.haEnabled
}

// IsHASupported returns if the check is compatible with High Availability
func (c *PythonCheck) IsHASupported() bool {
return false
}

// pythonCheckFinalizer is a finalizer that decreases the reference count on the PyObject refs owned
// by the PythonCheck.
func pythonCheckFinalizer(c *PythonCheck) {
Expand Down

0 comments on commit 85ba6a6

Please sign in to comment.