Skip to content

[TRTLLM-9181][feat] improve disagg-server prometheus metrics; synchronize workers' clocks when workers are dynamic - #9726

Merged
reasonsolo merged 2 commits into
NVIDIA:mainfrom
reasonsolo:TRTLLM-9181_disaggmetrics
Dec 16, 2025
Merged

reasonsolo merged 2 commits into
NVIDIA:mainfrom
reasonsolo:TRTLLM-9181_disaggmetrics

Conversation

@reasonsolo

@reasonsolo reasonsolo commented Dec 5, 2025 •

Copy link
Copy Markdown
Collaborator
  1. Improve disagg-server prometheus metrics and add test.
  2. Synchronize ctx/gen workers' clock when ctx/gen workers are configured dynamically (both metaserver and auto-scaling)
  3. Create a sub-directory test_common for some shared code between unit-tests and integration tests.
  4. Remove repetitive code for get_free_port and wait_for_endpoint_ready
  5. Move test class OpenAIMMEncoder from tests/unittest/llmapi/apps/_test_openai_mmencoder.py to tests/unittest/llmapi/apps/openai_server.py and fix its API a little bit .

Summary by CodeRabbit

  • New Features

    • Added performance metrics collection for request latency, including queue and completion time tracking
    • Introduced per-request/response metrics and error counters for improved observability
    • Added server startup activity logging
  • Refactor

    • Centralized port discovery utilities across codebase
    • Restructured metrics collection infrastructure for consistency
  • Tests

    • Enhanced test server utilities with logging and server health-check support

✏️ Tip: You can customize this high-level summary in your review settings.

Description

Test Coverage

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)

  • 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

/bot [-h] ['run', 'kill', 'skip', 'reuse-pipeline'] ...

Provide a user friendly way for developers to interact with a Jenkins server.

Run /bot [-h|--help] to print this help message.

See details below for each supported subcommand.

Details

