Repository navigation
[Frontend][RL] Instrument HTTP weight operations in both frontends - #11
Conversation
Add bounded-label telemetry around dispatched frontend weight operations: init, start, start_draft, update, finish and set_version. Counters report success/error, histograms measure one dispatched operation, and an in-flight gauge tracks concurrency without one request clearing another. Input validation stays outside the recorder. Both frontends expose the same names and labels: the Python RL HTTP routes use an independently owned `WeightOperationMetrics` created on first use on `get_prometheus_registry()`, and the Rust HTTP weight-transfer routes use a drop-safe RAII recorder. `finish` and the weight-version handshake are recorded as separate operations so that a version failure is not reported as a failed finish; the Python route now calls `finish_weight_update()` and `update_weight_version()` separately to match the Rust frontend, and `/update_weight_version` is instrumented on both. Tests: recorder outcome/overlap tests, route-level in-flight and rejected-input tests, a registry-binding regression test, and Rust recorder plus HTTP lifecycle and rejection metric assertions. Signed-off-by: Ronald1995 <ronaldautomobile@163.com>
|
👋 Hi! Thank you for contributing to the vLLM project. 💬 Join our developer Slack at https://slack.vllm.ai to discuss your PR in #pr-reviews, coordinate on features in #feat- channels, or join special interest groups in #sig- channels. Just a reminder: PRs would not trigger full CI run by default. Instead, it would only run Once the PR is approved and ready to go, your PR reviewer(s) can run CI to test the changes comprehensively before merging. To run CI, PR reviewers can either: Add 🚀 |
Test evidence (H20 cluster)Environment: cd ~/pr55781/wt-weight
~/pr55781/.venv/bin/python -m pytest -q \
tests/entrypoints/unit_tests/test_rl_weight_operation_metrics.py \
tests/entrypoints/unit_tests/test_rl_weight_operation_routes.py \
tests/v1/metrics/test_prometheus_logger_ownership.pyWhat the 13 tests cover for this PR:
Static checks on this branch: Rust: recorder test passed, route tests not yet executed
Reason: the H20 compute-node image has no OpenSSL headers, Logs: |
ae020f6
into
codex/rl-weight-operation-metrics
Purpose
Add bounded-label telemetry around dispatched frontend HTTP weight operations:
init,start,start_draft,update,finishandset_version. Counters report success/error (including cancellation), histograms measure one dispatched frontend operation, and an in-flight gauge tracks concurrent operations without one request clearing another. Input validation stays outside the recorder.Both frontends expose the same names and labels:
WeightOperationMetrics, created on first use onget_prometheus_registry().Rust gRPC control calls are intentionally not counted as HTTP operations.
Changes since the previous revision of this PR
finishand the weight-version handshake are now separate operations. Previously the Rust recorder spanned bothfinish_weight_update()andset_weight_version(), so a version failure was reported as a failed finish with a duration that included the version round-trip, while the Python route counted them as a singlefinish. That made the same metric name mean different things in the two frontends. Nowfinishrecords success as soon as the engine finishes, and the version handshake is counted asset_versionon both frontends. The Python/finish_weight_updateroute therefore callsfinish_weight_update()andupdate_weight_version()separately, matching the Rust flow./update_weight_versionis instrumented on both frontends (it was previously not counted at all on either side, even though the Rust route existed).REGISTRY, while/metricsservesget_prometheus_registry(). That only worked by accident, becauseprometheus_clientpicks the mmap-backed value class whenPROMETHEUS_MULTIPROC_DIRis already set at creation time. The recorder is now created on first use onget_prometheus_registry(), with a regression test that would fail if it were bound at import time.finish/set_versioncounts, and a new Rust test covers "finish succeeds, version fails" (500 response,finish= success,set_version= error).status="error".Relationship to vllm-project#55781's ownership fix
This PR is the RL product-observability part only: it no longer modifies
vllm/v1/metrics/{prometheus,loggers,ray_wrappers}.pyor the connector metric factories. Those ownership changes are split into a separate PR (pr-55781-ownership-fix), because the same bug also silently drops the parser, WebSocket and HTTP instrumentator metrics. The two PRs touch disjoint files and can land in either order; the context in this PR was rewritten fromorigin/maininstead of touching the default registry.Why this is not duplicating an existing PR
gh pr list --state all --search "weight update metrics"returns no other open PR adding these metric names; existing weight-transfer PRs ([RL] Add sharding-aware NCCL M2N weight transfer vllm-project/vllm#51520, [Bugfix] Fail loudly instead of no-op NCCL weight transfer vllm-project/vllm#57022, [Frontend][RL] Add a weight checker dev endpoint vllm-project/vllm#51350) change transfer backends/checkers, not telemetry.Test commands and results
Executed on the H20 cluster (
vllm-h20-head-> Slurmh20->vllm-h20-02, H20-3e), Python 3.12.14 venv with torch 2.14.0+cpu plus the repo'srequirements/common.txt, against the realvllmimport chain (no stubs):Covered: recorder success/error/cancellation, overlapping requests not clearing each other's gauge, registry binding on first use, recorder created once, route-level in-flight and success accounting, rejected input touching neither counter nor gauge,
finishsuccess when the version handshake fails, unversioned finish not recordingset_version, and the/update_weight_versionroute.ruff checkandruff format --checkpass on all changed Python files, andpython tools/pre_commit/check_test_tethering.pyconfirms the new test files are collected by Buildkite jobs.Rust: not yet executed.
rust/src/server/src/routes/tests.rsgains four assertion groups (lifecyclefinish= 2 andset_version= 2, rejection leaving the gauge at zero, and a newfinish-succeeds/version-fails 500 test).cargo test -p vllm-metricspasses on the cluster, including the newweight_operation_recorder_tracks_success_and_errortest:but
cargo test -p vllm-server --lib weight_transfercannot be built in the available environment: the H20 compute-node image has no OpenSSL development headers or.pcfiles (Failed to find OpenSSL development headers,SERVER_RC=101), the account has no sudo/apt, and the CUDA devel container lackslibssl-devtoo. Those route assertions still need a run on a machine withpkg-config libssl-devbefore merge.AI assistance
This change was prepared with AI assistance (code analysis, patch drafting, remote test execution). The submitting human has reviewed every changed line and ran the tests reported above.