Files
LocalAI/core/services/failover/trace.go
T
Ettore Di Giacinto 8a0bf410ee feat(failover): run the chain manager and keep warm targets loaded
Warm local targets are pinned in the watchdog and preloaded. Switches
and target health are exported as metrics, skipped attempts as traces.

Assisted-by: Claude:claude-opus-5-5
2026-09-26 16:06:15 +00:00

24 lines
578 B
Go

package failover
import (
"fmt"
"time"
"github.com/mudler/LocalAI/core/trace"
)
// RecordAttemptTrace shows in the Traces UI why a target was skipped.
func RecordAttemptTrace(enabled bool, chain, target string, err error) {
if !enabled || err == nil {
return
}
trace.RecordBackendTrace(trace.BackendTrace{
Timestamp: time.Now(),
Type: trace.BackendTraceFailover,
ModelName: target,
Summary: fmt.Sprintf("failover chain %s: %s failed, trying the next target", chain, target),
Error: err.Error(),
Data: map[string]any{"chain": chain},
})
}