Skip to content

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

Open
priyaselvaganesan wants to merge 2 commits into
mainfrom
feat/version-endpoint-ratelimiter
Open

feat(ratelimiter): expose GET /info endpoint#591
priyaselvaganesan wants to merge 2 commits 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 the service name, version, and Git commit metadata in JSON format.
    • Added clear method handling for /info; unsupported requests return HTTP 405 with Allow: GET.
    • Consolidated management endpoints so /health and /info are served consistently.
    • Preserved existing health-check functionality while providing a consistent management interface for service status and build information.

@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 526bc3a6-2503-4e99-b6d4-ecbc91cfe2b3

📥 Commits

Reviewing files that changed from the base of the PR and between 6bb0cde and 91dcf74.

⛔ Files ignored due to path filters (1)
  • src/invocation-plane-services/ratelimiter/go.sum is excluded by !**/*.sum
📒 Files selected for processing (4)
  • 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
🚧 Files skipped from review as they are similar to previous changes (3)
  • src/invocation-plane-services/ratelimiter/cmd/BUILD.bazel
  • src/invocation-plane-services/ratelimiter/cmd/main.go
  • src/invocation-plane-services/ratelimiter/go.mod

📝 Walkthrough

Walkthrough

The ratelimiter management server now serves /info with build version metadata. Bazel injects service and Git metadata. The shared mux preserves /health behavior, and tests validate successful GET and rejected non-GET requests.

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
The build links the service name, stable version, and full stable Git commit. Module dependency versions are 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 mux serves /health and /info. Tests validate JSON metadata for GET and HTTP 405 responses for POST, PUT, and DELETE.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • NVIDIA/nvcf#610: Both changes add and test a /info endpoint with version metadata and Bazel linker wiring.

Suggested reviewers: famousdirector, max-nv

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title uses the required Conventional Commit format and accurately describes the primary change, which adds the ratelimiter GET /info endpoint.
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 💡 1
📝 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

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
@priyaselvaganesan
priyaselvaganesan force-pushed the feat/version-endpoint-ratelimiter branch from a54c2fa to 36253c1 Compare August 5, 2026 22:54
@priyaselvaganesan
priyaselvaganesan marked this pull request as ready for review August 5, 2026 23:01
@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@priyaselvaganesan
priyaselvaganesan force-pushed the feat/version-endpoint-ratelimiter branch from dd8fa06 to 91dcf74 Compare August 6, 2026 18:41
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

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