analysis

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 8, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package analysis provides advanced analytics capabilities for resource utilization and efficiency analysis. It supports multi-dimensional resource analysis including CPU, memory, storage, network, and GPU utilization patterns with trend analysis, anomaly detection, and optimization recommendations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClusterEfficiencyAnalysis

type ClusterEfficiencyAnalysis struct {
	OverallScore       float64                              `json:"overall_score"`
	EfficiencyLevel    EfficiencyLevel                      `json:"efficiency_level"`
	ResourceAnalysis   map[ResourceType]*ResourceEfficiency `json:"resource_analysis"`
	TopRecommendations []Recommendation                     `json:"top_recommendations"`
	EfficiencyTrends   map[ResourceType]*TrendSummary       `json:"efficiency_trends"`
	ClusterUtilization ClusterUtilizationSummary            `json:"cluster_utilization"`
	CostOptimization   *CostOptimizationSummary             `json:"cost_optimization,omitempty"`
	LastAnalyzed       time.Time                            `json:"last_analyzed"`
	AnalysisPeriod     time.Duration                        `json:"analysis_period"`
}

ClusterEfficiencyAnalysis contains overall cluster efficiency analysis

type ClusterUtilizationSummary

type ClusterUtilizationSummary struct {
	TotalNodes      int                      `json:"total_nodes"`
	ActiveNodes     int                      `json:"active_nodes"`
	IdleNodes       int                      `json:"idle_nodes"`
	TotalJobs       int                      `json:"total_jobs"`
	QueuedJobs      int                      `json:"queued_jobs"`
	RunningJobs     int                      `json:"running_jobs"`
	AverageWaitTime time.Duration            `json:"average_wait_time"`
	ResourceWaste   map[ResourceType]float64 `json:"resource_waste"`
}

ClusterUtilizationSummary provides cluster-wide utilization summary

type CostAnalysis

type CostAnalysis struct {
	CurrentCost     float64       `json:"current_cost"`
	OptimizedCost   float64       `json:"optimized_cost"`
	PotentialSaving float64       `json:"potential_saving"`
	ROI             float64       `json:"roi"`
	PaybackPeriod   time.Duration `json:"payback_period"`
}

CostAnalysis provides cost-related analysis

type CostOptimizationSummary

type CostOptimizationSummary struct {
	CurrentMonthlyCost   float64 `json:"current_monthly_cost"`
	OptimizedMonthlyCost float64 `json:"optimized_monthly_cost"`
	MonthlySavings       float64 `json:"monthly_savings"`
	AnnualSavings        float64 `json:"annual_savings"`
	OptimizationROI      float64 `json:"optimization_roi"`
}

CostOptimizationSummary provides cost optimization insights

type EfficiencyLevel

type EfficiencyLevel string

EfficiencyLevel represents efficiency rating levels

const (
	// EfficiencyExcellent is the excellent efficiency level.
	EfficiencyExcellent EfficiencyLevel = "excellent"
	// EfficiencyGood is the good efficiency level.
	EfficiencyGood EfficiencyLevel = "good"
	// EfficiencyFair is the fair efficiency level.
	EfficiencyFair EfficiencyLevel = "fair"
	// EfficiencyPoor is the poor efficiency level.
	EfficiencyPoor EfficiencyLevel = "poor"
	// EfficiencyCritical is the critical efficiency level.
	EfficiencyCritical EfficiencyLevel = "critical"
)

type Percentiles

type Percentiles struct {
	P50 float64 `json:"p50"`
	P75 float64 `json:"p75"`
	P90 float64 `json:"p90"`
	P95 float64 `json:"p95"`
	P99 float64 `json:"p99"`
}

Percentiles contains various percentile values

type Recommendation

type Recommendation struct {
	ID                       string               `json:"id"`
	Title                    string               `json:"title"`
	Description              string               `json:"description"`
	Impact                   RecommendationImpact `json:"impact"`
	Confidence               float64              `json:"confidence"`
	EstimatedSaving          float64              `json:"estimated_saving"`
	ImplementationComplexity string               `json:"implementation_complexity"`
	Priority                 int                  `json:"priority"`
	Category                 string               `json:"category"`
}

Recommendation represents an optimization recommendation

type RecommendationImpact

type RecommendationImpact struct {
	ResourceSaving  float64 `json:"resource_saving"`
	CostSaving      float64 `json:"cost_saving"`
	PerformanceGain float64 `json:"performance_gain"`
	EfficiencyGain  float64 `json:"efficiency_gain"`
}

RecommendationImpact describes the potential impact of a recommendation

type ResourceEfficiency

type ResourceEfficiency struct {
	ResourceType    ResourceType     `json:"resource_type"`
	OverallScore    float64          `json:"overall_score"`
	EfficiencyLevel EfficiencyLevel  `json:"efficiency_level"`
	Utilization     UtilizationStats `json:"utilization"`
	Recommendations []Recommendation `json:"recommendations"`
	TrendAnalysis   *TrendSummary    `json:"trend_analysis,omitempty"`
	CostImpact      *CostAnalysis    `json:"cost_impact,omitempty"`
	LastAnalyzed    time.Time        `json:"last_analyzed"`
}

ResourceEfficiency represents efficiency analysis for a resource type

type ResourceEfficiencyAnalyzer

type ResourceEfficiencyAnalyzer struct {
	// contains filtered or unexported fields
}

ResourceEfficiencyAnalyzer analyzes resource efficiency

func NewResourceEfficiencyAnalyzer

func NewResourceEfficiencyAnalyzer(client *prometheus.CachedClient, collector *historical.HistoricalDataCollector, analyzer *historical.HistoricalAnalyzer) *ResourceEfficiencyAnalyzer

NewResourceEfficiencyAnalyzer creates a new resource efficiency analyzer

func (*ResourceEfficiencyAnalyzer) AnalyzeClusterEfficiency

func (rea *ResourceEfficiencyAnalyzer) AnalyzeClusterEfficiency(ctx context.Context, analysisPeriod time.Duration) (*ClusterEfficiencyAnalysis, error)

AnalyzeClusterEfficiency performs comprehensive cluster efficiency analysis

func (*ResourceEfficiencyAnalyzer) AnalyzeResourceEfficiency

func (rea *ResourceEfficiencyAnalyzer) AnalyzeResourceEfficiency(_ context.Context, resourceType ResourceType, analysisPeriod time.Duration) (*ResourceEfficiency, error)

AnalyzeResourceEfficiency analyzes efficiency for a specific resource type

type ResourceType

type ResourceType string

ResourceType represents different types of cluster resources

const (
	// ResourceCPU is the resource type for CPU resources.
	ResourceCPU ResourceType = "cpu"
	// ResourceMemory is the resource type for memory resources.
	ResourceMemory ResourceType = "memory"
	// ResourceStorage is the resource type for storage resources.
	ResourceStorage ResourceType = "storage"
	// ResourceNetwork is the resource type for network resources.
	ResourceNetwork ResourceType = "network"
	// ResourceGPU is the resource type for GPU resources.
	ResourceGPU ResourceType = "gpu"
)

type TrendSummary

type TrendSummary struct {
	Direction      string    `json:"direction"`
	Slope          float64   `json:"slope"`
	Confidence     float64   `json:"confidence"`
	Prediction     float64   `json:"prediction"`
	PredictionDate time.Time `json:"prediction_date"`
}

TrendSummary provides a summary of trend analysis

type UtilizationStats

type UtilizationStats struct {
	Average           float64       `json:"average"`
	Peak              float64       `json:"peak"`
	Low               float64       `json:"low"`
	StandardDeviation float64       `json:"standard_deviation"`
	Percentiles       Percentiles   `json:"percentiles"`
	WastePercentage   float64       `json:"waste_percentage"`
	IdleTime          time.Duration `json:"idle_time"`
}

UtilizationStats contains utilization statistics

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL