Skip to content

metrics: add requested vCPU and memory distributions - #1505

Merged
gilalon-pplx merged 4 commits into
mainfrom
gil/requested-size-1-metric
Nov 5, 2026
Merged

gilalon-pplx merged 4 commits into
mainfrom
gil/requested-size-1-metric

Conversation

@gilalon-pplx

@gilalon-pplx gilalon-pplx commented Nov 5, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Add sandbox.api.requested.vcpu and sandbox.api.requested.memory_bytes distributions for effective requested sandbox sizes after template and warm-pool defaults. This adds the emitter and tag vocabulary only; no production recording call sites are added.

Both distributions carry kind, surface, admission, template, and the request-scoped client_id, with an optional defaulted tag for creates. Reuse AdmissionDecision for accepted/rejected labels, and convert memory from MiB to bytes using a u64 intermediate.

Validation

For the review fixes: git diff --cached --check and uv tool run pre-commit run passed, including the repository's gitleaks check. Verified the published file matches the locally reviewed patch and the telemetry test module and file are removed. Rust tests were not rerun for these documentation/test-removal changes; this sandbox has no Rust toolchain. Runtime emission and backend ingestion have not been validated.

Severity and risk

Severity does not apply: this is additive observability infrastructure, not a bug fix. Risk is low because no production call sites emit these metrics yet; review should focus on metric names, tag vocabulary, and unit conversion.

Rollback: revert this PR.

Stack

Requested-size metrics stack; merge from bottom to top:

  1. This PR: metric definitions and emitter, based on main.
  2. Admission constructor, based on gil/requested-size-1-metric.

This PR does not wire the metrics into create or lifecycle requests.

AI assistance: Perplexity Computer drafted this description and applied the review fixes (resume documentation and removal of telemetry assertions).

@cla-assistant

cla-assistant Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@coderabbitai

coderabbitai Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The sandbox API now exports RequestedKind, RequestedSize, and requested. The function emits vCPU and memory distributions with request tags, converts memory from MiB to bytes, and includes the defaulted tag when provided.

Possibly related PRs

  • perplexityai/SPACE#1510: Adds call sites that construct RequestedSize values and use the metrics API introduced here.
Merge Risk: Minimal · up to 820d1

This PR adds the requested-size metric API without changing production recording behavior. It is mergeable after normal checks.

Security architecture risk: Minimal · up to 18be6

The change adds an unused telemetry-recording API without changing request handling, access controls, or sandbox lifecycle behavior. No material security risk introduced by this PR was identified.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The new exposure is a library API available to dependent Rust code, not a newly registered network endpoint. With only a definition and re-export added, this PR introduces no production path carrying attacker-controlled input into the two new distributions.

Trust Boundaries and Controls

  • observed — RequestedSize has no client identity override. The emitter reads the existing task-local ClientIdTag vocabulary, which represents an allowlisted identifier, overflow, or unknown; calls outside the request scope return unknown. AdmissionDecision is only serialized as accepted or rejected and grants no admission authority.
Pre-merge checks: Passed 5

Check name Status Explanation
Title check Passed The title "metrics: add requested vCPU and memory distributions" starts with a lowercase area and colon, followed by a lowercase summary verb. It names the main change: new requested vCPU and memory d…
Description Follows The Pr Template Passed The PR description includes all required sections with real content: ## Summary states what the change adds, ## Validation names checks and results, ## Severity and risk states that severity doe…
Bug Fixes Name A Regression Test Passed PASS: This pull request adds requested-size metrics definitions and re-exports under crates/metrics. The diff adds no application behavior fix or production recording call site, so the regression-te…
Weakened Safeguards Are Justified Passed PASS. The reviewed diff changes only crates/libs/metrics/src/sandbox/api.rs and adds crates/libs/metrics/src/sandbox/api/requested.rs. It removes no tests, assertions, lints, CI checks, or reposit…
Public-Safe Content Passed No public-safety violation is present. The reviewed diff adds only Rust metric API and documentation; it contains no credentials, tokens, private keys, internal URLs or hostnames, cloud IDs/ARNs, work…
Full details: Title check

Explanation

The title "metrics: add requested vCPU and memory distributions" starts with a lowercase area and colon, followed by a lowercase summary verb. It names the main change: new requested vCPU and memory distributions in the metrics crate. The title matches the stated objectives of PR #1505, which adds emitters and tag vocabulary for sandbox.api.requested.vcpu and sandbox.api.requested.memory_bytes. It has no trailing period and no ticket ID.

