Skip to content

fix(metrics): add /v1/messages to route_to_endpoint match#1564

Merged
slin1237 merged 1 commit into
mainfrom
ekzhang/messages-api-metrics-label
May 27, 2026
Merged

fix(metrics): add /v1/messages to route_to_endpoint match#1564
slin1237 merged 1 commit into
mainfrom
ekzhang/messages-api-metrics-label

Conversation

@ekzhang
Copy link
Copy Markdown
Collaborator

@ekzhang ekzhang commented May 27, 2026

Without this, all Messages API metrics from the HTTP router get bucketed under "other" instead of the existing ENDPOINT_MESSAGES label.

Description

Problem

Solution

Changes

Test Plan

Checklist
  • cargo +nightly fmt passes
  • cargo clippy --all-targets --all-features -- -D warnings passes
  • (Optional) Documentation updated
  • (Optional) Please join us on Slack #sig-smg to discuss, review, and merge PRs

Summary by CodeRabbit

  • Chores
    • Enhanced metrics tracking for message endpoints to improve service observability and monitoring capabilities.

Review Change Stack

Without this, all Messages API metrics from the HTTP router get
bucketed under "other" instead of the existing ENDPOINT_MESSAGES label.

Signed-off-by: Eric Zhang <eric@thinkingmachines.ai>
@github-actions github-actions Bot added grpc gRPC client and router changes model-gateway Model gateway crate changes labels May 27, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 27, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 8888d605-2977-4362-9633-448ce9b57e64

📥 Commits

Reviewing files that changed from the base of the PR and between 5c875db and a91cb94.

📒 Files selected for processing (1)
  • model_gateway/src/routers/grpc/utils/metrics.rs

📝 Walkthrough

Walkthrough

This PR adds a single route-to-endpoint mapping in the metrics utility. The route_to_endpoint function now recognizes the /v1/messages API path and classifies it with the ENDPOINT_MESSAGES metrics label for telemetry tracking.

Changes

Metrics Endpoint Mapping

Layer / File(s) Summary
v1/messages route mapping
model_gateway/src/routers/grpc/utils/metrics.rs
The route_to_endpoint function adds a match arm for "/v1/messages" that returns the ENDPOINT_MESSAGES metrics label.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Suggested labels

model-gateway

Suggested reviewers

  • slin1237
  • key4ng
  • CatherineSue

Poem

🐰 A message route hops into view,
Metrics labeled bright and true,
One little line adds clarity,
Now v1/messages tracks quite merrily! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: adding /v1/messages to the route_to_endpoint match in metrics.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ekzhang/messages-api-metrics-label

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
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request adds the "/v1/messages" route mapping to the route_to_endpoint utility function in the gRPC metrics router, mapping it to the corresponding ENDPOINT_MESSAGES label. There are no review comments to address.

@claude
Copy link
Copy Markdown

claude Bot commented May 27, 2026

👋 The PR description doesn't fully follow
PULL_REQUEST_TEMPLATE.md:

  • Empty section: ### Problem (only contains HTML comments)
  • Empty section: ### Solution (only contains HTML comments)
  • Empty section: ## Changes (only contains HTML comments)
  • Empty section: ## Test Plan (only contains HTML comments)

Please update the PR description so reviewers have the context they need.

"/v1/completions" => metrics_labels::ENDPOINT_COMPLETIONS,
"/v1/rerank" => metrics_labels::ENDPOINT_RERANK,
"/v1/responses" => metrics_labels::ENDPOINT_RESPONSES,
"/v1/messages" => metrics_labels::ENDPOINT_MESSAGES,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟣 Pre-existing: Other HTTP routes with defined ENDPOINT_* constants are also missing from this match — notably /v1/embeddings (ENDPOINT_EMBEDDINGS) and /v1/classify (ENDPOINT_CLASSIFY). They'll silently bucket under "other" just like /v1/messages did before this fix. Not blocking this PR, but worth a follow-up.

Copy link
Copy Markdown

@claude claude Bot left a comment

Choose a reason for hiding this comment

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

Correct fix — ENDPOINT_MESSAGES is already defined and /v1/messages is a registered HTTP route, so adding this match arm is the right thing. One pre-existing note about other unmapped routes left inline.

Summary: 0 🔴 Important · 0 🟡 Nit · 1 🟣 Pre-existing

@slin1237 slin1237 merged commit b63d6dd into main May 27, 2026
19 checks passed
@slin1237 slin1237 deleted the ekzhang/messages-api-metrics-label branch May 27, 2026 16:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

grpc gRPC client and router changes model-gateway Model gateway crate changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants