Skip to content

Conversation

@keivenchang
Copy link
Contributor

@keivenchang keivenchang commented Jul 29, 2025

Overview:

Renames frontend metrics from nv_llm_http_service_* to dynamo_frontend_* and hardcodes the "dynamo" prefix in the metrics system for consistency and simplified API.

Details:

  • Metric Renaming: Updates all frontend metric names from nv_llm_http_service_* to dynamo_frontend_* across Rust code, Python utilities, and Grafana dashboards
  • Hardcoded Prefix: Simplifies the Metrics API by removing the dynamic prefix parameter and hardcoding "dynamo" as the prefix
  • Deprecation Notices: Adds prominent deprecation warnings for the old components/metrics component and llm_kv_* metrics
  • Documentation Updates: Updates metrics documentation to reflect the new naming convention and simplified API

Where should the reviewer start?

  • lib/llm/src/http/service/metrics.rs - Core metrics implementation changes
  • components/planner/src/dynamo/planner/utils/prometheus.py - Python utility updates
  • deploy/metrics/grafana_dashboards/grafana-dynamo-dashboard.json - Dashboard metric name updates
  • docs/guides/metrics.md - Documentation updates

Related Issues:

Relates to DIS-337

Summary by CodeRabbit

  • Documentation

    • Added deprecation notices to metrics-related documentation and Grafana dashboards, guiding users to migrate to the new MetricsRegistry system.
    • Updated instructions and references to reflect the new metrics system and changed metric prefixes from legacy names to "dynamo" or "dynamo_frontend".
    • Clarified migration steps and provided links to updated guides.
  • Refactor

    • Standardized all Prometheus metric names and queries to use the "dynamo_frontend" prefix, replacing older naming conventions.
  • Tests

    • Updated tests to check for the new metric names reflecting the "dynamo_frontend" prefix.

@copy-pr-bot
Copy link

copy-pr-bot bot commented Jul 29, 2025

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 29, 2025

Walkthrough

This change updates metric naming conventions and documentation across several components, replacing the nv_llm and llm_kv_* metric prefixes with dynamo_frontend and dynamo_*. Multiple README and configuration files are updated to include deprecation notices and migration instructions to the new MetricsRegistry system. Code and test references are also updated accordingly.

Changes

Cohort / File(s) Change Summary
Documentation Deprecation & Migration Notices
components/metrics/README.md, deploy/metrics/README.md, deploy/metrics/grafana_dashboards/grafana-llm-metrics.json
Added prominent deprecation notices for legacy metrics components and dashboards. Updated migration guidance to the new MetricsRegistry system and revised metric prefix references.
Prometheus Metric Prefix Updates (Code & Dashboards)
components/planner/src/dynamo/planner/utils/prometheus.py, deploy/metrics/grafana_dashboards/grafana-dynamo-dashboard.json, lib/llm/src/http/service/metrics.rs, lib/llm/tests/http-service.rs
Changed all metric name prefixes from nv_llm_http_service_ to dynamo_frontend_ in code, tests, and dashboard queries. Updated constructor signatures and test assertions to match new metric names.
Prometheus Config Update
deploy/metrics/prometheus.yml
Added comments indicating the deprecation of the metrics aggregation service and guidance to use the new MetricsRegistry system. No functional changes to scraping configuration.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant MetricsRegistry
    participant Prometheus
    participant Grafana

    User->>MetricsRegistry: Exposes metrics at /metrics (dynamo_frontend_*)
    Prometheus->>MetricsRegistry: Scrapes metrics (port 8081)
    Grafana->>Prometheus: Queries dynamo_frontend_* metrics
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐇
A hop, a skip, a metric’s new name,
From nv_llm to dynamo—no more the same!
Dashboards and docs wave goodbye to the old,
Deprecation notices, migration stories told.
With MetricsRegistry shining bright,
The future of stats is dynamo-powered delight!
📊✨

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

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: 1

🔭 Outside diff range comments (1)
components/planner/src/dynamo/planner/utils/prometheus.py (1)

30-35: Division by zero still possible

If *_count does not increase within the interval the query returns NaN, causing float(...) to raise. You already blanket-catch, but consider adding or 0 in PromQL to avoid NaN (e.g., ... / clamp_min(increase(..._count[...]),1)).

🧹 Nitpick comments (10)
lib/llm/src/http/service/metrics.rs (2)

102-110: Docstring prefix is inconsistent with the actual metric names

