Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActionPlan ¶
type ActionPlan struct {
Type string
Description string
RiskScore float64
ImpactScore float64
EstSavings float64
}
ActionPlan represents a proposed optimization action
type AnalysisVector ¶
type AnalysisVector struct {
Name string
Score float64
Weight float64
Findings []string
Confidence float64
}
AnalysisVector represents a dimension of analysis
type ArbitrageEngine ¶
type ArbitrageEngine struct {
Adapter cloud.CloudAdapter
}
ArbitrageEngine hunts for price discrepancies between Availability Zones
func NewArbitrageEngine ¶
func NewArbitrageEngine(adapter cloud.CloudAdapter) *ArbitrageEngine
func (*ArbitrageEngine) FindArbitrageOpportunity ¶
func (e *ArbitrageEngine) FindArbitrageOpportunity(currentZone string, instanceType string) (*ActionPlan, error)
FindArbitrageOpportunity checks if moving a workload can save > 20%
type EngineConfig ¶
type EngineConfig struct {
MaxConcurrentCycles int `yaml:"max_concurrent_cycles"`
MaxConcurrentAnalysis int `yaml:"max_concurrent_analysis"`
CycleInterval time.Duration `yaml:"cycle_interval"`
RiskThreshold float64 `yaml:"risk_threshold"`
MinSavingsThreshold float64 `yaml:"min_savings_threshold"`
MaxAnalysisTime time.Duration `yaml:"max_analysis_time"`
EnableAutoExecution bool `yaml:"enable_auto_execution"`
RequireHumanApproval bool `yaml:"require_human_approval"`
DefaultSavingsRatio float64 `yaml:"default_savings_ratio"`
}
EngineConfig holds configuration for the OODA engine
func DefaultEngineConfig ¶
func DefaultEngineConfig() *EngineConfig
DefaultEngineConfig returns default engine configuration
func ProductionEngineConfig ¶
func ProductionEngineConfig() *EngineConfig
ProductionEngineConfig returns production engine configuration
type OODAEngine ¶
type OODAEngine struct {
// contains filtered or unexported fields
}
OODAEngine implements the OODA loop for cloud optimization
func NewOODAEngine ¶
func NewOODAEngine( aiOrchestrator *ai.UnifiedOrchestrator, cloudAdapter cloud.CloudAdapter, repository Repository, securityCtrl *security.SecurityController, logger *zap.Logger, tracer trace.Tracer, config *EngineConfig, ) *OODAEngine
NewOODAEngine creates a new OODA engine
type Opportunity ¶
type Opportunity struct {
ID string
ResourceID string
Description string
Savings float64
Confidence float64
ActionType string // e.g., "resize", "stop", "switch_region"
}
Opportunity represents a detected optimization chance
func (*Opportunity) PredictSavings ¶
func (o *Opportunity) PredictSavings() float64
PredictSavings returns an estimated dollar amount
type OptimizationOpportunity ¶
type OptimizationOpportunity struct {
Resource *cloud.ResourceV2
AnalysisVectors []AnalysisVector
RiskScore float64
Recommendations []string
EstimatedSavings float64
Confidence float64
}
OptimizationOpportunity represents a potential optimization
type Oracle ¶
type Oracle struct {
// contains filtered or unexported fields
}
Oracle is the predictive engine
func (*Oracle) ForecastMetric ¶
func (o *Oracle) ForecastMetric(ctx context.Context, metricName string, horizon time.Duration) (*Forecast, error)
ForecastMetric predicts future values for a metric using simple linear regression (for now) In production, this would interface with a more complex model or external ML service via Python SDK
type Repository ¶
type Repository interface {
CreateAction(ctx context.Context, action *database.Action) error
UpdateActionStatus(ctx context.Context, id string, status string, startedAt *time.Time, completedAt *time.Time, errorMsg *string) error
CreateSavingsEvent(ctx context.Context, event *database.SavingsEvent) error
}
Repository defines the interface for data persistence required by the engine
type ScalingEngine ¶
type ScalingEngine struct {
// contains filtered or unexported fields
}
ScalingEngine handles proactive scaling based on predictions
func NewScalingEngine ¶
func NewScalingEngine(oracle *Oracle, mem *memory.MemoryStore) *ScalingEngine
func (*ScalingEngine) EvaluateScalingNeeds ¶
func (e *ScalingEngine) EvaluateScalingNeeds(ctx context.Context, resourceID string) error
EvaluateScalingNeeds checks if resources need proactive scaling
type Scheduler ¶
type Scheduler struct{}
func NewScheduler ¶
func NewScheduler() *Scheduler
func (*Scheduler) GenerateSchedulePlan ¶
func (s *Scheduler) GenerateSchedulePlan(res *cloud.ResourceV2) (*ActionPlan, error)
func (*Scheduler) IsIndieForceWindow ¶
IsIndieForceWindow returns true during 12 AM - 6 AM (Deep Night)