probeBackendHealth runs Health with per-backend timeouts independent of the caller context (e.g. short /infer request_timeout_ms must not cancel health probes).
(perCheck time.Duration)
| 314 | // probeBackendHealth runs Health with per-backend timeouts independent of the caller context |
| 315 | // (e.g. short /infer request_timeout_ms must not cancel health probes). |
| 316 | func (s *Server) probeBackendHealth(perCheck time.Duration) map[string]bool { |
| 317 | out := make(map[string]bool, len(s.cfg.Backends)) |
| 318 | for _, b := range s.cfg.Backends { |
| 319 | adapter, ok := s.adapters[b.Name] |
| 320 | if !ok { |
| 321 | out[b.Name] = false |
| 322 | continue |
| 323 | } |
| 324 | hctx, cancel := context.WithTimeout(context.Background(), perCheck) |
| 325 | err := adapter.Health(hctx) |
| 326 | cancel() |
| 327 | out[b.Name] = err == nil |
| 328 | } |
| 329 | return out |
| 330 | } |
| 331 | |
| 332 | func (s *Server) metrics(w http.ResponseWriter, r *http.Request) { |
| 333 | if !s.cfg.Telemetry.MetricsEnabled { |
no test coverage detected