Skip to content

chore(function-autoscaler): remove account ID from invocation query - #769

Open
borao wants to merge 1 commit into
mainfrom
chore/function-autoscaler/remove-account-id-from-invocation-query
Open

chore(function-autoscaler): remove account ID from invocation query#769
borao wants to merge 1 commit into
mainfrom
chore/function-autoscaler/remove-account-id-from-invocation-query

Conversation

@borao

@borao borao commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

TL;DR

Update the function autoscaler's control-plane utilization query to aggregate by function_id and function_version_id, without depending on nca_id.

This prepares the autoscaler for the subsequent removal of the nca_id label from function_request_latency.

Additional Details

This change:

  • aggregates all request latency for the function-version pool
  • aggregates capacity using the same function-version identity
  • works with both the current NCA-labeled latency series and the future series without nca_id
  • allows the autoscaler change to be deployed before the invocation-service metric change

The invocation-service metric change will be submitted separately.

For the Reviewer

Please focus on the control-plane utilization PromQL and its aggregation semantics for a shared function-version resource pool.

For QA

Automated validation completed:

  • focused control-plane query test passed
  • full function-autoscaler test suite passed: 128 passed, 11 integration tests ignored
  • Clippy passed with warnings denied
  • formatting check passed

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

  • Bug Fixes

    • Updated control-plane utilization reporting to correctly aggregate latency, instance, and concurrency metrics across shared function-version pools.
    • Improved utilization results for functions served by multiple network capacity areas.
  • Tests

    • Added coverage verifying the updated utilization aggregation and returned metrics.

Signed-off-by: Bora Oztekin <boztekin@nvidia.com>
@borao
borao requested a review from a team as a code owner August 11, 2026 17:03
@borao
borao requested a review from FamousDirector August 11, 2026 17:03
@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The control-plane utilization query now aggregates latency, instance, and concurrency metrics by function_id and function_version_id. An asynchronous mock-server test verifies the query and returned utilization sample.

Changes

Utilization aggregation

Layer / File(s) Summary
Query aggregation and validation
src/control-plane-services/function-autoscaler/crates/server/src/work/mod.rs
The PromQL grouping removes the NCA dimension. The test verifies the aggregated query and expected timestamped utilization data.

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

Suggested reviewers: famousdirector

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Title check ⚠️ Warning The title follows Conventional Commits syntax, but chore does not accurately describe this functional query change. Use a customer-impact type such as fix or feat, with the required function-autoscaler scope.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
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 chore/function-autoscaler/remove-account-id-from-invocation-query

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

@github-actions

Copy link
Copy Markdown
Contributor

🛡️ CodeQL Analysis

🚨 Found 2 issue(s)

Severity Breakdown:

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

🔗 View full details in Security tab

🕐 Last updated: 2026-08-11 17:05:40 UTC | Commit: 03df4fd

@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.

🧹 Nitpick comments (1)
src/control-plane-services/function-autoscaler/crates/server/src/work/mod.rs (1)

864-902: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Add coverage for both metric label shapes.

The test returns one NCA-free series. It does not verify the current response shape with nca_id, although Metric.nca_id is optional in src/control-plane-services/function-autoscaler/crates/server/src/timeseries_db/timeseries_db_client.rs:196-224.

Add a second case with nca_id present. Keep the existing NCA-free case. The Mockito response is precomputed, so this test verifies query generation but not numeric aggregation across multiple NCA series. Use a PromQL-capable integration fixture if numeric aggregation must be validated.

🤖 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/control-plane-services/function-autoscaler/crates/server/src/work/mod.rs`
around lines 864 - 902, Extend
test_control_plane_utilization_query_aggregates_shared_function_pool with a
second mocked response series containing function_id, function_version_id, and
nca_id, while preserving the existing NCA-free case and query assertion. Ensure
both metric label shapes are covered without changing the current expected
utilization behavior.
🤖 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.

Nitpick comments:
In
`@src/control-plane-services/function-autoscaler/crates/server/src/work/mod.rs`:
- Around line 864-902: Extend
test_control_plane_utilization_query_aggregates_shared_function_pool with a
second mocked response series containing function_id, function_version_id, and
nca_id, while preserving the existing NCA-free case and query assertion. Ensure
both metric label shapes are covered without changing the current expected
utilization behavior.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 4dd09aaa-a7d6-47c0-bfdf-cd42ea27b0d5

📥 Commits

Reviewing files that changed from the base of the PR and between 60bdfd1 and 03df4fd.

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

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