pub struct ResourceUsage {
pub principal: PrincipalId,
pub cpu_fuel_consumed_total: u64,
pub cpu_fuel_per_sec_limit: u64,
pub exempt: bool,
pub memory_bytes_limit_per_instance: u64,
pub memory_bytes_current_total: Option<u64>,
pub memory_bytes_peak_total: Option<u64>,
}Expand description
Per-principal resource usage vs configured budget — the payload of
AdminRequestKind::UsageGet, rendered by astrid quota/astrid top and
GET /api/sys/principals/{id}/usage so per-principal usage is measurable.
CPU is the live cross-capsule aggregate: the kernel’s shared fuel ledger
sums every interceptor’s exact wasmtime-fuel cost per invoking principal
across all capsules. Memory is reported as a per-principal peak
(memory_bytes_peak_total): the kernel’s shared memory ledger records the
high-water linear-memory size each invoking principal grows a Store to,
max’d across all capsules. A live cross-capsule current total
(memory_bytes_current_total) is not implemented — under pooled, shared
Stores it is not cleanly attributable — so it stays None; the limit field
reports the per-instance ceiling.
Fields§
§principal: PrincipalIdPrincipal this usage report describes.
cpu_fuel_consumed_total: u64Cumulative interceptor CPU burned across ALL capsules, in wasmtime fuel units (exact deterministic instruction count, monotonic for the process lifetime).
cpu_fuel_per_sec_limit: u64Configured CPU rate ceiling (Quotas::max_cpu_fuel_per_sec), always
> 0 (validation rejects 0 — there is no “unlimited” sentinel;
unbounded CPU is a capability, surfaced by exempt).
exempt: boolWhether the principal is exempt from resource budgets — it holds
system:resources:unbounded, net_bind, or uplink (admins via *).
When true the limit fields are advisory, never enforced.
memory_bytes_limit_per_instance: u64Per-capsule-instance memory ceiling (Quotas::max_memory_bytes). This
is a per-Store cap, not a cross-capsule total.
memory_bytes_current_total: Option<u64>Current cross-capsule resident memory total, or None — a live
“current” total is not cleanly attributable under pooled, shared Stores,
so the peak (below) is the reported memory signal instead.
memory_bytes_peak_total: Option<u64>Peak cross-capsule linear-memory high-water mark this principal has
driven, in bytes, max’d across every capsule it invokes (from the shared
memory ledger). None while no peak has been recorded — including
single-tenant deployments before any guest grows memory. The principal
that grows a Store owns the peak; one reusing an already-grown Store
without growing is not charged.
Trait Implementations§
Source§impl Clone for ResourceUsage
impl Clone for ResourceUsage
Source§fn clone(&self) -> ResourceUsage
fn clone(&self) -> ResourceUsage
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more