feat(rust): serve GET /info from function-autoscaler and http-invocation - #1579
Draft
priyaselvaganesan wants to merge 2 commits into
Draft
feat(rust): serve GET /info from function-autoscaler and http-invocation#1579priyaselvaganesan wants to merge 2 commits into
priyaselvaganesan wants to merge 2 commits into
Conversation
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueComment |
Contributor
🛡️ CodeQL Analysis🚨 Found 5 issue(s) Severity Breakdown:
📋 Top Issues🔗 View full details in Security tab 🕐 Last updated: 2026-09-04 19:08:40 UTC | Commit: 96dcd5f |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TL;DR
Adds
GET /infoto the two Rust services,function-autoscalerandhttp-invocation, completing the endpoint across all three languages. Response schema matches the Go (src/libraries/go/lib/pkg/version, #270) and Java (nv-boot-starter-core, #1212) endpoints:{"service":"nvcf-function-autoscaler","version":"1.2.3","commit":"16769d1988ff11c19071966db971de23b173f289"}The schema lives in a new shared crate,
src/libraries/rust/nvcf-info, so it is not hand-duplicated per service.Additional Details
versionandcommitcome from the existing per-serviceversion_envexpand_templateincrates/server/BUILD.bazel, which already stampedCARGO_PKG_VERSIONfromSTABLE_VERSIONfor the OTelservice.versionattribute. This addsNVCF_GIT_COMMITfromSTABLE_GIT_COMMIT_FULL, the same workspace-status key the Go services use, so all three languages report the same full SHA. Unstamped local builds fall back to0.0.0-devandunknown.Three things about the shared crate are worth a reviewer's attention.
info_response!is a macro rather than a function. Rust has no equivalent to Go's linker-Xstamping of an imported package's variables, so a function here would report nvcf-info's own crate metadata. The macro expands inside the calling crate, whereenv!reads that crate's stamped values.The service name is passed to the macro instead of read from
CARGO_PKG_NAME. This matches the Go services, which setversion.Serviceto an explicit deployed name inx_defs. It is also necessary: under Bazel,CARGO_PKG_NAMEresolves to the rules_rust target name, so deriving it would reportrs_autoscaler_lib.BUILD.bazelbuildssrc/lib.rsonce per consuming crate universe. Each Rust service resolves third-party crates from its owncrate_universerepo, so@rs_autoscaler_crates//:serdeand@nvcf_invocation_crates//:serdeare distinct crates and therefore distinctSerializetraits. A single shared target compiles but then fails at theaxum::Jsonbound in one of the two callers.For the Reviewer
The shared crate is a Bazel dependency only, not a cargo path dependency.
cargo-bazel splicecopies each service workspace into a temp dir rooted at that workspace, so a path dependency pointing outside the service directory resolves above the splice root and fails to load. I tried the path dependency, a symlink inside the service tree, and giving nvcf-info its own[workspace]table; all three fail the same way.The consequence is that
cargo build/cargo testinfunction-autoscalerandhttp-invocationno longer resolvenvcf_info. Bazel is the canonical CI and release path for both, andbazel testcovers the same crates, but this does change the local cargo loop documented in those services'AGENTS.md, so both files now say so. If you would rather keep cargo working, the alternative is dropping the shared crate and inlining the 3-field struct in each service. Happy to switch.MODULE.bazelis unchanged: nvcf-info needs nocrate_universeof its own.Customer Release Notes
function-autoscalerandhttp-invocationnow serveGET /info, returning the service name, release version, and git commit of the running build.Testing
bazel test --stamp //src/libraries/rust/nvcf-info:all \ //src/control-plane-services/function-autoscaler/crates/server:all \ //src/invocation-plane-services/http-invocation/crates/server:allAll three test targets pass. Verified the stamping end to end rather than only through cargo: with
--stamp, the generatedversion.envcarries the realSTABLE_VERSIONand the fullSTABLE_GIT_COMMIT_FULL, and both stamped server binaries contain that commit string and their own service name.cargo fmt --check,cargo clippy --all-targets -- -D warnings, andcargo testare clean fornvcf-infoitself.cargo fmt --checkinhttp-invocationreports diffs inbuild.rs,metrics/mod.rs,middleware/spans.rs, andtelemetry/settings.rs; those files are untouched here and the diffs come from local rustfmt version skew against the pinned toolchain.Not exercised against a running cluster. The handlers are pure and covered by unit tests.
Notes
/infois registered on each service's external-facing router next to/health, not on the internal probe port, matching the Go services. Onhttp-invocationit is placed after theauth_middlewarelayer so it is unauthenticated, same as/health.Issues
Closes #1578
Related Pull Requests
Dependencies
None.
nvcf-infodepends only onserde, already present in both crate universes, plusserde_jsonas a dev-dependency for the schema test.