Documentation
¶
Overview ¶
The idle window advice. Ports manager packages/fleet/src/idle.ts (idleWindowAdvice, intersect).
The idle window replay: a workload's requests per minute replayed against idle windows with the router's rules. Ports manager packages/fleet/src/idle.ts (IDLE_WINDOWS, windowsFor, checkMinutesOf, replayIdle, recommendWindow).
Index ¶
Constants ¶
This section is empty.
Variables ¶
var IdleWindows = []int{5, 10, 15, 20, 30, 45, 60, 90, 120}
IdleWindows are the nine windows tried, in minutes.
var StandaloneRecommendable = []int{5, 10, 15, 20, 30, 45, 60, 90, 120}
StandaloneRecommendable are the windows the knee is chosen from, 5 minutes to the built-in 2 hours: each longer window only avoids the stops of longer quiet times (nights, weekends), so the knee alone would choose a day, awake through every night; they are shown to compare.
var StandaloneWindows = []int{5, 10, 15, 20, 30, 45, 60, 90, 120, 180, 240, 360, 480, 720, 1440}
StandaloneWindows are the windows tried for a standalone workload: 5 minutes to 24 hours (its idle window's range).
Functions ¶
func CheckMinutes ¶
CheckMinutes returns a router's check period from its schedule: rate(n minutes) or rate(n hours), 5 minutes otherwise (nil schedule included).
Types ¶
type Actual ¶
type Actual struct {
Wakes int `json:"wakes"`
ReplayedWakes int `json:"replayedWakes"`
Noisy bool `json:"noisy"`
}
Actual compares the real wakes with the replay's.
type Hours ¶ added in v0.8.0
Hours are the requests per hour of the replayed period, the Node RequestHours: Counts[i] in the UTC hour From + i hours (the first and last hours only in part).
type Input ¶
type Input struct {
Ctx context.Context
Requests RequestMinutes
Current int
CheckMinutes int
WakeMs *float64
StartAsleep bool
ActualWakes int
ActualFrom *string
Stopped []stopped.Item
Hourly func(context.Context, stopped.Item) (*float64, error)
Baseline prices.Baseline
WakerTargetGroup bool
Estimated bool
Now time.Time
Running []Period
Windows []int
Recommendable []int
}
Input is idleWindowAdvice's argument. WakeMs, ActualFrom and Stopped are nil when Node's are null; Running nil is a backend running all the time. Ctx defaults to context.Background(). Windows are those tried (nil: the nine IdleWindows; a standalone workload's StandaloneWindows), Recommendable those the knee chooses from (nil: every window tried).
type ReplayInput ¶
type ReplayInput struct {
Requests RequestMinutes `json:"requests"`
Windows []int `json:"windows"`
CheckMinutes int `json:"checkMinutes"`
WakeSeconds float64 `json:"wakeSeconds"`
StartAsleep bool `json:"startAsleep"`
}
ReplayInput is replayIdle's argument.
type ReplayedWindow ¶
type ReplayedWindow struct {
Minutes int `json:"minutes"`
Asleep []Period `json:"asleep"`
Wakes int `json:"wakes"`
WokeAt []string `json:"wokeAt"`
}
ReplayedWindow is one window's replay.
func Replay ¶
func Replay(in ReplayInput) ([]ReplayedWindow, error)
Replay replays each window over the requests.
type RequestMinutes ¶
type RequestMinutes struct {
From string `json:"from"`
To string `json:"to"`
Minutes [][2]int `json:"minutes"`
}
RequestMinutes are the minutes with requests, as offsets from From with their counts.
func BusyMinutes ¶ added in v0.16.0
func BusyMinutes(signals []metrics.PlannedSignal, values []metrics.SignalValue, from, to string, awake []Period) RequestMinutes
BusyMinutes are the busy points from from to to, as their five minutes each (the advisor's requests): a point is busy while the resource was awake (fully inside one of the awake periods) and a signal that applies is at or over its threshold or has no value; while it was asleep (stopped), a point says nothing. awake: every time but its naps.
type Result ¶
type Result struct {
ComputedAt string `json:"computedAt"`
From string `json:"from"`
To string `json:"to"`
Current int `json:"current"`
Recommended int `json:"recommended"`
CheckMinutes int `json:"checkMinutes"`
WakeSeconds *float64 `json:"wakeSeconds"`
Priced bool `json:"priced"`
Windows []Row `json:"windows"`
Actual Actual `json:"actual"`
WakerTargetGroup bool `json:"wakerTargetGroup"`
Estimated bool `json:"estimated"`
Hours Hours `json:"hours"`
}
Result is the Node IdleWindowAdvice.