pub struct PrometheusStateCollector { /* private fields */ }Expand description
Pull-based Prometheus collector for solti_sv_tasks_by_phase{phase}.
Register once with a shared prometheus::Registry alongside the other solti
collectors. On each scrape, all phases from TaskPhase are emitted; empty
phases return 0 so dashboards can rely on a stable label set.
§Cost
O(N) per scrape where N is the current number of tasks in state.
With a typical scrape interval of 10–30s and a fleet of <10k tasks this is
negligible. If it ever becomes hot, the natural next step is to maintain
phase counters inside TaskState directly.
§Example
use std::sync::Arc;
use solti_prometheus::{PrometheusStateCollector, Registry};
let registry = Arc::new(Registry::new());
let collector = PrometheusStateCollector::new(supervisor_api.state())?;
registry.register(Box::new(collector))?;Implementations§
Trait Implementations§
Source§impl Collector for PrometheusStateCollector
impl Collector for PrometheusStateCollector
Auto Trait Implementations§
impl Freeze for PrometheusStateCollector
impl !RefUnwindSafe for PrometheusStateCollector
impl Send for PrometheusStateCollector
impl Sync for PrometheusStateCollector
impl Unpin for PrometheusStateCollector
impl UnsafeUnpin for PrometheusStateCollector
impl !UnwindSafe for PrometheusStateCollector
Blanket Implementations§
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
Mutably borrows from an owned value. Read more