use metrics::{counter, gauge, histogram};
pub(crate) fn invocation(module: &str, outcome: &'static str) {
counter!(
"faucet_wasm_invocations_total",
"module" => module.to_string(),
"outcome" => outcome,
)
.increment(1);
}
pub(crate) fn invocation_duration(module: &str, secs: f64) {
histogram!(
"faucet_wasm_invocation_duration_seconds",
"module" => module.to_string(),
)
.record(secs);
}
pub(crate) fn fuel_consumed(module: &str, fuel: u64) {
counter!(
"faucet_wasm_fuel_consumed_total",
"module" => module.to_string(),
)
.increment(fuel);
}
pub(crate) fn memory_bytes(module: &str, bytes: u64) {
gauge!(
"faucet_wasm_memory_bytes",
"module" => module.to_string(),
)
.set(bytes as f64);
}
pub(crate) fn compile_duration(module: &str, secs: f64) {
histogram!(
"faucet_wasm_compile_duration_seconds",
"module" => module.to_string(),
)
.record(secs);
}