Planner: log the rate window and fallback triggers used for planning (#31621)
This commit is contained in:
parent
78e2ec9514
commit
60af1de1e8
1 changed files with 7 additions and 0 deletions
|
|
@ -124,11 +124,16 @@ func (t *Planner) Plan(requiredDuration, precondition time.Duration, targetTime
|
|||
|
||||
// treat like normal target charging if we don't have rates
|
||||
if len(rates) == 0 || err != nil {
|
||||
t.log.DEBUG.Printf("planner: no rates available (count=%d, err=%v)- falling back to simple plan", len(rates), err)
|
||||
return simplePlan
|
||||
}
|
||||
|
||||
t.log.TRACE.Printf("planner: %d rates available from %v to %v",
|
||||
len(rates), rates[0].Start.Local(), rates[len(rates)-1].End.Local())
|
||||
|
||||
// consume remaining time
|
||||
if t.clock.Until(targetTime) <= requiredDuration {
|
||||
t.log.DEBUG.Printf("planner: insufficient time until target- charging continuously from now")
|
||||
return continuousPlan(rates, latestStart, targetTime)
|
||||
}
|
||||
|
||||
|
|
@ -156,6 +161,8 @@ func (t *Planner) Plan(requiredDuration, precondition time.Duration, targetTime
|
|||
|
||||
// check if rate coverage is sufficient for planning
|
||||
if len(rates) == 0 || rates[len(rates)-1].End.Sub(rates[0].Start) < requiredDuration {
|
||||
t.log.DEBUG.Printf("planner: rate coverage in [%v,%v] insufficient for required duration %v- falling back to simple plan",
|
||||
now.Local(), targetTime.Local(), requiredDuration.Round(time.Second))
|
||||
return simplePlan
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue