Skip to content

fix(function-autoscaler): record utilization data age - #1875

Merged
borao merged 1 commit into
mainfrom
fix/function-autoscaler/record-utilization-data-age
Sep 15, 2026
Merged

borao merged 1 commit into
mainfrom
fix/function-autoscaler/record-utilization-data-age

Conversation

@borao

@borao borao commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

TL;DR

Record the age of the newest utilization sample after the autoscaler produces a scaling decision, making the documented histogram observable.

Additional Details

  • Retain the newest raw utilization timestamp.
  • Emit nvcf_autoscaler.processing.utilization_data_age_milliseconds only for real scaling decisions.
  • Skip empty utilization data and clamp future timestamps to zero using saturating arithmetic.
  • Add regression coverage for timestamp retention and age calculation.

For the Reviewer

Please focus on the timestamp units and metric emission point in work/mod.rs.

For QA

Passed locally:

  • cargo clippy -p rs-autoscaler --all-targets -- -D warnings
  • cargo test -p rs-autoscaler (158 passed, 10 ignored)
  • git diff --check

cargo fmt -p rs-autoscaler --check still reports pre-existing formatting drift in work/discovery.rs and unrelated sections of work/mod.rs; the new lines are formatted and that unrelated drift is excluded from this PR.

Issues

Relates 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

  • Bug Fixes
    • Autoscaling now tracks the latest utilization timestamp.
    • Utilization data age is calculated safely, including future timestamps and missing data.
    • Added coverage to verify timestamp propagation and age calculations.

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

coderabbitai Bot commented Sep 14, 2026

Copy link
Copy Markdown

Review Change StackReview 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: 208c384d-773c-4f6b-8a72-0fc27a038ac6

📥 Commits

Reviewing files that changed from the base of the PR and between 0704987 and 0f6f1bd.

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

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


📝 Walkthrough

Walkthrough

The autoscaler now retains the newest utilization timestamp, calculates its non-negative age in milliseconds, and records that age when data is available. Tests cover timestamp propagation, missing timestamps, and future timestamps.

Changes

Utilization age tracking

Layer / File(s) Summary
Utilization timestamp propagation
src/control-plane-services/function-autoscaler/crates/server/src/work/mod.rs
GatheredScalingInputs retains the newest timestamp from raw utilization samples. Worker-path tests verify propagation.
Utilization age calculation and recording
src/control-plane-services/function-autoscaler/crates/server/src/work/mod.rs
The autoscaler converts timestamp age to milliseconds, clamps future data to zero, returns None for missing data, and records available age values. Tests cover these cases.

Priority: ⬇️ Low

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

Change: Bug fix

Suggested reviewers: along-2017

Merge Risk: ⚪ Minimal · up to 0f6f1

The change records utilization-data age only for completed scaling decisions and safely handles missing or future timestamps, with no concrete merge-blocking risk identified.

🚥 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 valid Conventional Commits syntax and accurately describes the change. The scoped fix type is appropriate for adding the missing utilization-age recording behavior.
Docstring Coverage ✅ Passed Docstring coverage is 87.50% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 1 files.
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/record-utilization-data-age

Warning

Some tools did not complete. Review the errors below.

🔧 Clippy (1.98.0)

Clippy execution timed out


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

@github-actions

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-14 22:22:25 UTC | Commit: 0f6f1bd

@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 Sep 15, 2026
Merged via the queue into main with commit a465bf9 Sep 15, 2026
20 checks passed
@borao
borao deleted the fix/function-autoscaler/record-utilization-data-age branch September 15, 2026 17:39
@balajinvda

Copy link
Copy Markdown
Contributor

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

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