The comment says the constructor hard-codes the "dynamo" prefix, yet every metric below is created with the "dynamo_frontend_" prefix.
Either update the wording ("dynamo_frontend"), or adjust the metric names if "dynamo" is the intended canonical prefix.


112-200: Consider de-duplicating the literal prefix & add error context instead of unwrap()

The same "dynamo_frontend_" literal is repeated seven times. A single const PREFIX: &str = "dynamo_frontend"; and format!("{PREFIX}_requests_total") style construction would reduce copy-paste risk if the prefix changes again.

While touching this block, replace unwrap() with expect("failed to create <metric_name>") (or propagate the error) to avoid a panic without context during service start-up.

deploy/metrics/prometheus.yml (1)

50-52: Deprecation note is helpful – consider adding a removal timeline

Adding the comment clarifies the migration. Mentioning when the job will be removed (e.g., “to be removed in vX.Y”) would set clear expectations for operators.

deploy/metrics/grafana_dashboards/grafana-dynamo-dashboard.json (1)

30-110: Dashboard description strings still reference old metric units

Panel 17 (Frontend Avg Request Duration) description uses "dynamo_frontend_request_duration (sum/count)" while the query is on *_seconds_. Consider appending “_seconds” in the description to stay consistent with the metric family.

components/planner/src/dynamo/planner/utils/prometheus.py (2)

30-35: Prefix duplication – define once

Each query embeds the literal "dynamo_frontend". Extract it to a module-level constant to avoid divergence with future renames.

-PREFIX = "dynamo_frontend"
+PREFIX = "dynamo_frontend"

 def _sum(metric): return f"{PREFIX}_{metric}_sum"
 def _cnt(metric): return f"{PREFIX}_{metric}_count"

45-47: Repeated pattern – helper function could cut boilerplate

All six helpers share identical try/except structure differing only by the query string. A private _query_float(expr) util would DRY this up and make logging uniform.

Also applies to: 56-58, 81-83, 92-94

deploy/metrics/grafana_dashboards/grafana-llm-metrics.json (1)

29-35: Dashboard not clearly marked as deprecated inside Grafana UI

The JSON adds a textual deprecation notice, but users skimming dashboards in Grafana will largely rely on title / tags / UID rather than this hidden copyright array.
Consider renaming either title or uid (or adding an extra tag) to include “-DEPRECATED” so it surfaces in the dashboard list & API responses.

-  "title": "LLM Worker Metrics",
+  "title": "LLM Worker Metrics (DEPRECATED)",
...
-  "uid": "llm-worker-metrics",
+  "uid": "llm-worker-metrics-deprecated",
+  "tags": ["llm", "metrics", "deprecated"],
components/metrics/README.md (2)

3-16: Deprecation section lacks concrete removal timeline

The notice is helpful, but many users want to know when the component disappears (next minor vs. next major).
Add an approximate target release or link to the tracking issue to set expectations.


23-23: Prefix note may mis-lead readers

The bullet still states demo metrics use the "llm" prefix while production will use "dynamo".
With the wider rename to dynamo_frontend_*, the production prefix statement is no longer precise.

- In this demo the metrics names use the prefix "llm", but in production they will be prefixed with "dynamo"
+ In this demo the metrics names use the prefix "llm", but production metrics are now prefixed with "dynamo_frontend"
deploy/metrics/README.md (1)

121-135: Duplicate information—risk of readers missing the warning

The DEPRECATED METRICS NOTICE block repeats part of the earlier deprecation text.
You can collapse the duplication and keep a single, highly-visible notice to reduce maintenance overhead.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e542f00 and 0cbcb99.

📒 Files selected for processing (8)
  • components/metrics/README.md (1 hunks)
  • components/planner/src/dynamo/planner/utils/prometheus.py (6 hunks)
  • deploy/metrics/README.md (2 hunks)
  • deploy/metrics/grafana_dashboards/grafana-dynamo-dashboard.json (11 hunks)
  • deploy/metrics/grafana_dashboards/grafana-llm-metrics.json (1 hunks)
  • deploy/metrics/prometheus.yml (1 hunks)
  • lib/llm/src/http/service/metrics.rs (7 hunks)
  • lib/llm/tests/http-service.rs (1 hunks)
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
Learnt from: biswapanda
PR: ai-dynamo/dynamo#1412
File: lib/bindings/python/src/dynamo/runtime/logging.py:100-100
Timestamp: 2025-06-06T21:48:35.214Z
Learning: In the Dynamo codebase, BentoML has been completely removed from all executable code, with only documentation and attribution references remaining. The error_loggers configuration in lib/bindings/python/src/dynamo/runtime/logging.py should not include "bentoml" since those modules no longer exist.
deploy/metrics/prometheus.yml (1)

