Skip to content

Conversation

@nv-yilinf
Copy link
Collaborator

@nv-yilinf nv-yilinf commented Oct 31, 2025

Summary by CodeRabbit

  • New Features
    • Prometheus metric names updated with the "trtllm_" prefix, including request success counters, latency measurements, and token timing metrics.

Description

Add trtllm_ prefix to metric name so it follows the convention of vllm and sglang

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

  • 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.

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.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 31, 2025

📝 Walkthrough

Walkthrough

A metric naming prefix "trtllm_" is introduced in the MetricsCollector class, and all five Prometheus metric names are updated to use this prefix for standardization while preserving existing initialization logic and label usage.

Changes

Cohort / File(s) Summary
Metrics Naming Standardization
tensorrt_llm/metrics/collector.py
Added metric_prefix attribute initialized to "trtllm_" and updated five metric names: request_success_total, e2e_request_latency_seconds, time_to_first_token_seconds, time_per_output_token_seconds, and request_queue_time_seconds to use the prefix.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Verify all five metric names are correctly prefixed with "trtllm_"
  • Confirm metric instantiation logic and label definitions remain unchanged
  • Check that no other code references the old unprefixed metric names

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Description check ⚠️ Warning PR description lacks required sections: no PR title following the template format, Test Coverage section is empty, and checklist items are incomplete. Add proper PR title following [TICKET][type] format, provide Test Coverage details listing relevant tests, and complete all applicable PR Checklist items before merging.
✅ Passed checks (1 passed)
Check name Status Explanation
Title Check ✅ Passed The PR title "[None][feat] Add trtllm_ prefix for exposed metrics" follows the required format with a valid ticket reference [None], a valid type [feat], and a clear summary. The title accurately reflects the main change in the pull request, which adds the "trtllm_" prefix to Prometheus metric names in the MetricsCollector. The title is concise, specific, and provides meaningful information about the changeset.
✨ 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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
tensorrt_llm/metrics/collector.py (2)

1-1: Add the required NVIDIA Apache-2.0 copyright header.

The file is missing the NVIDIA Apache-2.0 copyright header that should be prepended to all source files.

As per coding guidelines

Add the copyright header at the top of the file before the module docstring:

+# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+# SPDX-License-Identifier: Apache-2.0
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
 """Utilities for Prometheus Metrics Collection."""

28-68: Update test assertions to match new metric names with trtllm_ prefix.

The test file tests/unittest/llmapi/apps/_test_openai_prometheus.py contains assertions that check for the old unprefixed metric names (lines 64-67), but your implementation now emits metrics with the trtllm_ prefix. These assertions will fail once the metric name changes are applied.

Update the assertions to check for the prefixed names:

# Old (lines 64-67):
assert "request_success_total" in data
assert "e2e_request_latency_seconds" in data
assert "time_to_first_token_seconds" in data
assert "request_queue_time_seconds" in data

# Should be updated to:
assert "trtllm_request_success_total" in data
assert "trtllm_e2e_request_latency_seconds" in data
assert "trtllm_time_to_first_token_seconds" in data
assert "trtllm_time_per_output_token_seconds" in data
assert "trtllm_request_queue_time_seconds" in data

Note: The test is also missing an assertion for time_per_output_token_seconds—add that as well.

🧹 Nitpick comments (1)
tensorrt_llm/metrics/collector.py (1)

17-17: LGTM! Consider making the prefix configurable.

The metric prefix is correctly defined and consistently applied across all metrics. The hardcoded value is acceptable for the current use case.

If future flexibility is desired, the prefix could be made configurable via a constructor parameter:

-    def __init__(self, labels: Dict[str, str]) -> None:
+    def __init__(self, labels: Dict[str, str], metric_prefix: str = "trtllm_") -> None:
         from prometheus_client import Counter, Histogram
         self.last_log_time = time.time()
         self.labels = labels
-        self.metric_prefix = "trtllm_"
+        self.metric_prefix = metric_prefix
📜 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 afa75c9 and b66b200.

📒 Files selected for processing (1)
  • tensorrt_llm/metrics/collector.py (5 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{h,hpp,hh,hxx,cpp,cxx,cc,cu,cuh,py}

📄 CodeRabbit inference engine (CODING_GUIDELINES.md)

Use only spaces, no tabs; indent with 4 spaces.

Files:

  • tensorrt_llm/metrics/collector.py
**/*.py

📄 CodeRabbit inference engine (CODING_GUIDELINES.md)

**/*.py: Python code must target Python 3.8+.
Indent Python code with 4 spaces; do not use tabs.
Maintain module namespace when importing; prefer 'from package.subpackage import foo' then 'foo.SomeClass()' instead of importing the class directly.
Python filenames should be snake_case (e.g., some_file.py).
Python classes use PascalCase names.
Functions and methods use snake_case names.
Local variables use snake_case; prefix 'k' for variables that start with a number (e.g., k_99th_percentile).
Global variables use upper SNAKE_CASE prefixed with 'G' (e.g., G_MY_GLOBAL).
Constants use upper SNAKE_CASE (e.g., MY_CONSTANT).
Avoid shadowing variables from an outer scope.
Initialize all externally visible members of a class in the constructor.
Prefer docstrings for interfaces that may be used outside a file; comments for in-function or file-local interfaces.
Use Google-style docstrings for classes and functions (Sphinx-parsable).
Document attributes and variables inline so they render under the class/function docstring.
Avoid reflection when a simpler, explicit approach suffices (e.g., avoid dict(**locals()) patterns).
In try/except, catch the most specific exceptions possible.
For duck-typing try/except, keep the try body minimal and use else for the main logic.

Files:

  • tensorrt_llm/metrics/collector.py
**/*.{cpp,cxx,cc,h,hpp,hh,hxx,cu,cuh,py}

📄 CodeRabbit inference engine (CODING_GUIDELINES.md)

Prepend the NVIDIA Apache-2.0 copyright header with current year to the top of all source files (e.g., .cpp, .h, .cu, .py).

Files:

  • tensorrt_llm/metrics/collector.py
🧠 Learnings (1)
📓 Common learnings
Learnt from: venkywonka
Repo: NVIDIA/TensorRT-LLM PR: 6029
File: .github/pull_request_template.md:45-53
Timestamp: 2025-08-27T17:50:13.264Z
Learning: For PR templates in TensorRT-LLM, avoid suggesting changes that would increase developer overhead, such as converting plain bullets to mandatory checkboxes. The team prefers guidance-style bullets that don't require explicit interaction to reduce friction in the PR creation process.
⏰ 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

@nv-yilinf nv-yilinf force-pushed the add_trtllm_prefix_for_exposed_metrics branch from b66b200 to 66b3e65 Compare October 31, 2025 17:10
@nv-yilinf nv-yilinf changed the title [None][feat]Add trtllm_ prefix for exposed metrics [None][feat] Add trtllm_ prefix for exposed metrics Oct 31, 2025
@nv-yilinf
Copy link
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd
Copy link
Collaborator

PR_Github #23217 [ run ] triggered by Bot. Commit: 66b3e65

Copy link

@keivenchang keivenchang left a comment

Choose a reason for hiding this comment

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

LGTM thanks!

@tensorrt-cicd
Copy link
Collaborator

PR_Github #23217 [ run ] completed with state SUCCESS. Commit: 66b3e65
/LLM/main/L0_MergeRequest_PR pipeline #17500 completed with status: 'SUCCESS'

@nv-yilinf nv-yilinf enabled auto-merge (squash) November 4, 2025 07:00
@nv-yilinf nv-yilinf merged commit b7798bf into NVIDIA:main Nov 6, 2025
8 of 11 checks passed
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