pub struct ErrorBudget { /* private fields */ }Expand description
A concrete error budget: the allowable failures for a known event volume over an SLO period.
Create one with crate::Slo::error_budget.
Implementations§
Source§impl ErrorBudget
impl ErrorBudget
Sourcepub fn new(total_events: f64, budget_ratio: f64) -> Self
pub fn new(total_events: f64, budget_ratio: f64) -> Self
Build a budget directly from a total event count and the budget ratio
(1 - objective).
Sourcepub fn total_events(&self) -> f64
pub fn total_events(&self) -> f64
Total events observed (or projected) over the period.
Sourcepub fn budget_ratio(&self) -> f64
pub fn budget_ratio(&self) -> f64
The budget ratio, i.e. 1 - objective.
Sourcepub fn allowed_bad_events(&self) -> f64
pub fn allowed_bad_events(&self) -> f64
The number of events that may fail before the budget is exhausted.
Sourcepub fn remaining_events(&self, observed_bad: f64) -> f64
pub fn remaining_events(&self, observed_bad: f64) -> f64
Events of budget remaining after observed_bad failures. May be
negative when the budget is overspent.
Sourcepub fn consumed_ratio(&self, observed_bad: f64) -> f64
pub fn consumed_ratio(&self, observed_bad: f64) -> f64
Fraction of the budget already consumed by observed_bad failures
(0.0 = untouched, 1.0 = exactly exhausted, > 1.0 = overspent).
Sourcepub fn remaining_ratio(&self, observed_bad: f64) -> f64
pub fn remaining_ratio(&self, observed_bad: f64) -> f64
Fraction of the budget still available (1.0 = untouched, 0.0 =
exhausted). Clamped at zero on the low end.
Trait Implementations§
Source§impl Clone for ErrorBudget
impl Clone for ErrorBudget
Source§fn clone(&self) -> ErrorBudget
fn clone(&self) -> ErrorBudget
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for ErrorBudget
Source§impl Debug for ErrorBudget
impl Debug for ErrorBudget
Source§impl PartialEq for ErrorBudget
impl PartialEq for ErrorBudget
Source§fn eq(&self, other: &ErrorBudget) -> bool
fn eq(&self, other: &ErrorBudget) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for ErrorBudget
Auto Trait Implementations§
impl Freeze for ErrorBudget
impl RefUnwindSafe for ErrorBudget
impl Send for ErrorBudget
impl Sync for ErrorBudget
impl Unpin for ErrorBudget
impl UnsafeUnpin for ErrorBudget
impl UnwindSafe for ErrorBudget
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