Learnt from: julienmancuso
PR: #2012
File: deploy/cloud/helm/crds/templates/nvidia.com_dynamocomponentdeployments.yaml:92-98
Timestamp: 2025-07-18T16:04:31.771Z
Learning: CRD schemas in files like deploy/cloud/helm/crds/templates/*.yaml are auto-generated from Kubernetes library upgrades and should not be manually modified as changes would be overwritten during regeneration.

components/metrics/README.md (1)

Learnt from: PeaBrane
PR: #1392
File: launch/dynamo-run/src/subprocess/vllm_v1_inc.py:71-71
Timestamp: 2025-06-05T01:04:24.775Z
Learning: The create_endpoint method in WorkerMetricsPublisher has backward compatibility maintained through pyo3 signature annotation #[pyo3(signature = (component, dp_rank = None))], making the dp_rank parameter optional with a default value of None.

deploy/metrics/README.md (5)

Learnt from: julienmancuso
PR: #2012
File: deploy/cloud/helm/crds/templates/nvidia.com_dynamocomponentdeployments.yaml:92-98
Timestamp: 2025-07-18T16:04:31.771Z
Learning: CRD schemas in files like deploy/cloud/helm/crds/templates/*.yaml are auto-generated from Kubernetes library upgrades and should not be manually modified as changes would be overwritten during regeneration.

Learnt from: nnshah1
PR: #2124
File: components/backends/vllm/deploy/disagg.yaml:54-60
Timestamp: 2025-07-25T22:34:11.384Z
Learning: In vLLM worker deployments, startup probes (with longer periods and higher failure thresholds like periodSeconds: 10, failureThreshold: 60) are used to handle the slow model loading startup phase, while liveness probes are intentionally kept aggressive (periodSeconds: 5, failureThreshold: 1) for quick failure detection once the worker is operational. This pattern separates startup concerns from operational health monitoring in GPU-heavy workloads.

Learnt from: biswapanda
PR: #1890
File: examples/vllm/deploy/agg.yaml:63-70
Timestamp: 2025-07-14T23:01:16.218Z
Learning: In vLLM worker deployments, grep-based log checks for "VllmWorker.*has been initialized" are appropriate for readiness probes to verify worker startup, but should not be used for liveness probes which need to detect ongoing worker health.

Learnt from: PeaBrane
PR: #1285
File: lib/llm/src/kv_router/scoring.rs:58-63
Timestamp: 2025-05-30T06:38:09.630Z
Learning: In lib/llm/src/kv_router/scoring.rs, the user prefers to keep the panic behavior when calculating load_avg and variance with empty endpoints rather than adding guards for division by zero. They want the code to fail fast on this error condition.

Learnt from: PeaBrane
PR: #1285
File: lib/llm/src/kv_router/scheduler.rs:260-266
Timestamp: 2025-05-30T06:34:12.785Z
Learning: In the KV router scheduler code, PeaBrane prefers fail-fast behavior over silent failure handling. When accessing worker metrics data that could be out-of-bounds (like dp_rank indexing), explicit panics are preferred over graceful degradation with continue statements to ensure data integrity issues are caught early.

🔇 Additional comments (1)
lib/llm/tests/http-service.rs (1)

358-362: LGTM ‑ test updated to the new histogram name

The assertion now targets dynamo_frontend_request_duration_seconds; matches the production rename.

@keivenchang keivenchang force-pushed the keivenchang/DIS-337/frontend-metrics-to-be-renamed branch from 1eb1991 to 072f489 Compare July 30, 2025 01:13
@keivenchang keivenchang self-assigned this Jul 30, 2025
@keivenchang keivenchang force-pushed the keivenchang/DIS-337/frontend-metrics-to-be-renamed branch from 7c5a0c6 to 26e206c Compare July 30, 2025 17:25
Copy link
Contributor

@rmccorm4 rmccorm4 left a comment

Choose a reason for hiding this comment

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

Nice work!

@keivenchang keivenchang force-pushed the keivenchang/DIS-337/frontend-metrics-to-be-renamed branch from 030a862 to 499264a Compare August 1, 2025 00:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants