1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
//! Support types for regression analysis and recommendations.
//!
//! This module contains the supporting data types for cause analysis,
//! overall assessment, and action recommendations.
use serde::{Deserialize, Serialize};
/// Suspected cause of performance regression
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SuspectedCause {
/// Type of suspected cause
pub cause_type: CauseType,
/// Description
pub description: String,
/// Confidence in this cause (0-100)
pub confidence: f64,
/// Supporting evidence
pub evidence: Vec<String>,
}
/// Types of causes for performance changes
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum CauseType {
/// Code or implementation changes
CodeChange,
/// Compiler version or optimization changes
CompilerChange,
/// System configuration modifications
SystemConfiguration,
/// External environmental factors
ExternalFactors,
/// Test methodology or setup changes
TestMethodology,
/// Hardware or infrastructure changes
HardwareChange,
/// Unknown or unidentified cause
Unknown,
}
/// Likely cause of performance improvement
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ImprovementCause {
/// Type of likely cause
pub cause_type: CauseType,
/// Description
pub description: String,
/// Confidence in this cause (0-100)
pub confidence: f64,
/// Supporting evidence
pub evidence: Vec<String>,
}
/// Overall assessment of performance state
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct OverallAssessment {
/// Overall performance health score (0-100)
pub health_score: f64,
/// Performance status
pub status: PerformanceStatus,
/// Key findings
pub key_findings: Vec<String>,
/// Risk level
pub risk_level: RiskLevel,
/// Confidence in assessment
pub confidence: f64,
}
/// Overall performance status
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum PerformanceStatus {
/// Excellent performance (all metrics improving or stable)
Excellent, // All metrics improving or stable
/// Good performance (minor issues, mostly stable)
Good, // Minor issues, mostly stable
/// Concerning performance (some notable regressions)
Concerning, // Some notable regressions
/// Poor performance (multiple significant regressions)
Poor, // Multiple significant regressions
/// Critical performance (severe widespread regressions)
Critical, // Severe widespread regressions
}
/// Risk level for performance issues
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum RiskLevel {
/// Low risk level
Low,
/// Medium risk level
Medium,
/// High risk level
High,
/// Critical risk level
Critical,
}
/// Action recommendation
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ActionRecommendation {
/// Priority level (1-10, 10 = highest)
pub priority: u8,
/// Recommended action
pub action: RecommendedAction,
/// Description
pub description: String,
/// Expected impact
pub expected_impact: String,
/// Effort required
pub effort_level: EffortLevel,
/// Timeline for action
pub timeline: String,
}
/// Types of recommended actions
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum RecommendedAction {
/// Investigate the performance issue
Investigate,
/// Rollback recent changes
Rollback,
/// Optimize code performance
OptimizeCode,
/// Update performance baseline
UpdateBaseline,
/// Increase monitoring frequency
IncreaseMonitoring,
/// Change test methodology
ChangeTestMethod,
/// No action required
NoAction,
}
/// Effort level for implementing recommendation
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum EffortLevel {
/// Low effort level (< 1 day)
Low, // < 1 day
/// Medium effort level (1-5 days)
Medium, // 1-5 days
/// High effort level (> 5 days)
High, // > 5 days
}