run [--reuse-test (optional)pipeline-id --disable-fail-fast --skip-test --stage-list "A10-PyTorch-1, xxx" --gpu-type "A30, H100_PCIe" --test-backend "pytorch, cpp" --add-multi-gpu-test --only-multi-gpu-test --disable-multi-gpu-test --post-merge --extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx" --detailed-log --debug(experimental)]

Launch build/test pipelines. All previously running jobs will be killed.

--reuse-test (optional)pipeline-id (OPTIONAL) : Allow the new pipeline to reuse build artifacts and skip successful test stages from a specified pipeline or the last pipeline if no pipeline-id is indicated. If the Git commit ID has changed, this option will be always ignored. The DEFAULT behavior of the bot is to reuse build artifacts and successful test results from the last pipeline.

--disable-reuse-test (OPTIONAL) : Explicitly prevent the pipeline from reusing build artifacts and skipping successful test stages from a previous pipeline. Ensure that all builds and tests are run regardless of previous successes.

--disable-fail-fast (OPTIONAL) : Disable fail fast on build/tests/infra failures.

--skip-test (OPTIONAL) : Skip all test stages, but still run build stages, package stages and sanity check stages. Note: Does NOT update GitHub check status.

--stage-list "A10-PyTorch-1, xxx" (OPTIONAL) : Only run the specified test stages. Examples: "A10-PyTorch-1, xxx". Note: Does NOT update GitHub check status.

--gpu-type "A30, H100_PCIe" (OPTIONAL) : Only run the test stages on the specified GPU types. Examples: "A30, H100_PCIe". Note: Does NOT update GitHub check status.

--test-backend "pytorch, cpp" (OPTIONAL) : Skip test stages which don't match the specified backends. Only support [pytorch, cpp, tensorrt, triton]. Examples: "pytorch, cpp" (does not run test stages with tensorrt or triton backend). Note: Does NOT update GitHub pipeline status.

--only-multi-gpu-test (OPTIONAL) : Only run the multi-GPU tests. Note: Does NOT update GitHub check status.

--disable-multi-gpu-test (OPTIONAL) : Disable the multi-GPU tests. Note: Does NOT update GitHub check status.

--add-multi-gpu-test (OPTIONAL) : Force run the multi-GPU tests in addition to running L0 pre-merge pipeline.

--post-merge (OPTIONAL) : Run the L0 post-merge pipeline instead of the ordinary L0 pre-merge pipeline.

--extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx" (OPTIONAL) : Run the ordinary L0 pre-merge pipeline and specified test stages. Examples: --extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx".

--detailed-log (OPTIONAL) : Enable flushing out all logs to the Jenkins console. This will significantly increase the log volume and may slow down the job.

--debug (OPTIONAL) : Experimental feature. Enable access to the CI container for debugging purpose. Note: Specify exactly one stage in the stage-list parameter to access the appropriate container environment. Note: Does NOT update GitHub check status.

For guidance on mapping tests to stage names, see docs/source/reference/ci-overview.md
and the scripts/test_to_stage_mapping.py helper.

kill

kill

Kill all running builds associated with pull request.

skip

skip --comment COMMENT

Skip testing for latest commit on pull request. --comment "Reason for skipping build/test" is required. IMPORTANT NOTE: This is dangerous since lack of user care and validation can cause top of tree to break.

reuse-pipeline

reuse-pipeline

Reuse a previous pipeline to validate current commit. This action will also kill all currently running builds associated with the pull request. IMPORTANT NOTE: This is dangerous since lack of user care and validation can cause top of tree to break.

@reasonsolo
reasonsolo requested review from a team as code owners December 5, 2025 07:11
@coderabbitai

coderabbitai Bot commented Dec 5, 2025 •

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

This PR enhances port management, networking, metrics collection, and observability across the distributed serving infrastructure. It adds centralized free port utilities, improves localhost handling in cluster workers, introduces server-side metrics with queue latency tracking, and extends test infrastructure with logging and configuration support.

Changes

Cohort / File(s) Summary
Free Port Utilities
tensorrt_llm/_utils.py, tensorrt_llm/llmapi/mpi_session.py
Added get_free_ports(num=1) and find_free_ports(num=1) helper functions for obtaining multiple ephemeral ports; refactored existing single-port functions to delegate to these new utilities.
Host Registration & Cluster Worker
tensorrt_llm/serve/disagg_auto_scaling.py
Added LOCALHOST_IPS constant and localhost address resolution logic in DisaggClusterWorker.__init__ to determine registration host via cluster URI matching or socket.gethostname().
Metrics Infrastructure
tensorrt_llm/serve/perf_metrics.py
Introduced centralized instance_metric() factory for lazy Prometheus metric creation with role-based prefixing; renamed METRICS_DEFINITIONS to CLIENT_METRICS_DEFINITIONS; added SERVER_METRICS_DEFINITIONS with queue latency histogram; implemented __getattr__ on DisaggPerfMetricsCollector for dynamic metric attribute access; refactored both collector classes to use shared factory.
Server Observability
tensorrt_llm/serve/openai_disagg_server.py
Added request arrival time capture and queue latency computation in RawRequestResponseHooks; instrumented per-request/response counters and error metrics; added server startup logging.
Client Latency Tracking
tensorrt_llm/serve/openai_client.py
Added total completion latency tracking in _post_with_retry; moved per-token latency collection to trigger only on non-empty lines in streaming responses; relocated completed_requests.increment to _finish_request for consistent completion recording across streaming and non-streaming paths.
Test Infrastructure & Server Classes
tests/unittest/llmapi/apps/openai_server.py
Extended RemoteOpenAIServer with log_path, wait, and log_file parameters; added _get_output() helper for stdout/stderr redirection; implemented wait_for_server() method; extended RemoteDisaggOpenAIServer with disagg_config and log_path parameters; refactored config file creation to write YAML-dumped dict; updated port finder from find_free_port to get_free_port.
Test Utilities & Consolidation
tests/unittest/llmapi/apps/_test_openai_mmencoder.py, tests/integration/defs/examples/serve/test_serve_negative.py
Updated port finder imports from tensorrt_llm.llmapi.mpi_session.find_free_port or local helpers to centralized tensorrt_llm._utils.get_free_port; removed local _find_free_port implementation.
Test Suite Configuration
tests/integration/test_lists/test-db/l0_dgx_h100.yml
Added disaggregated serving performance metrics test (unittest/llmapi/apps/test_disagg_serving_perf_metrics.py) to 2-GPU and 4-GPU pre-merge test groups.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~65 minutes

  • Metrics infrastructure refactoring (perf_metrics.py): Dense logic with lazy factory, centralized definition handling, and dynamic attribute access patterns across multiple collector classes; requires careful validation of metric registration and role-based prefixing behavior.
  • Test server enhancement (openai_server.py): Significant changes across both RemoteOpenAIServer and RemoteDisaggOpenAIServer with new parameter handling, subprocess redirection, file resource lifecycle, and YAML config serialization; verify log file cleanup and config file creation paths.
  • Latency tracking logic (openai_client.py): Conditional token latency observation on non-empty lines in streaming paths; verify that empty lines do not cause premature or duplicate latency records.
  • Localhost resolution (disagg_auto_scaling.py): Verify hostname fallback logic and cluster URI matching behavior for edge cases.

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 2.70% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Description check ⚠️ Warning The PR description is incomplete, containing only bullet points without substantive explanations in the designated sections. Complete the Description and Test Coverage sections with detailed explanations of changes and relevant test names. Add brief rationale for each of the 5 numbered objectives.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately captures the main objectives: improving disagg-server prometheus metrics and synchronizing workers' clocks for dynamic workers.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (2)
tensorrt_llm/serve/disagg_auto_scaling.py (1)

242-263: Localhost-aware worker registration is reasonable; minor constant/type tweaks

The new LOCALHOST_IPS logic in DisaggClusterWorker.__init__ correctly avoids registering workers under localhost/0.0.0.0 when the cluster storage URI is non-local, which should make cross-host routing more robust.

Two small follow-ups:

  • To reflect that LOCALHOST_IPS is a class-level constant and avoid mutable-class-attribute lint noise, consider making it immutable and annotating it as a ClassVar:
-from typing import Any, Awaitable, Callable, Dict, List, Optional, Tuple
+from typing import Any, Awaitable, Callable, ClassVar, Dict, List, Optional, Tuple
@@
-class DisaggClusterWorker:
-    """
-    The cluster worker is responsible for registering and deregistering the worker to the cluster storage.
-    It will send heartbeat to the cluster storage every heartbeat_interval_sec seconds.
-    If the worker heartbeat fails, it will re-register itself.
-    """
-    LOCALHOST_IPS = ["localhost", "127.0.0.1", "0.0.0.0", "::1"]
+class DisaggClusterWorker:
+    """
+    The cluster worker is responsible for registering and deregistering the worker to the cluster storage.
+    It will send heartbeat to the cluster storage every heartbeat_interval_sec seconds.
+    If the worker heartbeat fails, it will re-register itself.
+    """
+    LOCALHOST_IPS: ClassVar[Tuple[str, ...]] = (
+        "localhost",
+        "127.0.0.1",
+        "0.0.0.0",
+        "::1",
+    )
  • The if localhost in self._config.cluster_uri check is a pragmatic heuristic. If cluster_uri formats ever get more complex (e.g., hostnames that merely contain the substring "localhost"), it may be worth tightening this by parsing the URI and comparing only the host component, but that’s not strictly required for the current usage.

The random.randint(...) in worker_id continues to be fine for non‑cryptographic uniqueness; the S311 warning from static analysis can be treated as informational here.

tensorrt_llm/serve/openai_client.py (1)

184-187: Metrics instrumentation is consistent; consider covering streaming handshake failures

The new client-side metrics look coherent:

  • Non-streaming requests now observe complete_latency_seconds after a successful response and finishing the request.
  • Streaming requests track first_token_latency_seconds and per_token_latency_seconds only when actual chunks are received, and observe complete_latency_seconds once the stream ends.
  • _finish_request centralizes router finalization and completed_requests accounting.

One subtle gap worth noting (likely pre-existing): for streaming requests where the HTTP connection never succeeds and _response_generator is never entered (e.g., aiohttp.ClientError on all retries while establishing the connection), _finish_request is never invoked because that logic lives only in _response_generator’s finally and in the non-stream error path of _send_request. This can leave the router thinking the request is still in flight.

If this scenario is relevant in practice, consider a follow-up refactor so that streaming paths also guarantee _finish_request is awaited exactly once in all outcomes, including “no response body” failures (for example, by wrapping the returned async generator or adding a small streaming-specific cleanup in the retry loop).

Also applies to: 223-237, 243-245, 258-260

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a736226 and 369c228.

📒 Files selected for processing (10)
  • tensorrt_llm/_utils.py (1 hunks)
  • tensorrt_llm/llmapi/mpi_session.py (1 hunks)
  • tensorrt_llm/serve/disagg_auto_scaling.py (2 hunks)
  • tensorrt_llm/serve/openai_client.py (3 hunks)
  • tensorrt_llm/serve/openai_disagg_server.py (5 hunks)
  • tensorrt_llm/serve/perf_metrics.py (4 hunks)
  • tests/integration/defs/examples/serve/test_serve_negative.py (2 hunks)
  • tests/integration/test_lists/test-db/l0_dgx_h100.yml (1 hunks)
  • tests/unittest/llmapi/apps/_test_openai_mmencoder.py (1 hunks)
  • tests/unittest/llmapi/apps/openai_server.py (7 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.py

📄 CodeRabbit inference engine (CODING_GUIDELINES.md)

**/*.py: The code developed for TensorRT-LLM should conform to Python 3.8+
Indent Python code with 4 spaces; do not use tabs
Always maintain the namespace when importing in Python, even if only one class or function from a module is used (e.g., use from package.subpackage import foo and then foo.SomeClass() instead of from package.subpackage.foo import SomeClass)
Python filenames should use snake_case (e.g., some_file.py)
Python class names should use PascalCase (e.g., class SomeClass)
Python function and method names should use snake_case (e.g., def my_awesome_function():)
Python local variable names should use snake_case, with prefix k for variable names that start with a number (e.g., k_99th_percentile = ...)
Python global variables should use upper snake_case with prefix G (e.g., G_MY_GLOBAL = ...)
Python constants should use upper snake_case (e.g., MY_CONSTANT = ...)
Avoid shadowing variables declared in an outer scope in Python
Initialize all externally visible members of a Python class in the constructor
For Python interfaces that may be used outside a file, prefer docstrings over comments
Python comments should be reserved for code within a function, or interfaces that are local to a file
Use Google style docstrings for Python classes and functions, which can be parsed by Sphinx
Python attributes and variables can be documented inline with type and description (e.g., self.x = 5 followed by """<type>: Description of 'x'""" )
Avoid using reflection in Python when functionality can be easily achieved without reflection
When using try-except blocks in Python, limit the except clause to the smallest set of specific errors possible instead of catching all exceptions
When using try-except blocks in Python to handle multiple possible variable types (duck-typing), keep the body of the try as small as possible and use the else block to implement the logic

Files:

  • tensorrt_llm/llmapi/mpi_session.py
  • tests/integration/defs/examples/serve/test_serve_negative.py
  • tensorrt_llm/serve/openai_disagg_server.py
  • tensorrt_llm/serve/disagg_auto_scaling.py
  • tensorrt_llm/_utils.py
  • tensorrt_llm/serve/openai_client.py
  • tests/unittest/llmapi/apps/_test_openai_mmencoder.py
  • tensorrt_llm/serve/perf_metrics.py
  • tests/unittest/llmapi/apps/openai_server.py
**/*.{cpp,h,cu,py}

📄 CodeRabbit inference engine (CODING_GUIDELINES.md)

All TensorRT-LLM Open Source Software code files should contain an NVIDIA copyright header that includes the current year at the top

Files:

  • tensorrt_llm/llmapi/mpi_session.py
  • tests/integration/defs/examples/serve/test_serve_negative.py
  • tensorrt_llm/serve/openai_disagg_server.py
  • tensorrt_llm/serve/disagg_auto_scaling.py
  • tensorrt_llm/_utils.py
  • tensorrt_llm/serve/openai_client.py
  • tests/unittest/llmapi/apps/_test_openai_mmencoder.py
  • tensorrt_llm/serve/perf_metrics.py
  • tests/unittest/llmapi/apps/openai_server.py
🧠 Learnings (6)
📓 Common learnings
Learnt from: Shixiaowei02
Repo: NVIDIA/TensorRT-LLM PR: 9582
File: tests/integration/defs/accuracy/test_disaggregated_serving.py:73-83
Timestamp: 2025-12-02T03:40:40.572Z
Learning: In the disaggregated serving tests (tests/integration/defs/accuracy/test_disaggregated_serving.py), calling get_free_port() multiple times in succession is acceptable because the tests run in a controlled single-process environment where race conditions for port allocation are not a concern.
📚 Learning: 2025-09-09T09:40:45.658Z
Learnt from: fredricz-20070104
Repo: NVIDIA/TensorRT-LLM PR: 7645
File: tests/integration/test_lists/qa/llm_function_core.txt:648-648
Timestamp: 2025-09-09T09:40:45.658Z
Learning: In TensorRT-LLM test lists, it's common and intentional for the same test to appear in multiple test list files when they serve different purposes (e.g., llm_function_core.txt for comprehensive core functionality testing and llm_function_core_sanity.txt for quick sanity checks). This duplication allows tests to be run in different testing contexts.

Applied to files:

  • tests/integration/test_lists/test-db/l0_dgx_h100.yml
📚 Learning: 2025-09-17T02:48:52.732Z
Learnt from: tongyuantongyu
Repo: NVIDIA/TensorRT-LLM PR: 7781
File: tests/integration/test_lists/waives.txt:313-313
Timestamp: 2025-09-17T02:48:52.732Z
Learning: In TensorRT-LLM, `tests/integration/test_lists/waives.txt` is specifically for waiving/skipping tests, while other test list files like those in `test-db/` and `qa/` directories are for different test execution contexts (pre-merge, post-merge, QA tests). The same test appearing in both waives.txt and execution list files is intentional - the test is part of test suites but will be skipped due to the waiver.

Applied to files:

  • tests/integration/test_lists/test-db/l0_dgx_h100.yml
📚 Learning: 2025-08-26T09:49:04.956Z
Learnt from: pengbowang-nv
Repo: NVIDIA/TensorRT-LLM PR: 7192
File: tests/integration/test_lists/test-db/l0_dgx_b200.yml:56-72
Timestamp: 2025-08-26T09:49:04.956Z
Learning: In TensorRT-LLM test configuration files, the test scheduling system handles wildcard matching with special rules that prevent duplicate test execution even when the same tests appear in multiple yaml files with overlapping GPU wildcards (e.g., "*b200*" and "*gb200*").

Applied to files:

  • tests/integration/test_lists/test-db/l0_dgx_h100.yml
📚 Learning: 2025-07-28T17:06:08.621Z
Learnt from: moraxu
Repo: NVIDIA/TensorRT-LLM PR: 6303
File: tests/integration/test_lists/qa/examples_test_list.txt:494-494
Timestamp: 2025-07-28T17:06:08.621Z
Learning: In TensorRT-LLM testing, it's common to have both CLI flow tests (test_cli_flow.py) and PyTorch API tests (test_llm_api_pytorch.py) for the same model. These serve different purposes: CLI flow tests validate the traditional command-line workflow, while PyTorch API tests validate the newer LLM API backend. Both are legitimate and should coexist.

Applied to files:

  • tests/integration/test_lists/test-db/l0_dgx_h100.yml
📚 Learning: 2025-12-02T03:40:40.572Z
Learnt from: Shixiaowei02
Repo: NVIDIA/TensorRT-LLM PR: 9582
File: tests/integration/defs/accuracy/test_disaggregated_serving.py:73-83
Timestamp: 2025-12-02T03:40:40.572Z
Learning: In the disaggregated serving tests (tests/integration/defs/accuracy/test_disaggregated_serving.py), calling get_free_port() multiple times in succession is acceptable because the tests run in a controlled single-process environment where race conditions for port allocation are not a concern.

Applied to files:

  • tensorrt_llm/llmapi/mpi_session.py
  • tests/integration/defs/examples/serve/test_serve_negative.py
  • tensorrt_llm/_utils.py
  • tests/unittest/llmapi/apps/_test_openai_mmencoder.py
  • tests/unittest/llmapi/apps/openai_server.py
🧬 Code graph analysis (7)
tests/integration/defs/examples/serve/test_serve_negative.py (1)
tensorrt_llm/_utils.py (1)
  • get_free_port (476-477)
tensorrt_llm/serve/openai_disagg_server.py (2)
tensorrt_llm/serve/responses_utils.py (1)
  • get_steady_clock_now_in_seconds (111-112)
tensorrt_llm/logger.py (2)
  • error (126-127)
  • info (138-139)
tensorrt_llm/serve/disagg_auto_scaling.py (2)
tensorrt_llm/llmapi/disagg_utils.py (2)
  • ServerRole (19-22)
  • DisaggClusterConfig (59-64)
tensorrt_llm/serve/cluster_storage.py (1)
  • ClusterStorage (60-106)
tensorrt_llm/serve/openai_client.py (2)
tensorrt_llm/serve/responses_utils.py (2)
  • get_steady_clock_now_in_seconds (111-112)
  • on_first_token (1803-1807)
tensorrt_llm/serve/openai_disagg_server.py (1)
  • on_first_token (70-73)
tests/unittest/llmapi/apps/_test_openai_mmencoder.py (1)
tensorrt_llm/_utils.py (1)
  • get_free_port (476-477)
tensorrt_llm/serve/perf_metrics.py (1)
tensorrt_llm/llmapi/disagg_utils.py (1)
  • ServerRole (19-22)
tests/unittest/llmapi/apps/openai_server.py (3)
tensorrt_llm/_utils.py (1)
  • get_free_port (476-477)
tests/integration/defs/stress_test/stress_test.py (1)
  • url (91-93)
tests/integration/defs/examples/serve/test_serve_negative.py (1)
  • url_for (35-36)
🪛 Ruff (0.14.7)
tensorrt_llm/llmapi/mpi_session.py

544-544: Unused function argument: num

(ARG001)

tensorrt_llm/serve/openai_disagg_server.py

63-63: Unused method argument: request

(ARG002)

tensorrt_llm/serve/disagg_auto_scaling.py

242-242: Mutable class attributes should be annotated with typing.ClassVar

(RUF012)


242-242: Possible binding to all interfaces

(S104)


263-263: Standard pseudo-random generators are not suitable for cryptographic purposes

(S311)

tensorrt_llm/serve/perf_metrics.py

113-113: Avoid specifying long messages outside the exception class

(TRY003)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Pre-commit Check
🔇 Additional comments (10)
tests/integration/test_lists/test-db/l0_dgx_h100.yml (1)

44-44: Verify if the test was added to both 2-GPU and 4-GPU sections as claimed in the AI summary.

The review identifies a potential inconsistency: the AI summary states the test was added to "two pre-merge test groups (covering 2-GPU and 4-GPU configurations)", but only line 44 in the 2-GPU section is shown with a change annotation. Confirm whether the same test addition appears in the 4-GPU section (lines 49–111) as the summary implies. Additionally, verify that unittest/llmapi/apps/test_disagg_serving_perf_metrics.py exists as part of this PR.

tensorrt_llm/serve/perf_metrics.py (2)

99-114: LGTM! Clean implementation of lazy metric factory.

The instance_metric function correctly:

  • Lazily imports prometheus_client to avoid side effects with set_prometheus_multiproc_dir.
  • Handles role-based name prefixing appropriately.
  • Creates the correct metric type based on the definition.

154-163: LGTM! Server metrics integration looks good.

The _metrics dictionary and __getattr__ implementation provide clean dynamic access to server-side metrics, consistent with the ClientMetricsCollector pattern.

tests/unittest/llmapi/apps/_test_openai_mmencoder.py (1)

27-30: LGTM! Correctly migrated to centralized port utility.

The import change from tensorrt_llm.llmapi.mpi_session.find_free_port to tensorrt_llm._utils.get_free_port aligns with the broader codebase shift toward centralized port-lookup utilities.

tensorrt_llm/serve/openai_disagg_server.py (4)

54-64: LGTM! Queue latency instrumentation is well-implemented.

The RawRequestResponseHooks correctly captures the request arrival time from middleware state and observes queue latency in on_req_begin. The unused request parameter (flagged by static analysis ARG002) is intentional as it matches the ResponseHooks interface contract.


162-176: LGTM! Comprehensive request/response metrics instrumentation.

The metrics coverage is thorough:

  • total_requests, stream_requests, nonstream_requests at entry.
  • total_responses on successful completion.
  • Error counters delegated to _handle_exception.

178-189: LGTM! Error metrics categorization is appropriate.

The exception handler correctly categorizes and counts:

  • http_exceptions for HTTPException.
  • internal_errors for other exceptions.
  • validation_exceptions handled separately in the validation exception handler (line 136).

209-210: LGTM! Useful startup logging added.

The server startup log message with host and port information aids debugging and operational visibility.

tests/integration/defs/examples/serve/test_serve_negative.py (1)

21-21: Centralized get_free_port usage in tests looks good

Importing and using tensorrt_llm._utils.get_free_port() in the server fixture keeps port handling consistent with the rest of the test suite. In a single-process integration test like this, the race window for free-port selection is acceptable and aligns with the existing disaggregated-serving tests that use the same helper.

Also applies to: 61-61

tests/unittest/llmapi/apps/openai_server.py (1)

14-15: Helper updates for ports, logging, and disagg config look solid

  • Switching both helpers to tensorrt_llm._utils.get_free_port() for default ports aligns them with the centralized port utilities; for these single-process unittest helpers the free-port pattern is appropriate, and matches the existing disaggregated-serving tests’ usage.
  • The new log_path/_get_output mechanism cleanly routes subprocess stdout/stderr either to a shared log file or to stdout, and terminate() now properly closes the log file to avoid descriptor leaks.
  • RemoteOpenAIServer.wait_for_server() provides a simple way to delay readiness checks when wait=False is used in tests.
  • For RemoteDisaggOpenAIServer, accepting a disagg_config dict and dumping it via yaml.dump into a temp file is clearer than working with pre-serialized YAML, and the added logging support mirrors the non-disaggregated helper.

Overall, these changes make the test harness more flexible and observable without altering its core semantics.

Also applies to: 21-34, 37-39, 57-60, 62-69, 92-95, 143-159, 162-163, 175-176, 181-192

Comment thread tensorrt_llm/_utils.py Resolved
Comment thread tensorrt_llm/llmapi/mpi_session.py Resolved
@reasonsolo
reasonsolo force-pushed the TRTLLM-9181_disaggmetrics branch 3 times, most recently from ea07f68 to 32a5878 Compare December 5, 2025 07:37
@reasonsolo

Copy link
Copy Markdown
Collaborator Author

/bot run

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #27092 [ run ] triggered by Bot. Commit: 32a5878

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #27092 [ run ] completed with state SUCCESS. Commit: 32a5878
/LLM/main/L0_MergeRequest_PR pipeline #20668 completed with status: 'FAILURE'

@reasonsolo

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #27111 [ run ] triggered by Bot. Commit: eb13bb7

@pcastonguay
pcastonguay self-requested a review December 5, 2025 14:14
@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #27111 [ run ] completed with state SUCCESS. Commit: eb13bb7
/LLM/main/L0_MergeRequest_PR pipeline #20682 completed with status: 'FAILURE'

@reasonsolo
reasonsolo force-pushed the TRTLLM-9181_disaggmetrics branch 2 times, most recently from 63301ce to 67f5207 Compare December 8, 2025 09:12
@reasonsolo reasonsolo changed the title [TRTLLM-9181][feat] improve disagg-server prometheus metrics and add test [TRTLLM-9181][feat] improve disagg-server prometheus metrics and synchronize workers' clock when workers are dynamic Dec 8, 2025
@reasonsolo reasonsolo changed the title [TRTLLM-9181][feat] improve disagg-server prometheus metrics and synchronize workers' clock when workers are dynamic [TRTLLM-9181][feat] improve disagg-server prometheus metrics; synchronize workers' clock when workers are dynamic Dec 8, 2025

@pcastonguay pcastonguay 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.

Thanks Lizhi, lgtm.

@pcastonguay

Copy link
Copy Markdown
Collaborator

bot run --disable-fail-fast

@reasonsolo

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@reasonsolo reasonsolo changed the title [TRTLLM-9181][feat] improve disagg-server prometheus metrics; synchronize workers' clock when workers are dynamic [TRTLLM-9181][feat] improve disagg-server prometheus metrics; synchronize workers' clocks when workers are dynamic Dec 9, 2025
@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #27394 [ run ] triggered by Bot. Commit: bd3d22c

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #28111 [ run ] completed with state FAILURE. Commit: 3793303
/LLM/main/L0_MergeRequest_PR pipeline #21472 completed with status: 'FAILURE'

@reasonsolo
reasonsolo force-pushed the TRTLLM-9181_disaggmetrics branch from 3793303 to eecbbf7 Compare December 14, 2025 02:50
@reasonsolo

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #28185 [ run ] triggered by Bot. Commit: eecbbf7

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #28185 [ run ] completed with state SUCCESS. Commit: eecbbf7
/LLM/main/L0_MergeRequest_PR pipeline #21539 completed with status: 'FAILURE'

@reasonsolo
reasonsolo force-pushed the TRTLLM-9181_disaggmetrics branch from eecbbf7 to 9b86ed4 Compare December 14, 2025 12:31
@reasonsolo

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #28246 [ run ] triggered by Bot. Commit: 9b86ed4

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #28246 [ run ] completed with state SUCCESS. Commit: 9b86ed4
/LLM/main/L0_MergeRequest_PR pipeline #21599 completed with status: 'FAILURE'

@reasonsolo
reasonsolo force-pushed the TRTLLM-9181_disaggmetrics branch from 9b86ed4 to db541b1 Compare December 15, 2025 04:49
@reasonsolo

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast --disable-reuse-test

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #28307 [ run ] triggered by Bot. Commit: db541b1

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #28307 [ run ] completed with state SUCCESS. Commit: db541b1
/LLM/main/L0_MergeRequest_PR pipeline #21652 completed with status: 'FAILURE'

@reasonsolo

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #28404 [ run ] triggered by Bot. Commit: db541b1

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #28404 [ run ] completed with state SUCCESS. Commit: db541b1
/LLM/main/L0_MergeRequest_PR pipeline #21735 completed with status: 'FAILURE'

@reasonsolo

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

1 similar comment
@reasonsolo

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #28538 [ run ] triggered by Bot. Commit: db541b1

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #28538 [ run ] completed with state SUCCESS. Commit: db541b1
/LLM/main/L0_MergeRequest_PR pipeline #21857 completed with status: 'FAILURE'

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

@reasonsolo

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #28569 [ run ] triggered by Bot. Commit: db541b1

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #28569 [ run ] completed with state SUCCESS. Commit: db541b1
/LLM/main/L0_MergeRequest_PR pipeline #21885 completed with status: 'SUCCESS'

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