Skip to content

feat(ratelimiter): expose GET /info endpoint - #591

Draft
priyaselvaganesan wants to merge 1 commit into
mainfrom
feat/version-endpoint-ratelimiter
Draft

feat(ratelimiter): expose GET /info endpoint#591
priyaselvaganesan wants to merge 1 commit into
mainfrom
feat/version-endpoint-ratelimiter

Conversation

@priyaselvaganesan

@priyaselvaganesan priyaselvaganesan commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

TL;DR

Adds GET /info to the ratelimiter management HTTP server (port 8080, alongside /health), serving service name, version, and commit SHA via go-lib's shared nvcfversion.Handler().

Additional Details

  • Fields come from Service, Version, and GitHash x_defs injected at build time (--stamp). GitHash uses {STABLE_GIT_COMMIT_FULL}, so commit is the full 40-char SHA. Non-GET returns 405 (Allow: GET).
  • Extracts the inline health-mux setup into newHealthServeMux so the routes are unit-testable. /health behavior is unchanged.
  • Bumps the go.mod go-lib pin to the merged version that provides Handler() (feat(go-lib/version): add Handler and HandlerFor http.Handler #270). Per Go MVS this also moves go.opentelemetry.io/otel to v1.44 and related golang.org/x deps forward, as go-lib requires.

Changes:

  • cmd/main.go: extracts newHealthServeMux, registers nvcfversion.Handler() at GET /info
  • cmd/BUILD.bazel: adds Service/Version/GitHash x_defs on the binary and the go-lib pkg/version dep
  • cmd/info_test.go: covers /info 200 shape and non-GET 405
  • tools/workspace_status.sh: emits STABLE_GIT_COMMIT_FULL
  • go.mod / go.sum: pin the merged go-lib

For the Reviewer

For QA

Built with bazel build //cmd:image.tar --stamp and deployed to a local cluster, then curled the endpoint:

GET /info   -> 200 application/json
{"service":"nvcf-ratelimiter","version":"mr-<sha>","commit":"<full-40-char-sha>"}

GET /health -> 200
POST /info  -> 405 Method Not Allowed  (Allow: GET)

In a local build version is the tag or mr-<sha> at HEAD. In a CI release build it is the service release semver.

Issues

Relates to #315

Checklist

  • I am familiar with the Contributing Guidelines.
  • I have signed off my commits for Developer Certificate of Origin (DCO) compliance.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

Summary by CodeRabbit

  • New Features

    • Added an /info endpoint that reports service version and build metadata, including the full Git commit identifier.
    • Added a shared management interface for health and service information endpoints.
    • /info accepts GET requests and returns structured JSON metadata.
  • Bug Fixes

    • Unsupported methods on /info now return HTTP 405 with an Allow: GET header and an empty response body.

Signed-off-by: priyaselvaganesan <pselvaganesa@nvidia.com>
@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The ratelimiter management server now serves version metadata at /info. Bazel injects service and Git metadata into the binary. Tests cover successful GET responses and rejection of non-GET methods.

Changes

Ratelimiter management metadata

Layer / File(s) Summary
Build-time version metadata
src/invocation-plane-services/ratelimiter/go.mod, src/invocation-plane-services/ratelimiter/cmd/BUILD.bazel, src/invocation-plane-services/ratelimiter/tools/workspace_status.sh
The build links service, version, and full Git commit metadata. The workspace status script emits the full commit stamp. Module dependencies were updated.
Management mux and endpoint validation
src/invocation-plane-services/ratelimiter/cmd/main.go, src/invocation-plane-services/ratelimiter/cmd/info_test.go, src/invocation-plane-services/ratelimiter/cmd/BUILD.bazel
The shared management mux serves /health and /info. Tests validate JSON metadata, HTTP 405 responses, the Allow: GET header, and empty bodies for non-GET requests.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant newHealthServeMux
  participant nvcfversion.Handler
  participant rateLimiter
  Client->>newHealthServeMux: GET /info
  newHealthServeMux->>nvcfversion.Handler: Serve version metadata
  nvcfversion.Handler-->>Client: JSON metadata response
  Client->>newHealthServeMux: GET /health
  newHealthServeMux->>rateLimiter: Health()
  rateLimiter-->>Client: Health response
Loading

Possibly related PRs

  • NVIDIA/nvcf#275: Adds a similar GET /info endpoint with version metadata, Git stamping, Bazel wiring, and method validation.

Suggested reviewers: max-nv

🚥 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 follows Conventional Commits and accurately describes the primary feature: adding the ratelimiter GET /info endpoint.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ 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 feat/version-endpoint-ratelimiter

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (2.12.2)

level=error msg="[linters_context] typechecking error: pattern ./...: directory prefix . does not contain main module or its selected dependencies"


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

@priyaselvaganesan
priyaselvaganesan marked this pull request as ready for review July 31, 2026 21:56
@priyaselvaganesan
priyaselvaganesan requested a review from a team as a code owner July 31, 2026 21:56

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/invocation-plane-services/ratelimiter/cmd/info_test.go (1)

44-50: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Verify metadata from the stamped binary.

These assertions accept "unknown" values. The tests can pass if the go_binary linker definitions are removed or use incorrect keys. Add a stamped-binary test that verifies the injected service, version, and commit values, or confirm that the repository’s go_test rule can apply equivalent x_defs.

As per coding guidelines, “Code changes must include tests.” Based on learnings, use the repository-native test runner for build and test rules.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/invocation-plane-services/ratelimiter/cmd/info_test.go` around lines 44 -
50, Strengthen the metadata test around the stamped binary response so it
verifies the expected injected service, version, and commit values rather than
merely checking non-empty fields or allowing "unknown". Use the
repository-native build/test runner and either add a stamped-binary test or
configure the go_test rule with equivalent x_defs, ensuring the assertions
detect missing or incorrect linker keys.

Sources: Coding guidelines, Learnings

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/invocation-plane-services/ratelimiter/cmd/main.go`:
- Around line 143-156: Wrap the management mux returned by newHealthServeMux
before passing it to http.ListenAndServe using the established HTTP telemetry
middleware. Configure stable service.operation names for /health and /info, and
enable the Prometheus integration to export failed-request status attributes
while preserving the existing handlers and responses.

---

Nitpick comments:
In `@src/invocation-plane-services/ratelimiter/cmd/info_test.go`:
- Around line 44-50: Strengthen the metadata test around the stamped binary
response so it verifies the expected injected service, version, and commit
values rather than merely checking non-empty fields or allowing "unknown". Use
the repository-native build/test runner and either add a stamped-binary test or
configure the go_test rule with equivalent x_defs, ensuring the assertions
detect missing or incorrect linker keys.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 8927bec0-9b1a-48fb-aa1e-9e1bef6582c1

📥 Commits

Reviewing files that changed from the base of the PR and between 4311bd1 and a54c2fa.

⛔ Files ignored due to path filters (1)
  • src/invocation-plane-services/ratelimiter/go.sum is excluded by !**/*.sum
📒 Files selected for processing (5)
  • src/invocation-plane-services/ratelimiter/cmd/BUILD.bazel
  • src/invocation-plane-services/ratelimiter/cmd/info_test.go
  • src/invocation-plane-services/ratelimiter/cmd/main.go
  • src/invocation-plane-services/ratelimiter/go.mod
  • src/invocation-plane-services/ratelimiter/tools/workspace_status.sh

Comment thread src/invocation-plane-services/ratelimiter/cmd/main.go
@priyaselvaganesan priyaselvaganesan self-assigned this Jul 31, 2026
@priyaselvaganesan
priyaselvaganesan marked this pull request as draft July 31, 2026 22:11
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.

1 participant