pub struct RuntimeMetrics {Show 23 fields
pub registry: Registry,
pub vm_boot_duration: Histogram,
pub vm_boot_phase_duration: HistogramVec,
pub vm_count: IntGaugeVec,
pub vm_created_total: IntCounter,
pub vm_destroyed_total: IntCounter,
pub vm_cpu_percent: GaugeVec,
pub vm_memory_bytes: GaugeVec,
pub exec_total: IntCounter,
pub exec_duration: Histogram,
pub exec_errors_total: IntCounter,
pub image_pull_total: IntCounter,
pub image_pull_duration: Histogram,
pub image_build_total: IntCounter,
pub rootfs_cache_hits: IntCounter,
pub rootfs_cache_misses: IntCounter,
pub warm_pool_size: IntGauge,
pub warm_pool_capacity: IntGauge,
pub warm_pool_hits: IntCounter,
pub warm_pool_misses: IntCounter,
pub warm_pool_boots_inflight: IntGauge,
pub warm_pool_boot_failures_total: IntCounter,
pub warm_pool_initial_fill_duration: Histogram,
}Expand description
Pre-registered Prometheus metrics for the Box runtime.
Fields§
§registry: RegistryPrometheus registry holding all metrics.
vm_boot_duration: HistogramVM boot duration in seconds.
vm_boot_phase_duration: HistogramVecVM boot duration split by a stable lifecycle phase.
The phase label is intentionally bounded to runtime-owned values such
as layout, prepare, launch, and readiness; callers must not use
box IDs, image references, or other unbounded values as labels.
vm_count: IntGaugeVecNumber of VMs by state (created, ready, busy, compacting, stopped).
vm_created_total: IntCounterTotal VMs created since process start.
vm_destroyed_total: IntCounterTotal VMs destroyed since process start.
vm_cpu_percent: GaugeVecVM CPU usage percentage (per VM, labeled by box_id).
vm_memory_bytes: GaugeVecVM memory usage in bytes (per VM, labeled by box_id).
exec_total: IntCounterTotal exec commands executed.
exec_duration: HistogramExec command duration in seconds.
exec_errors_total: IntCounterExec commands that failed (non-zero exit or error).
image_pull_total: IntCounterTotal image pulls.
image_pull_duration: HistogramImage pull duration in seconds.
image_build_total: IntCounterTotal image builds.
rootfs_cache_hits: IntCounterRootfs cache hits.
rootfs_cache_misses: IntCounterRootfs cache misses.
warm_pool_size: IntGaugeCurrent warm pool size (idle VMs).
warm_pool_capacity: IntGaugeWarm pool capacity (max_size).
warm_pool_hits: IntCounterTotal VMs allocated from warm pool.
warm_pool_misses: IntCounterTotal VMs created fresh (warm pool miss).
warm_pool_boots_inflight: IntGaugeNumber of VM boots currently in flight across warm pools.
warm_pool_boot_failures_total: IntCounterTotal warm-pool VM boot failures, including failed replenishment attempts.
warm_pool_initial_fill_duration: HistogramTime spent on the initial warm-pool fill before the pool is published.
For lazy pools this is the time until the first ready VM (the remaining idle target is filled asynchronously); eager pools report the complete configured initial fill.
Implementations§
Source§impl RuntimeMetrics
impl RuntimeMetrics
Sourcepub fn try_new() -> Result<Self, PrometheusError>
pub fn try_new() -> Result<Self, PrometheusError>
Try to create and register all metrics with a new registry.
Sourcepub fn with_registry(registry: Registry) -> Self
pub fn with_registry(registry: Registry) -> Self
Create and register all metrics with an existing registry.
Sourcepub fn try_with_registry(registry: Registry) -> Result<Self, PrometheusError>
pub fn try_with_registry(registry: Registry) -> Result<Self, PrometheusError>
Try to create and register all metrics with an existing registry.
Sourcepub fn record_vm_boot_phase(&self, phase: &str, duration_secs: f64)
pub fn record_vm_boot_phase(&self, phase: &str, duration_secs: f64)
Record one bounded VM boot phase in seconds.
Sourcepub fn remove_vm_resource_metrics(&self, box_id: &str)
pub fn remove_vm_resource_metrics(&self, box_id: &str)
Remove resource gauges for a VM that no longer exists.
The gauges are labelled by box ID for point-in-time inspection. Keeping every historical ID in a long-lived daemon would make the registry grow without bound, so lifecycle teardown must delete both label sets.
Trait Implementations§
Source§impl Clone for RuntimeMetrics
impl Clone for RuntimeMetrics
Source§fn clone(&self) -> RuntimeMetrics
fn clone(&self) -> RuntimeMetrics
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RuntimeMetrics
impl Debug for RuntimeMetrics
Source§impl Default for RuntimeMetrics
impl Default for RuntimeMetrics
Source§impl MetricsCollector for RuntimeMetrics
impl MetricsCollector for RuntimeMetrics
Source§fn record_vm_boot(&self, duration_secs: f64)
fn record_vm_boot(&self, duration_secs: f64)
Source§fn inc_vm_state(&self, state: &str)
fn inc_vm_state(&self, state: &str)
Source§fn dec_vm_state(&self, state: &str)
fn dec_vm_state(&self, state: &str)
Source§fn inc_vm_created(&self)
fn inc_vm_created(&self)
Source§fn inc_vm_destroyed(&self)
fn inc_vm_destroyed(&self)
Source§fn record_exec(&self, duration_secs: f64, success: bool)
fn record_exec(&self, duration_secs: f64, success: bool)
Source§fn inc_cache_hit(&self)
fn inc_cache_hit(&self)
Source§fn inc_cache_miss(&self)
fn inc_cache_miss(&self)
Auto Trait Implementations§
impl !RefUnwindSafe for RuntimeMetrics
impl !UnwindSafe for RuntimeMetrics
impl Freeze for RuntimeMetrics
impl Send for RuntimeMetrics
impl Sync for RuntimeMetrics
impl Unpin for RuntimeMetrics
impl UnsafeUnpin for RuntimeMetrics
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more