Skip to main content

time_transaction

Function time_transaction 

Source
pub fn time_transaction<T>(transaction_name: &str, f: impl FnOnce() -> T) -> T
Expand description

Runs f, records how long it took under transaction_name (see record_performance), and returns whatever f returned. Recorded even if f panics: the duration up to the panic is still a real duration, and a handler that panics is exactly one worth seeing on the Performance page.

let status = forge_ops_tracker::time_transaction("GET /users/:id", || handle_request());