drogue_client/metrics/
ext.rs1use super::{AsPassFailError, PassFailError};
2use prometheus::IntGaugeVec;
3
4pub trait PassFailErrorExt {
5 fn record_outcome(self, gauge: &IntGaugeVec) -> Self;
6}
7
8impl<T: AsPassFailError> PassFailErrorExt for T {
10 fn record_outcome(self, gauge: &IntGaugeVec) -> Self {
11 match self.as_pass_fail_error() {
12 PassFailError::Pass => gauge.with_label_values(&["pass"]).inc(),
13 PassFailError::Fail => gauge.with_label_values(&["fail"]).inc(),
14 PassFailError::Error => gauge.with_label_values(&["error"]).inc(),
15 }
16 self
17 }
18}