CI / Rust Checks (push) Successful in 6m9s
CI / UI Checks (push) Successful in 5s
CI / Community Image Smoke (push) Successful in 1m3s
CI / Frontend E2E (push) Successful in 3m47s
CI / Deploy (push) Failing after 3s
CI / Rust Checks (pull_request) Successful in 6m15s
CI / UI Checks (pull_request) Successful in 5s
CI / Frontend E2E (pull_request) Successful in 5m17s
CI / Community Image Smoke (pull_request) Successful in 4m25s
CI / Deploy (pull_request) Skipped
35 lines
1.1 KiB
Rust
35 lines
1.1 KiB
Rust
use std::sync::atomic::{AtomicU64, Ordering};
|
|
|
|
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
|
pub enum OperationalIncident {
|
|
InvocationHistoryLost,
|
|
}
|
|
|
|
static INVOCATION_HISTORY_LOST_TOTAL: AtomicU64 = AtomicU64::new(0);
|
|
|
|
pub fn record_operational_incident(incident: OperationalIncident) {
|
|
let counter = counter(incident);
|
|
let _ = counter.fetch_update(Ordering::Relaxed, Ordering::Relaxed, |value| {
|
|
value.checked_add(1)
|
|
});
|
|
match incident {
|
|
OperationalIncident::InvocationHistoryLost => {
|
|
crank_metrics::record_invocation_history_lost();
|
|
crank_metrics::record_export_failure(
|
|
crank_metrics::SignalType::InvocationHistory,
|
|
crank_metrics::Exporter::Postgres,
|
|
);
|
|
}
|
|
}
|
|
}
|
|
|
|
pub fn operational_incident_total(incident: OperationalIncident) -> u64 {
|
|
counter(incident).load(Ordering::Relaxed)
|
|
}
|
|
|
|
fn counter(incident: OperationalIncident) -> &'static AtomicU64 {
|
|
match incident {
|
|
OperationalIncident::InvocationHistoryLost => &INVOCATION_HISTORY_LOST_TOTAL,
|
|
}
|
|
}
|