pub enum Sli {
Events {
error_query: String,
total_query: String,
},
Raw {
error_ratio_query: String,
},
Latency {
histogram_metric: String,
threshold: String,
selector: Option<String>,
},
}Expand description
How an SLO’s error ratio is computed from Prometheus.
Covers sloth’s two SLI shapes (events-based and raw) plus a slokit
extension, Sli::Latency, that generates the histogram bucket query for
the common “fraction of requests slower than a threshold” SLO.
Variants§
Events
Bad events divided by total events. Both queries should contain the
WINDOW_TOKEN.
Fields
Raw
A query that already yields an error ratio in [0, 1]. Should contain
the WINDOW_TOKEN.
Latency
A latency SLI built from a Prometheus histogram: the fraction of requests
that took longer than threshold (the le bucket boundary). The error
ratio query is generated, so it needs no WINDOW_TOKEN.
Implementations§
Source§impl Sli
impl Sli
Sourcepub fn error_ratio_expr(&self, window: Window) -> String
pub fn error_ratio_expr(&self, window: Window) -> String
Render the SLI’s error-ratio PromQL expression for a given window,
substituting WINDOW_TOKEN with the Prometheus duration.
For Sli::Events this is (error) / (total); for Sli::Raw it is
the raw query as written.
Sourcepub fn queries(&self) -> Vec<&str>
pub fn queries(&self) -> Vec<&str>
Every user-supplied query string this SLI carries, for validation. A
Sli::Latency carries none (its query is generated).
Trait Implementations§
impl Eq for Sli
impl StructuralPartialEq for Sli
Auto Trait Implementations§
impl Freeze for Sli
impl RefUnwindSafe for Sli
impl Send for Sli
impl Sync for Sli
impl Unpin for Sli
impl UnsafeUnpin for Sli
impl UnwindSafe for Sli
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.