[TRTLLM-12648][test] implement disagg cancel stress metrics_thread#14807
Conversation
📝 WalkthroughWalkthroughThe PR extends a disaggregation cancellation stress-test harness with Prometheus-based metrics collection. A new ChangesPrometheus KV-cache metrics collection
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Signed-off-by: Chien-Chun Hung <2679986+chienchunhung@users.noreply.github.com>
3bbfa0f to
5c5a0f5
Compare
|
/bot run --disable-fail-fast |
|
PR_Github #51308 [ run ] triggered by Bot. Commit: |
|
PR_Github #51308 [ run ] completed with state
|
|
/bot run --disable-fail-fast |
|
PR_Github #51394 [ run ] triggered by Bot. Commit: |
|
PR_Github #51394 [ run ] completed with state
|
|
/bot run --disable-fail-fast |
|
PR_Github #51424 [ run ] triggered by Bot. Commit: |
|
PR_Github #51424 [ run ] completed with state |
Summary
Second thread body in the disaggregated cancellation stress-test suite — the marathon-style (hours-running) harness that gates regressions of the bug class fixed by PR #13713. The skeleton +
log_scanner_threadlanded previously in PR #14375; this PR adds themetrics_thread.This PR ships:
metrics_threadbody — scrapes every worker'strtllm_kv_cache_utilizationgauge from/prometheus/metricson a fixed cadence (default 30 s, ctor-configurable), and appends timestamped samples (role,index,host,port,utilization,error) to_kv_utilization_samplesfor the end-of-marathon leak-detection assertion. Transport / parse failures are recorded as misses (worker mid-restart from SIGKILL, mid-SIGSTOP pause, endpoint not wired for backend) rather than fail-fast — only the log scanner is fail-fast._parse_kv_cache_utilization— pure-function Prometheus text-exposition parser: tolerates# HELP/# TYPEcomments, label sets ({instance="ctx_0",pool="kv"}), and scientific notation._fetch_kv_cache_utilization—urllib-based one-shot scrape that folds every transport error (URLError, HTTPError, TimeoutError, OSError) into a(None, error_string)return so the thread can never raise.WorkerLaunchSpec.host— new optional field (default"localhost") so a future multi-host config can carry a non-localhost hostname through to the scraper without further API churn.metrics_scrape_interval_s/metrics_scrape_timeout_s— new ctor parameters onDisaggCancellationStressHarness, matching the existinglog_scanner_poll_interval_spattern. Tests pass small values for fast turnaround; the marathon uses defaults._testing.py) —DUMMY_YAML+make_spec(role, index, *, port, host, log_path)factored out of the two test files that had drifted into copy-paste.test_log_scanner.pyis migrated in this PR (touches ~80 lines but removes ~80 lines of dup).The thread sits inside the lifecycle wired up by PR #14375 —
start()already spawns it,stop()joins it,collect_results()already returnskv_utilization_samples. PR #14375 left it as a no-op stub; this PR makes it actually scrape.PR chain plan
log_scannermetrics_threadinjector_threadinjection_eventscountcanary_threadload_thread+ realsetup()withsave_log=Trueduration_min; marathon entry point becomes a real marathonThe final PR also flips
setup_disagg_clustertosave_log=Truewith explicit per-worker ports — at which point both thelog_scanner(from PR #14375) and themetrics_thread(this PR) start scraping real worker endpoints. Today both correctly no-op when their inputs are absent: scanner skipslog_path=Nonewith a warning, scraper records scrape misses.Tests added
All deterministic, GPU-free, millisecond-scale. Under
tests/integration/defs/stress_test/disagg_cancel/.test_metrics_thread.py— 16 unit tests across three layers:http.server.HTTPServervalidates success + missing-metric path; closed port validates connection-refused;503response validates HTTP error path.503→ later200, polled deterministically via a_wait_untilhelper rather thantime.sleep), multi-worker per-cycle coverage, prompt exit onfailed_event.test_log_scanner.py— migrated to use the new_testing.pyhelpers. No new assertions, no behaviour change; verifies via the existing 17 tests.Out of scope (deferred to later PRs in this chain)
metrics_scrape_interval_s/metrics_scrape_timeout_s(constructor-only for now; the marathon uses defaults).injector,canary,load.setup_disagg_clusterinvocation (cluster launch is still a stub, so_worker_specsis empty in the lifecycle smoke; the metrics thread correctly logs a warning and exits in that case).qa/llm_function_stress.txtfor nightly / weekly CI.PR Checklist
Please review the following before submitting your PR:
PR description clearly explains what and why. If using CodeRabbit's summary, please make sure it makes sense.
PR Follows TRT-LLM CODING GUIDELINES to the best of your knowledge.
Test cases are provided for new code paths (see test instructions)
If PR introduces API changes, an appropriate PR label is added - either
api-compatibleorapi-breaking. Forapi-breaking, includeBREAKINGin the PR title.Any new dependencies have been scanned for license and vulnerabilities
CODEOWNERS updated if ownership changes
Documentation updated as needed
Update tava architecture diagram if there is a significant design change in PR.
The reviewers assigned automatically/manually are appropriate for the PR.
Please check this after reviewing the above items as appropriate for this PR.
GitHub Bot Help
To see a list of available CI bot commands, please comment
/bot help.