Documentation
¶
Index ¶
- type AggregateQuery
- type AggregateType
- type AggregatedMetric
- type AlertAction
- type AlertContext
- type AlertManager
- type AlertPriority
- type AlertSeverity
- type AlertTriggerType
- type AnalyticsDataStore
- type AnomalyContext
- type AnomalyDetector
- type AnomalyImpact
- type AnomalySeverity
- type AnomalyType
- type ConcurrentEvent
- type CorrelationMatrix
- type CostEstimate
- type DistributionAnalysis
- type EffortLevel
- type ForecastPoint
- type ImpactLevel
- type MetricQuery
- type OutlierPoint
- type Pattern
- type PerformanceAlert
- type PerformanceAnalysis
- type PerformanceAnalyticsConfig
- type PerformanceAnalyticsEngine
- func (pae *PerformanceAnalyticsEngine) AnalyzePerformance(ctx context.Context, timeRange TimeRange) (*PerformanceAnalysis, error)
- func (pae *PerformanceAnalyticsEngine) SetAlertManager(alertMgr AlertManager)
- func (pae *PerformanceAnalyticsEngine) SetAnomalyDetector(detector AnomalyDetector)
- func (pae *PerformanceAnalyticsEngine) SetDataStore(dataStore AnalyticsDataStore)
- func (pae *PerformanceAnalyticsEngine) SetThresholdManager(thresholdMgr ThresholdManager)
- func (pae *PerformanceAnalyticsEngine) SetTrendAnalyzer(analyzer TrendAnalyzer)
- func (pae *PerformanceAnalyticsEngine) Start(ctx context.Context) error
- func (pae *PerformanceAnalyticsEngine) Stop() error
- type PerformanceAnomaly
- type PerformanceMetric
- type PerformancePrediction
- type PerformanceRecommendation
- type PerformanceStatistics
- type PerformanceTrend
- type PredictionBands
- type PredictionScenario
- type PredictionType
- type Priority
- type RecommendationCategory
- type RecommendedAction
- type RelatedMetric
- type RiskFactor
- type SeasonalityPattern
- type Threshold
- type ThresholdManager
- type ThresholdOperator
- type ThresholdViolation
- type TimeRange
- type TrendAnalyzer
- type TrendDirection
- type TrendForecast
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AggregateQuery ¶
type AggregateQuery struct {
MetricQuery
AggregateType AggregateType `json:"aggregate_type"`
GroupBy []string `json:"group_by"`
Interval time.Duration `json:"interval"`
}
type AggregateType ¶
type AggregateType string
Enums and constants
const ( AggregateTypeSum AggregateType = "sum" AggregateTypeAvg AggregateType = "avg" AggregateTypeMin AggregateType = "min" AggregateTypeMax AggregateType = "max" AggregateTypeCount AggregateType = "count" AggregateTypeP50 AggregateType = "p50" AggregateTypeP90 AggregateType = "p90" AggregateTypeP95 AggregateType = "p95" AggregateTypeP99 AggregateType = "p99" )
type AggregatedMetric ¶
type AlertAction ¶
type AlertContext ¶
type AlertManager ¶
type AlertPriority ¶
type AlertPriority string
const ( AlertPriorityLow AlertPriority = "low" AlertPriorityMedium AlertPriority = "medium" AlertPriorityHigh AlertPriority = "high" AlertPriorityUrgent AlertPriority = "urgent" )
type AlertSeverity ¶
type AlertSeverity string
const ( AlertSeverityInfo AlertSeverity = "info" AlertSeverityWarning AlertSeverity = "warning" AlertSeverityError AlertSeverity = "error" AlertSeverityCritical AlertSeverity = "critical" )
type AlertTriggerType ¶
type AlertTriggerType string
const ( AlertTriggerThreshold AlertTriggerType = "threshold" AlertTriggerAnomaly AlertTriggerType = "anomaly" AlertTriggerTrend AlertTriggerType = "trend" AlertTriggerForecast AlertTriggerType = "forecast" )
type AnalyticsDataStore ¶
type AnalyticsDataStore interface {
StoreMetric(ctx context.Context, metric *PerformanceMetric) error
GetMetrics(ctx context.Context, query MetricQuery) ([]PerformanceMetric, error)
GetAggregatedMetrics(ctx context.Context, query AggregateQuery) ([]AggregatedMetric, error)
DeleteOldMetrics(ctx context.Context, before time.Time) error
GetMetricNames() []string
}
Supporting types and interfaces
type AnomalyContext ¶
type AnomalyContext struct {
PrecedingTrend string `json:"preceding_trend"`
ConcurrentEvents []ConcurrentEvent `json:"concurrent_events"`
RelatedMetrics []RelatedMetric `json:"related_metrics"`
SystemState map[string]any `json:"system_state"`
}
type AnomalyDetector ¶
type AnomalyDetector interface {
DetectAnomalies(ctx context.Context, metrics []PerformanceMetric) ([]PerformanceAnomaly, error)
TrainModel(ctx context.Context, historicalData []PerformanceMetric) error
UpdateBaseline(ctx context.Context, metrics []PerformanceMetric) error
GetDetectionSensitivity() float64
SetDetectionSensitivity(sensitivity float64)
}
type AnomalyImpact ¶
type AnomalyImpact struct {
UserExperience ImpactLevel `json:"user_experience"`
SystemStability ImpactLevel `json:"system_stability"`
BusinessMetrics ImpactLevel `json:"business_metrics"`
OperationalCost ImpactLevel `json:"operational_cost"`
SecurityRisk ImpactLevel `json:"security_risk"`
ComplianceRisk ImpactLevel `json:"compliance_risk"`
}
type AnomalySeverity ¶
type AnomalySeverity string
const ( AnomalySeverityLow AnomalySeverity = "low" AnomalySeverityMedium AnomalySeverity = "medium" AnomalySeverityHigh AnomalySeverity = "high" AnomalySeverityCritical AnomalySeverity = "critical" )
type AnomalyType ¶
type AnomalyType string
const ( AnomalyTypeSpike AnomalyType = "spike" AnomalyTypeDip AnomalyType = "dip" AnomalyTypeLevel AnomalyType = "level_shift" AnomalyTypeTrend AnomalyType = "trend_change" AnomalyTypeVariance AnomalyType = "variance_change" AnomalyTypeSeasonal AnomalyType = "seasonal_anomaly" )
type ConcurrentEvent ¶
type CorrelationMatrix ¶
type CostEstimate ¶
type DistributionAnalysis ¶
type EffortLevel ¶
type EffortLevel string
const ( EffortLevelLow EffortLevel = "low" EffortLevelMedium EffortLevel = "medium" EffortLevelHigh EffortLevel = "high" )
type ForecastPoint ¶
type ImpactLevel ¶
type ImpactLevel string
const ( ImpactLevelLow ImpactLevel = "low" ImpactLevelMedium ImpactLevel = "medium" ImpactLevelHigh ImpactLevel = "high" )
type MetricQuery ¶
type OutlierPoint ¶
type PerformanceAlert ¶
type PerformanceAlert struct {
ID string `json:"id"`
Title string `json:"title"`
Description string `json:"description"`
Severity AlertSeverity `json:"severity"`
Priority AlertPriority `json:"priority"`
Timestamp time.Time `json:"timestamp"`
MetricName string `json:"metric_name"`
Threshold Threshold `json:"threshold"`
ActualValue float64 `json:"actual_value"`
TriggerType AlertTriggerType `json:"trigger_type"`
Context AlertContext `json:"context"`
Actions []AlertAction `json:"actions"`
Suppressed bool `json:"suppressed"`
Acknowledged bool `json:"acknowledged"`
}
PerformanceAlert represents a performance-related alert
type PerformanceAnalysis ¶
type PerformanceAnalysis struct {
ID string `json:"id"`
TimeRange TimeRange `json:"time_range"`
Metrics []PerformanceMetric `json:"metrics"`
Statistics PerformanceStatistics `json:"statistics"`
Trends []PerformanceTrend `json:"trends"`
Anomalies []PerformanceAnomaly `json:"anomalies"`
Predictions []PerformancePrediction `json:"predictions"`
HealthScore float64 `json:"health_score"`
Recommendations []PerformanceRecommendation `json:"recommendations"`
Alerts []PerformanceAlert `json:"alerts"`
GeneratedAt time.Time `json:"generated_at"`
Duration time.Duration `json:"duration"`
}
PerformanceAnalysis represents the result of performance analysis
type PerformanceAnalyticsConfig ¶
type PerformanceAnalyticsConfig struct {
Enabled bool `json:"enabled"`
DataRetentionDays int `json:"data_retention_days"`
AnalysisInterval time.Duration `json:"analysis_interval"`
AnomalyDetectionWindow time.Duration `json:"anomaly_detection_window"`
TrendAnalysisWindow time.Duration `json:"trend_analysis_window"`
MetricSamplingRate float64 `json:"metric_sampling_rate"`
AlertingEnabled bool `json:"alerting_enabled"`
MaxConcurrentAnalysis int `json:"max_concurrent_analysis"`
EnablePredictive bool `json:"enable_predictive"`
EnableMachineLearning bool `json:"enable_machine_learning"`
}
PerformanceAnalyticsConfig configures the performance analytics engine
type PerformanceAnalyticsEngine ¶
type PerformanceAnalyticsEngine struct {
// contains filtered or unexported fields
}
PerformanceAnalyticsEngine provides advanced performance analytics
func NewPerformanceAnalyticsEngine ¶
func NewPerformanceAnalyticsEngine(config PerformanceAnalyticsConfig) *PerformanceAnalyticsEngine
NewPerformanceAnalyticsEngine creates a new performance analytics engine
func (*PerformanceAnalyticsEngine) AnalyzePerformance ¶
func (pae *PerformanceAnalyticsEngine) AnalyzePerformance(ctx context.Context, timeRange TimeRange) (*PerformanceAnalysis, error)
AnalyzePerformance performs comprehensive performance analysis
func (*PerformanceAnalyticsEngine) SetAlertManager ¶
func (pae *PerformanceAnalyticsEngine) SetAlertManager(alertMgr AlertManager)
SetAlertManager sets the alert manager
func (*PerformanceAnalyticsEngine) SetAnomalyDetector ¶
func (pae *PerformanceAnalyticsEngine) SetAnomalyDetector(detector AnomalyDetector)
SetAnomalyDetector sets the anomaly detector
func (*PerformanceAnalyticsEngine) SetDataStore ¶
func (pae *PerformanceAnalyticsEngine) SetDataStore(dataStore AnalyticsDataStore)
SetDataStore sets the analytics data store
func (*PerformanceAnalyticsEngine) SetThresholdManager ¶
func (pae *PerformanceAnalyticsEngine) SetThresholdManager(thresholdMgr ThresholdManager)
SetThresholdManager sets the threshold manager
func (*PerformanceAnalyticsEngine) SetTrendAnalyzer ¶
func (pae *PerformanceAnalyticsEngine) SetTrendAnalyzer(analyzer TrendAnalyzer)
SetTrendAnalyzer sets the trend analyzer
func (*PerformanceAnalyticsEngine) Start ¶
func (pae *PerformanceAnalyticsEngine) Start(ctx context.Context) error
Start starts the performance analytics engine
func (*PerformanceAnalyticsEngine) Stop ¶
func (pae *PerformanceAnalyticsEngine) Stop() error
Stop stops the performance analytics engine
type PerformanceAnomaly ¶
type PerformanceAnomaly struct {
ID string `json:"id"`
MetricName string `json:"metric_name"`
Timestamp time.Time `json:"timestamp"`
Value float64 `json:"value"`
ExpectedValue float64 `json:"expected_value"`
Deviation float64 `json:"deviation"`
Severity AnomalySeverity `json:"severity"`
Type AnomalyType `json:"type"`
Confidence float64 `json:"confidence"`
Context AnomalyContext `json:"context"`
Impact AnomalyImpact `json:"impact"`
Explanation string `json:"explanation"`
Recommendations []string `json:"recommendations"`
RelatedMetrics []string `json:"related_metrics"`
}
PerformanceAnomaly represents an anomaly in performance metrics
type PerformanceMetric ¶
type PerformanceMetric struct {
ID string `json:"id"`
Name string `json:"name"`
Value float64 `json:"value"`
Unit string `json:"unit"`
Timestamp time.Time `json:"timestamp"`
Source string `json:"source"`
Tags map[string]string `json:"tags"`
Dimensions map[string]string `json:"dimensions"`
Metadata map[string]any `json:"metadata"`
AggregateType AggregateType `json:"aggregate_type"`
}
PerformanceMetric represents a performance metric data point
type PerformancePrediction ¶
type PerformancePrediction struct {
ID string `json:"id"`
MetricName string `json:"metric_name"`
PredictionType PredictionType `json:"prediction_type"`
TimeHorizon time.Duration `json:"time_horizon"`
PredictedValue float64 `json:"predicted_value"`
ConfidenceLevel float64 `json:"confidence_level"`
PredictionBands PredictionBands `json:"prediction_bands"`
Methodology string `json:"methodology"`
Assumptions []string `json:"assumptions"`
RiskFactors []RiskFactor `json:"risk_factors"`
Scenarios []PredictionScenario `json:"scenarios"`
GeneratedAt time.Time `json:"generated_at"`
}
PerformancePrediction represents a prediction of future performance
type PerformanceRecommendation ¶
type PerformanceRecommendation struct {
ID string `json:"id"`
Title string `json:"title"`
Description string `json:"description"`
Priority Priority `json:"priority"`
Category RecommendationCategory `json:"category"`
Impact ImpactLevel `json:"impact"`
Effort EffortLevel `json:"effort"`
Actions []RecommendedAction `json:"actions"`
Benefits []string `json:"benefits"`
Risks []string `json:"risks"`
Metrics []string `json:"metrics"`
Timeline time.Duration `json:"timeline"`
Cost CostEstimate `json:"cost"`
}
PerformanceRecommendation represents an actionable recommendation
type PerformanceStatistics ¶
type PerformanceStatistics struct {
Count int64 `json:"count"`
Mean float64 `json:"mean"`
Median float64 `json:"median"`
Mode float64 `json:"mode"`
StdDev float64 `json:"std_dev"`
Variance float64 `json:"variance"`
Min float64 `json:"min"`
Max float64 `json:"max"`
Range float64 `json:"range"`
Percentiles map[string]float64 `json:"percentiles"`
Distribution DistributionAnalysis `json:"distribution"`
Outliers []OutlierPoint `json:"outliers"`
}
PerformanceStatistics provides statistical analysis of metrics
type PerformanceTrend ¶
type PerformanceTrend struct {
ID string `json:"id"`
MetricName string `json:"metric_name"`
Direction TrendDirection `json:"direction"`
Strength float64 `json:"strength"`
Confidence float64 `json:"confidence"`
Duration time.Duration `json:"duration"`
Slope float64 `json:"slope"`
StartValue float64 `json:"start_value"`
EndValue float64 `json:"end_value"`
ChangeRate float64 `json:"change_rate"`
Seasonality SeasonalityPattern `json:"seasonality"`
Forecast TrendForecast `json:"forecast"`
}
PerformanceTrend represents a trend in performance metrics
type PredictionBands ¶
type PredictionScenario ¶
type PredictionType ¶
type PredictionType string
const ( PredictionTypeValue PredictionType = "value" PredictionTypeTrend PredictionType = "trend" PredictionTypeThreshold PredictionType = "threshold" PredictionTypeCapacity PredictionType = "capacity" )
type RecommendationCategory ¶
type RecommendationCategory string
const ( RecommendationCategoryPerformance RecommendationCategory = "performance" RecommendationCategoryScaling RecommendationCategory = "scaling" RecommendationCategoryOptimization RecommendationCategory = "optimization" RecommendationCategoryConfiguration RecommendationCategory = "configuration" RecommendationCategoryInfrastructure RecommendationCategory = "infrastructure" RecommendationCategorySecurity RecommendationCategory = "security" )
type RecommendedAction ¶
type RelatedMetric ¶
type RiskFactor ¶
type SeasonalityPattern ¶
type Threshold ¶
type Threshold struct {
Name string `json:"name"`
Operator ThresholdOperator `json:"operator"`
Value float64 `json:"value"`
Severity AlertSeverity `json:"severity"`
Duration time.Duration `json:"duration"`
Dynamic bool `json:"dynamic"`
}
type ThresholdManager ¶
type ThresholdManager interface {
GetThresholds(metricName string) []Threshold
SetThreshold(metricName string, threshold Threshold) error
UpdateDynamicThresholds(ctx context.Context, metrics []PerformanceMetric) error
EvaluateThresholds(metric PerformanceMetric) []ThresholdViolation
}
type ThresholdOperator ¶
type ThresholdOperator string
const ( ThresholdOperatorGT ThresholdOperator = "gt" ThresholdOperatorGTE ThresholdOperator = "gte" ThresholdOperatorLT ThresholdOperator = "lt" ThresholdOperatorLTE ThresholdOperator = "lte" ThresholdOperatorEQ ThresholdOperator = "eq" ThresholdOperatorNE ThresholdOperator = "ne" )
type ThresholdViolation ¶
type TrendAnalyzer ¶
type TrendAnalyzer interface {
AnalyzeTrends(ctx context.Context, metrics []PerformanceMetric) ([]PerformanceTrend, error)
PredictTrends(ctx context.Context, metrics []PerformanceMetric, horizon time.Duration) ([]PerformancePrediction, error)
DetectSeasonality(ctx context.Context, metrics []PerformanceMetric) (SeasonalityPattern, error)
CalculateCorrelations(ctx context.Context, metrics map[string][]PerformanceMetric) (CorrelationMatrix, error)
}
type TrendDirection ¶
type TrendDirection string
const ( TrendDirectionUp TrendDirection = "up" TrendDirectionDown TrendDirection = "down" TrendDirectionStable TrendDirection = "stable" TrendDirectionVolatile TrendDirection = "volatile" )
type TrendForecast ¶
type TrendForecast struct {
Points []ForecastPoint `json:"points"`
Confidence float64 `json:"confidence"`
Methodology string `json:"methodology"`
}