Full details: Description Follows The Pr Template

Explanation

The PR description includes all required sections with real content: ## Summary states what the change adds, ## Validation names checks and results, ## Severity and risk states that severity does not apply and describes low risk, and AI assistance: identifies the tool and the parts it drafted or changed.

Full details: Bug Fixes Name A Regression Test

Explanation

PASS: This pull request adds requested-size metrics definitions and re-exports under crates/metrics. The diff adds no application behavior fix or production recording call site, so the regression-test requirement does not apply.

Full details: Weakened Safeguards Are Justified

Explanation

PASS. The reviewed diff changes only crates/libs/metrics/src/sandbox/api.rs and adds crates/libs/metrics/src/sandbox/api/requested.rs. It removes no tests, assertions, lints, CI checks, or repository guards, and adds no allowlist or skip configuration.

Full details: Public-Safe Content

Explanation

No public-safety violation is present. The reviewed diff adds only Rust metric API and documentation; it contains no credentials, tokens, private keys, internal URLs or hostnames, cloud IDs/ARNs, workstation paths, logs, measurements, or undisclosed vulnerability details. The title and description contain only a public GitHub pull-request link and technical change details.

Tip

🎯 Customize your risk assessments

Guide how CodeRabbit assesses merge risk and security architecture risk. Highlight sensitive changes and explain your security boundaries using Merge Risk Instructions and Security Risk Instructions in your review settings. Security architecture risk assessments require the Advanced plan or above.

✅ Automatic approvals, with your rules

Let CodeRabbit approve pull requests once required threads are resolved, pre-merge checks pass, and your risk limits are met. Enable Automatic approvals in review settings, with overrides for teams or file paths.

Recent review info

Automatic approval policy

Commit: 820d184539b6.

Setting Effective value Source
Automatic approvals Enabled Global configuration
Merge risk Low Override 2
Security risk Not set Global configuration

Matching overrides (numbered as in the resolved configuration):

  • Override 2 — any author; paths: **, !ui/**; merge risk: Low.

Any matching disabled override withholds approval, regardless of risk. Otherwise, the strictest explicitly set limit wins for each score. Limits omitted by all matching overrides inherit the global configuration.

Not set means no limit was configured after inheritance. Use @coderabbitai configuration to inspect the resolved settings and their sources.

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 1c5a928 and 820d184.

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 10 remain after this review.

coderabbitai[bot]
coderabbitai Bot previously approved these changes Nov 5, 2026
@gilalon-pplx
gilalon-pplx force-pushed the gil/requested-size-1-metric branch from 18be6d8 to 1c5a928 Compare November 5, 2026 17:37
@github-actions
github-actions Bot dismissed coderabbitai[bot]’s stale review November 5, 2026 17:37

The pull request changed after this approval. CodeRabbit approves again after it reviews the current head.

@gilalon-pplx
gilalon-pplx enabled stacked auto-merge November 5, 2026 17:39
stacked auto-merge was automatically disabled November 5, 2026 17:41

Replaced by a newer auto-merge request

@gilalon-pplx
gilalon-pplx enabled stacked auto-merge November 5, 2026 17:41
Add the sandbox.api.requested.vcpu and
sandbox.api.requested.memory_bytes distributions and their bounded tag
vocabulary: kind (create, activate, resume), surface, admission,
template, client_id and, on creates, defaulted. admission takes its
accepted and rejected values from the existing AdmissionDecision the
cluster admission limiter reports. memory_bytes is the guest memory in
MiB converted to bytes.

Nothing records them yet; later changes record creates, activations
and resumes. The module documentation defines each tag and value.
Clarify that paused runtime recovery can require admission and be rejected. Remove the telemetry test module declaration in accordance with the repository test policy; the test file is removed in the following commit.
Remove metric-value and tag assertion tests to comply with the repository test-economy policy. The test module declaration was removed in the preceding commit.
Keep the metric units, tags, recording boundaries and runtime-recovery caveat while removing redundant detail. Documentation only; emitter behavior is unchanged.
@gilalon-pplx
gilalon-pplx force-pushed the gil/requested-size-1-metric branch from 1c5a928 to 820d184 Compare November 5, 2026 18:04
@gilalon-pplx
gilalon-pplx added this pull request to the merge queue Nov 5, 2026
Merged via the queue into main with commit 6e4b39d Nov 5, 2026
26 checks passed
@gilalon-pplx
gilalon-pplx deleted the gil/requested-size-1-metric branch November 5, 2026 18:11
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