Skip to content

fix(function-autoscaler): use unified invocation metric - #1600

Open
borao wants to merge 1 commit into
mainfrom
fix/autoscaler/remove-legacy-invocation-query
Open

fix(function-autoscaler): use unified invocation metric#1600
borao wants to merge 1 commit into
mainfrom
fix/autoscaler/remove-legacy-invocation-query

Conversation

@borao

@borao borao commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

TL;DR

Use function_request_total as the single recent-invocation metric for both the invocation service and gRPC proxy.

This removes the unused function_request query and stops attributing combined invocation traffic to gRPC proxy.

Additional Details

  • Removes the duplicate recent-invocation query.
  • Renames the combined query source to invocation.
  • Reduces discovery from 12 to 8 sharded queries.
  • Reduces per-function checks from two queries to one.
  • Preserves fail-closed behavior when the invocation query fails.
  • Updates the affected query-generation and failure tests.

Managed deployments must expose function_request_total before rolling out this autoscaler version. Self-managed deployments already expose that name.

For the Reviewer

Please focus on the query construction and per-function fail-closed behavior in work/discovery.rs.

For QA

  • bazel test //src/control-plane-services/function-autoscaler/crates/server:rs_autoscaler_test --nocache_test_results --runs_per_test=3
    • 135 passed and 10 ignored per run.
  • Built the autoscaler library, server, and image layer successfully.
  • The image-index build could not fetch the private nvcr.io base image without registry credentials.

Issues

Related to #15

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

  • Improvements
    • Streamlined function invocation discovery by using a unified request metric and gateway data.
    • Reduced the number of queries required for sharded and per-version discovery, improving efficiency.
    • Sharded discovery now continues using successful partial results when some queries fail.
    • Per-function discovery now fails safely when its only discovery query is unsuccessful.

Signed-off-by: Bora Oztekin <boztekin@nvidia.com>
@borao
borao requested a review from a team as a code owner September 5, 2026 20:08
@borao
borao requested a review from sanjay-saxena September 5, 2026 20:08
@coderabbitai

coderabbitai Bot commented Sep 5, 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: bc42e5b6-c99e-45c8-a6d2-4b088ed6e596

📥 Commits

Reviewing files that changed from the base of the PR and between ed688b4 and a2ac622.

📒 Files selected for processing (1)
  • src/control-plane-services/function-autoscaler/crates/server/src/work/discovery.rs

Included review availability: Your plan provides up to 12 included reviews per hour; 11 remain after this review.


📝 Walkthrough

Walkthrough

Invocation discovery now uses function_request_total and LLM Gateway queries instead of separate invocation-service and gRPC-proxy sources. Sharded and per-version query counts decrease. Per-function failure handling and related tests now use the unified query.

Changes

Invocation discovery query consolidation

Layer / File(s) Summary
Unified query construction
src/control-plane-services/function-autoscaler/crates/server/src/work/discovery.rs
Discovery uses one invocation source with LLM Gateway queries. Sharded discovery uses eight queries, and per-version discovery uses one query. Per-function discovery fails closed when the invocation query fails.
Discovery query and failure tests
src/control-plane-services/function-autoscaler/crates/server/src/work/discovery.rs
Tests validate the reduced query counts, function_request_total, and failure results without a gRPC request.

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

Merge Risk: 🔵 Low · up to a2ac6

The autoscaler now relies on function_request_total for invocation discovery. This is mergeable provided managed deployments expose that metric before upgrade; otherwise autoscaling discovery may fail closed.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 55.56% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 1 files. 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 follows Conventional Commits format and accurately describes the primary change to use a unified invocation metric in the function autoscaler.
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.
  • Fix all pre-merge checks with AI
✨ 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 fix/autoscaler/remove-legacy-invocation-query

Warning

Some tools did not complete. Review the errors below.

🔧 Clippy (1.97.1)

Clippy execution failed


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

@github-actions

github-actions Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

🛡️ CodeQL Analysis

🚨 Found 5 issue(s)

Severity Breakdown:

  • 🔴 Errors: 0
  • 🟡 Warnings: 0
  • 🔵 Notes: 0
📋 Top Issues

🔗 View full details in Security tab

🕐 Last updated: 2026-09-05 20:26:07 UTC | Commit: a2ac622

@dmikhaylovnv dmikhaylovnv left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

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.

2 participants