Skip to content

api: record requested size for activations and resumes - #1511

Closed
gilalon-pplx wants to merge 17 commits into
mainfrom
gil/requested-size-4-activation
Closed

gilalon-pplx wants to merge 17 commits into
mainfrom
gil/requested-size-4-activation

Conversation

@gilalon-pplx

Copy link
Copy Markdown
Collaborator

Summary

Extend requested vCPU and memory recording to lifecycle activations and resumes, using the sandbox row’s effective size. Record successful actions and explicit admission rejections; exclude callers joining another activation, unrelated failures, and unresolved or invalid sizes ([incremental diff](gil/requested-size-3-create...gil/requested-size-4-activation)).

Document admission during resume recovery, eligible implicit wakes, and distribution counts representing eligible recorded calls rather than total incoming requests. Reuse the existing metric definitions and admission classification without adding telemetry-assertion tests ([incremental diff](gil/requested-size-3-create...gil/requested-size-4-activation)).

Validation

  • cargo test -p pplx-space-metrics -p pplx-space-api --all-features: passed locally.
  • cargo fmt --all -- --check: passed locally.
  • pre-commit run --all-files: passed.
  • git diff --check: passed.
  • Verified the published tree matches the reviewed Cloud commit and includes the updated PR3 as an ancestor.

Runtime metric ingestion has not been validated.

Severity and risk

Severity does not apply: this adds observability rather than fixing application behavior. The main risk is incorrect sample counting or classification; admission decisions and lifecycle behavior are intended to remain unchanged.

Rollback: revert this PR’s lifecycle recording changes. The parent metric definitions, admission classification, and create recording can remain.

Stack

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

  1. [#1505: Metric definitions and emitter](metrics: add requested vCPU and memory distributions #1505).
  2. [#1506: Shared admission-error constructor](api: centralize cluster admission rejection construction #1506).
  3. [#1510: Create recording and admission classification](api: record requested vCPU and memory for creates #1510).
  4. This PR: activation and resume recording, based on gil/requested-size-3-create.

AI assistance: Perplexity Computer reviewed and updated the implementation, restacked the branch, and drafted this description.

@gilalon-pplx
gilalon-pplx added this pull request to stack #1507 November 5, 2026 16:45
@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

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

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.
A cluster activation admission refusal reaches ControllerError two
ways: from the request-entry admission check, and from
SubstrateError::AdmissionRejected when the substrate charges a restore
claim later. Each built the 429 by hand. Both now use
ControllerError::cluster_admission_rejected, so a later change can mark
every admission refusal in one place.

Behavior is unchanged. Only a rate-limited refusal carries the
ClusterActivationAdmission retry cause; an empty-cluster refusal still
omits it, so the async dispatcher keeps giving it a bounded retry. A
new test pins the status, retry header and cause for all four cases.
Record sandbox.api.requested.vcpu and sandbox.api.requested.memory_bytes
with kind:create for every cold and warm-pool create, using the size the
sandbox will run with after template and warm-pool defaults are
applied.

A cold create records at its cluster admission decision, so a create
the admission limiter refuses still reports the size it asked for, as
admission:rejected. A warm-pool claim records admission:accepted when
it is adopted. defaulted is false only when the request named both
vCPU and memory; warm-pool claims are always defaulted. A fork, whose
size comes from its source snapshot, and a create whose size the API
did not resolve record nothing.

To tell admission refusals from other 429s, ControllerError gains a
ClusterAdmissionRejection kind, set by the shared admission refusal
constructor. Retry causes are unchanged.
@gilalon-pplx
gilalon-pplx force-pushed the gil/requested-size-4-activation branch from 84ccb33 to c53084b Compare November 5, 2026 17:37
A cold create's resolved size reaches the requested-size distributions at
its admission decision, before the insert converts each value to the
sandbox row's i32 column. CreateSandboxRequest accepts any u32, so a
request for 2147483648 vCPUs with valid memory was recorded as an
accepted size even though stored_resource then refused it with a 400.

The recorder now passes the create's size through the same
stored_resource bound before emitting, so a size the create cannot
store enters neither distribution. Every size the recorder reads is
then the stored i32, so the positive-size check takes that type
directly.
Base automatically changed from gil/requested-size-3-create to main November 5, 2026 20:35
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