Promote VPN pressure action to snapshot
This commit is contained in:
@@ -255,6 +255,7 @@ type FabricFlowSchedulerSnapshot struct {
|
||||
PressureLevel string `json:"pressure_level,omitempty"`
|
||||
PressureScore int `json:"pressure_score,omitempty"`
|
||||
PressureReasons []string `json:"pressure_reasons,omitempty"`
|
||||
RecommendedAction string `json:"recommended_action,omitempty"`
|
||||
InFlight int `json:"in_flight"`
|
||||
MaxInFlight int `json:"max_in_flight"`
|
||||
AdaptiveBackpressureActive bool `json:"adaptive_backpressure_active,omitempty"`
|
||||
@@ -864,6 +865,7 @@ func (s *FabricFlowScheduler) Snapshot() FabricFlowSchedulerSnapshot {
|
||||
}
|
||||
}
|
||||
snapshot.PressureLevel, snapshot.PressureScore, snapshot.PressureReasons = fabricFlowSchedulerPressure(snapshot)
|
||||
snapshot.RecommendedAction = fabricFlowSchedulerRecommendedAction(snapshot)
|
||||
return snapshot
|
||||
}
|
||||
|
||||
@@ -940,6 +942,32 @@ func flowPressureRank(level string) int {
|
||||
}
|
||||
}
|
||||
|
||||
func fabricFlowSchedulerRecommendedAction(snapshot FabricFlowSchedulerSnapshot) string {
|
||||
reasons := map[string]struct{}{}
|
||||
for _, reason := range snapshot.PressureReasons {
|
||||
reasons[strings.TrimSpace(reason)] = struct{}{}
|
||||
}
|
||||
if _, ok := reasons["drops"]; ok || snapshot.QualityWindowDropCount > 0 {
|
||||
return "shed_or_reroute"
|
||||
}
|
||||
if _, ok := reasons["route_failures"]; ok || snapshot.QualityWindowFailureCount > 0 || snapshot.FailingChannelCount > 0 {
|
||||
return "rebuild_or_reroute"
|
||||
}
|
||||
if _, ok := reasons["route_recovery"]; ok || snapshot.RouteSwitchCount > 0 {
|
||||
return "observe_recovery"
|
||||
}
|
||||
if _, ok := reasons["slow_channels"]; ok || snapshot.SlowChannelCount > 0 || snapshot.QualityWindowSlowCount > 0 {
|
||||
return "prefer_faster_route"
|
||||
}
|
||||
if _, ok := reasons["bulk_pressure"]; ok || snapshot.BulkPressureActive {
|
||||
return "throttle_bulk"
|
||||
}
|
||||
if snapshot.AdaptiveBackpressureActive || snapshot.BackpressureActive {
|
||||
return "reduce_parallelism"
|
||||
}
|
||||
return "observe"
|
||||
}
|
||||
|
||||
func boundedFabricPressureScore(value, minValue, maxValue int) int {
|
||||
if value < minValue {
|
||||
return minValue
|
||||
|
||||
Reference in New Issue
Block a user