mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-04-28 11:30:15 +00:00
Create internal/ai/correlation package: 1. Correlation Detector (detector.go): - Tracks events across resources - Detects when events on one resource follow events on another - Calculates average delay between correlated events - Confidence scoring based on occurrence count - Persists to ai_correlations.json 2. Features: - GetCorrelations() - All detected relationships - GetCorrelationsForResource() - Relationships for one resource - GetDependencies() - What resources depend on this one - GetDependsOn() - What this resource depends on - PredictCascade() - Predict what will be affected - FormatForContext() - AI-consumable summary 3. Integration: - Wire to alert history in router startup - Map alert types to correlation event types - Add correlation context to enriched AI context Example AI context now includes: 'When local-zfs experiences high usage, database often follows within 5 minutes' This enables the AI to understand infrastructure dependencies and predict cascade failures. All tests passing.
44 lines
1.5 KiB
Go
44 lines
1.5 KiB
Go
package ai
|
|
|
|
import (
|
|
"github.com/rcourtman/pulse-go-rewrite/internal/ai/correlation"
|
|
)
|
|
|
|
// CorrelationDetector is an alias for correlation.Detector
|
|
type CorrelationDetector = correlation.Detector
|
|
|
|
// CorrelationConfig is an alias for correlation.Config
|
|
type CorrelationConfig = correlation.Config
|
|
|
|
// CorrelationEvent is an alias for correlation.Event
|
|
type CorrelationEvent = correlation.Event
|
|
|
|
// Correlation is an alias for correlation.Correlation
|
|
type Correlation = correlation.Correlation
|
|
|
|
// CascadePrediction is an alias for correlation.CascadePrediction
|
|
type CascadePrediction = correlation.CascadePrediction
|
|
|
|
// CorrelationEventType is an alias for correlation.EventType
|
|
type CorrelationEventType = correlation.EventType
|
|
|
|
// Event type constants
|
|
const (
|
|
CorrelationEventAlert = correlation.EventAlert
|
|
CorrelationEventRestart = correlation.EventRestart
|
|
CorrelationEventHighCPU = correlation.EventHighCPU
|
|
CorrelationEventHighMem = correlation.EventHighMem
|
|
CorrelationEventDiskFull = correlation.EventDiskFull
|
|
CorrelationEventOffline = correlation.EventOffline
|
|
CorrelationEventMigration = correlation.EventMigration
|
|
)
|
|
|
|
// NewCorrelationDetector creates a new correlation detector
|
|
func NewCorrelationDetector(cfg CorrelationConfig) *CorrelationDetector {
|
|
return correlation.NewDetector(cfg)
|
|
}
|
|
|
|
// DefaultCorrelationConfig returns default correlation detector configuration
|
|
func DefaultCorrelationConfig() CorrelationConfig {
|
|
return correlation.DefaultConfig()
|
|
}
|