MCPcopy Create free account
hub / github.com/InferCore/InferCore / Health

Method Health

internal/adapters/vllm/vllm.go:316–342  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

314}
315
316func (a *Adapter) Health(ctx context.Context) error {
317 if a.isAzure() {
318 return a.healthAzure(ctx)
319 }
320 path := strings.TrimSpace(a.cfg.HealthPath)
321 if path == "" {
322 path = "/health"
323 }
324 if !strings.HasPrefix(path, "/") {
325 path = "/" + path
326 }
327 u := joinURL(a.cfg.Endpoint, path)
328 httpReq, err := http.NewRequestWithContext(ctx, http.MethodGet, u, nil)
329 if err != nil {
330 return err
331 }
332 a.applyHeaders(httpReq)
333 resp, err := a.httpClient.Do(httpReq)
334 if err != nil {
335 return upstream.New(upstream.KindBackendUnhealthy, err.Error())
336 }
337 defer resp.Body.Close()
338 if resp.StatusCode < 200 || resp.StatusCode >= 300 {
339 return upstream.New(upstream.KindBackendUnhealthy, fmt.Sprintf("health check failed status=%d path=%s", resp.StatusCode, path))
340 }
341 return nil
342}
343
344func (a *Adapter) isAzure() bool {
345 return a.cfg.Type == "azure_openai"

Callers

nothing calls this directly

Calls 7

isAzureMethod · 0.95
healthAzureMethod · 0.95
applyHeadersMethod · 0.95
NewFunction · 0.92
joinURLFunction · 0.85
CloseMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected