Skip to content

feat: add vllm sidecar heartbeat and load metrics reporting.#71

Merged
fdvty merged 1 commit into
xLLM-AI:mainfrom
fdvty:features/vllm-http-heartbeat
Jun 17, 2026
Merged

feat: add vllm sidecar heartbeat and load metrics reporting.#71
fdvty merged 1 commit into
xLLM-AI:mainfrom
fdvty:features/vllm-http-heartbeat

Conversation

@fdvty

@fdvty fdvty commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

Description

Builds on the merged vLLM sidecar (#69). The sidecar now periodically scrapes
vLLM's Prometheus /metrics and POSTs LoadMetrics/LatencyMetrics to the master's
new internal heartbeat endpoint, so the scheduler sees live load/latency for
vLLM-backed instances.

  • vllm_sidecar/metrics.py — scrape vLLM /metrics into the heartbeat schema
    (waiting requests, gpu cache usage, TTFT/TBT interval averages).
  • vllm_sidecar/sidecar.py — heartbeat loop on a cadence; re-registers on a 409.
  • C++ Heartbeat HTTP endpoint (/v1/internal/heartbeat) with optional
    X-Internal-Token auth (--internal_api_token gflag); proto + master wiring.
  • Reuses one requests.Session for the periodic metrics scrape and heartbeat POST.

Related Issues

Change Type

  • New feature

Pull Request Checklist

Reviewer Notes

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a heartbeat mechanism to the vLLM sidecar, allowing it to scrape Prometheus metrics from vLLM and report load and latency metrics to the master service via a new /v1/internal/heartbeat HTTP endpoint. It also adds optional token-based authentication to secure this internal endpoint. The review feedback highlights two critical issues in the metrics parsing logic: first, the regular expression for parsing metrics fails to handle scientific notation with negative exponents (e.g., 1.23e-04), which can cause parsing failures; second, parsing NaN or Inf values can lead to application crashes when those values are subsequently cast to integers. Both comments provide actionable code suggestions to resolve these issues.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread vllm_sidecar/metrics.py
Comment thread vllm_sidecar/metrics.py
@fdvty
fdvty force-pushed the features/vllm-http-heartbeat branch from 46f373b to 6ec6532 Compare June 17, 2026 08:52
@fdvty
fdvty force-pushed the features/vllm-http-heartbeat branch from 6ec6532 to d0f8fae Compare June 17, 2026 08:59

@Kang-Meng Kang-Meng left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@DongheJin
DongheJin self-requested a review June 17, 2026 09:30
@fdvty
fdvty merged commit a196713 into xLLM-AI:main Jun 17, 2026
1 check passed
@fdvty
fdvty deleted the features/vllm-http-heartbeat branch June 17, 2026 09:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants