Documentation
¶
Index ¶
- Constants
- type AnomalyDetector
- type BurnRateState
- type ChangeCollector
- func (c *ChangeCollector) GetChangesForLabels(labels map[string]string, start, end time.Time) []ChangeRecord
- func (c *ChangeCollector) GetChangesForNamespace(namespace string, start, end time.Time) []ChangeRecord
- func (c *ChangeCollector) GetChangesInWindow(start, end time.Time) []ChangeRecord
- func (c *ChangeCollector) SetupWithManager(mgr ctrl.Manager) error
- func (c *ChangeCollector) Stats() (count int, oldest time.Time, newest time.Time)
- type ChangeRecord
- type CorrelationEngine
- type ScoredChange
- type SpikeResult
Constants ¶
const ( // DefaultBufferSize is the default number of changes to keep in memory DefaultBufferSize = 1000 // DefaultRetentionDuration is how long to keep changes DefaultRetentionDuration = 4 * time.Hour )
const ( // BurnRateCriticalThreshold is the threshold for critical severity BurnRateCriticalThreshold = 14.0 // BurnRateDegradedThreshold is the threshold for degraded severity BurnRateDegradedThreshold = 6.0 // BurnRateWarningThreshold is the threshold for warning severity BurnRateWarningThreshold = 1.0 // DefaultCooldown is the minimum time between correlations for the same SLO DefaultCooldown = 2 * time.Hour )
const ( // DefaultWindowBefore is how far back to look for changes before the spike DefaultWindowBefore = 30 * time.Minute // DefaultWindowAfter is how far forward to look for changes after the spike DefaultWindowAfter = 10 * time.Minute // HighConfidenceWindow is the window for high confidence correlation HighConfidenceWindow = 15 * time.Minute // MediumConfidenceWindow is the window for medium confidence correlation MediumConfidenceWindow = 60 * time.Minute )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AnomalyDetector ¶
type AnomalyDetector struct {
// contains filtered or unexported fields
}
AnomalyDetector detects burn rate spikes and manages cooldowns
func NewAnomalyDetector ¶
func NewAnomalyDetector() *AnomalyDetector
NewAnomalyDetector creates a new anomaly detector
func NewAnomalyDetectorWithCooldown ¶
func NewAnomalyDetectorWithCooldown(cooldown time.Duration) *AnomalyDetector
NewAnomalyDetectorWithCooldown creates a detector with custom cooldown
func (*AnomalyDetector) Clear ¶
func (d *AnomalyDetector) Clear()
Clear removes all state (mainly for testing)
func (*AnomalyDetector) DetectSpike ¶
func (d *AnomalyDetector) DetectSpike(sloNamespace, sloName string, currentBurnRate float64) *SpikeResult
DetectSpike checks if a burn rate spike occurred and should trigger correlation
func (*AnomalyDetector) GetState ¶
func (d *AnomalyDetector) GetState(sloNamespace, sloName string) *BurnRateState
GetState returns the current state for an SLO (for testing)
func (*AnomalyDetector) ResetCooldown ¶
func (d *AnomalyDetector) ResetCooldown(sloNamespace, sloName string)
ResetCooldown resets the cooldown for an SLO (mainly for testing)
type BurnRateState ¶
BurnRateState tracks the burn rate state for an SLO
type ChangeCollector ¶
type ChangeCollector struct {
// contains filtered or unexported fields
}
ChangeCollector watches Kubernetes resources and records changes in a ring buffer
func NewChangeCollector ¶
func NewChangeCollector() *ChangeCollector
NewChangeCollector creates a new ChangeCollector with default settings
func NewChangeCollectorWithOptions ¶
func NewChangeCollectorWithOptions(bufferSize int, retention time.Duration) *ChangeCollector
NewChangeCollectorWithOptions creates a ChangeCollector with custom settings
func (*ChangeCollector) GetChangesForLabels ¶
func (c *ChangeCollector) GetChangesForLabels(labels map[string]string, start, end time.Time) []ChangeRecord
GetChangesForLabels returns changes filtered by label selector
func (*ChangeCollector) GetChangesForNamespace ¶
func (c *ChangeCollector) GetChangesForNamespace(namespace string, start, end time.Time) []ChangeRecord
GetChangesForNamespace returns changes filtered by namespace
func (*ChangeCollector) GetChangesInWindow ¶
func (c *ChangeCollector) GetChangesInWindow(start, end time.Time) []ChangeRecord
GetChangesInWindow returns all changes within the specified time window
func (*ChangeCollector) SetupWithManager ¶
func (c *ChangeCollector) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager registers the collector to watch resources
type ChangeRecord ¶
type ChangeRecord struct {
Timestamp time.Time
Kind string
Name string
Namespace string
ChangeType string // "create", "update", "delete"
Diff string // human-readable diff (e.g., "image: v1.4.2 → v1.4.3")
Actor string // who triggered the change
Labels map[string]string
}
ChangeRecord represents a single change event in the cluster
type CorrelationEngine ¶
type CorrelationEngine struct {
// contains filtered or unexported fields
}
CorrelationEngine analyzes changes and determines correlations
func NewCorrelationEngine ¶
func NewCorrelationEngine(collector *ChangeCollector) *CorrelationEngine
NewCorrelationEngine creates a new correlation engine
func (*CorrelationEngine) Analyze ¶
func (e *CorrelationEngine) Analyze( sloName, sloNamespace string, triggerTime time.Time, burnRate float64, previousBurnRate float64, severity string, workloadSelector *observabilityv1alpha1.WorkloadSelector, ) *observabilityv1alpha1.SLOCorrelation
Analyze performs correlation analysis for a burn rate spike
type ScoredChange ¶
type ScoredChange struct {
Record ChangeRecord
Confidence string
Score int // internal score for sorting
}
ScoredChange is a ChangeRecord with a confidence score