Skip to content

fix(function-autoscaler): use metric-specific environment labels - #857

Merged
borao merged 1 commit into
mainfrom
fix/function-autoscaler/control-plane-query-env
Aug 14, 2026
Merged

fix(function-autoscaler): use metric-specific environment labels#857
borao merged 1 commit into
mainfrom
fix/function-autoscaler/control-plane-query-env

Conversation

@borao

@borao borao commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

TL;DR

Use the environment labels emitted by each autoscaler metric family: aws_env for invocation/control-plane utilization, worker environment labels for worker metrics, and control-plane environment labels for instance-only queries.

Additional Details

For the Reviewer

Please focus on the query construction in work/mod.rs and work/discovery.rs.

For QA

  • Formatting and Clippy passed.
  • All nonignored tests passed.
  • Corrected queries returned labeled data in production verification.

Issues

NO-REF

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
    • Improved autoscaling metric discovery across staging and production environments.
    • Corrected environment labeling for worker, instance, utilization, and cloud-provider metrics.
    • Active-instance metrics now accurately reflect available instances without relying on an “active” state filter.
    • Added validation to ensure scaling decisions use the appropriate environment-specific metrics.

Signed-off-by: Bora Oztekin <boztekin@nvidia.com>
@borao
borao requested a review from a team as a code owner August 14, 2026 05:40
@borao
borao requested a review from along-2017 August 14, 2026 05:40
@coderabbitai

coderabbitai Bot commented Aug 14, 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: 43f6a05f-db76-423c-8da8-e9735d90921b

📥 Commits

Reviewing files that changed from the base of the PR and between 6910ba8 and c384cb0.

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

📝 Walkthrough

Walkthrough

Changes

Metric environment query updates

Layer / File(s) Summary
Environment mapping and query consumers
src/control-plane-services/function-autoscaler/crates/server/src/work/mod.rs
MetricEnvironments maps AWS, worker, and control-plane labels. Utilization, BYOC instance, and worker-count queries use the mapped labels. Tests cover the mappings and AWS utilization labels.
Discovery PromQL construction
src/control-plane-services/function-autoscaler/crates/server/src/work/discovery.rs
Worker and active-instance PromQL construction uses dedicated helpers. Worker and control-plane labels are applied separately. Active-instance queries no longer require state="active". Tests cover filtered and unfiltered queries.

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

Merge Risk: ⚪ Minimal · up to c384c

The change updates autoscaler queries to use metric-specific environment labels; no actionable merge-blocking risk remains after normal checks and review.

Possibly related PRs

  • NVIDIA/nvcf#727: Shared autoscaler discovery and PromQL environment-label handling.

Suggested reviewers: along-2017

🚥 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 uses the required Conventional Commits format and accurately describes the metric-specific environment label fix.
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 fix/function-autoscaler/control-plane-query-env

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-14 05:42:47 UTC | Commit: c384cb0

@borao
borao requested a review from sbaum1994 August 14, 2026 05:49

@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

@borao
borao added this pull request to the merge queue Aug 14, 2026
Merged via the queue into main with commit 59723a7 Aug 14, 2026
19 checks passed
@borao
borao deleted the fix/function-autoscaler/control-plane-query-env branch August 14, 2026 16:31
@balajinvda

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version nvcf-function-autoscaler-v1.20.3 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants