feat(usage): split throttle thresholds per bucket, add draggable gauge markers
This commit is contained in:
@@ -49,13 +49,18 @@ public sealed class UsageSnapshotBuilder
|
||||
.Select(l => new UsageLimitDto(l.Kind, l.Group, l.Percent, l.Severity, l.ResetsAt, l.ScopeModelDisplayName, l.IsActive))
|
||||
.ToList();
|
||||
|
||||
var fiveHourThresholds = new UsageThresholds(
|
||||
settings.UsageThrottleFiveHourSoftPct, settings.UsageThrottleFiveHourHardPct, settings.UsageGateFiveHourPct);
|
||||
var sevenDayThresholds = new UsageThresholds(
|
||||
settings.UsageThrottleSevenDaySoftPct, settings.UsageThrottleSevenDayHardPct, settings.UsageGateSevenDayPct);
|
||||
|
||||
var configuredSlots = Math.Max(1, settings.MaxParallelExecutions);
|
||||
var effectiveSlots = snapshot is null || lastError is not null
|
||||
? configuredSlots
|
||||
: UsageThrottle.EffectiveSlots(
|
||||
configuredSlots, snapshot.FiveHour?.Utilization, snapshot.SevenDay?.Utilization,
|
||||
settings.UsageThrottleSoftPct, settings.UsageThrottleHardPct,
|
||||
settings.UsageGateFiveHourPct, settings.UsageGateSevenDayPct);
|
||||
configuredSlots,
|
||||
snapshot.FiveHour?.Utilization, fiveHourThresholds,
|
||||
snapshot.SevenDay?.Utilization, sevenDayThresholds);
|
||||
var throttleBucket = effectiveSlots < configuredSlots
|
||||
? DecisiveBucket(snapshot?.FiveHour?.Utilization, snapshot?.SevenDay?.Utilization)
|
||||
: null;
|
||||
@@ -75,7 +80,11 @@ public sealed class UsageSnapshotBuilder
|
||||
lastError,
|
||||
configuredSlots,
|
||||
effectiveSlots,
|
||||
throttleBucket);
|
||||
throttleBucket,
|
||||
fiveHourThresholds.SoftPct,
|
||||
fiveHourThresholds.HardPct,
|
||||
sevenDayThresholds.SoftPct,
|
||||
sevenDayThresholds.HardPct);
|
||||
}
|
||||
|
||||
private static string? DecisiveBucket(double? fiveHourPct, double? sevenDayPct)
|
||||
|
||||
Reference in New Issue
Block a user