DevelopmentNodeEnvironment_MicrosoftVSCodeDependency_22NodeVersion_Bundle_Clean_Debug_ElectronProfile_EsbuildCompiler_Mountain/Binary/Build/PostHogPlugin/CaptureHandler.rs
1//! Capture a `land:mountain:handler:complete` event for one IPC handler
2//! invocation. `Feature` is the Mountain-side route key (e.g.
3//! `file:read`, `extensions:getInstalled`); `DurationMs` measures the
4//! handler body only (Tauri-frame overhead excluded); `Ok` reports
5//! whether the handler returned `Ok(_)`.
6//!
7//! The Feature Parity dashboard pivots `Feature` to compare Mountain
8//! (Rust) vs Cocoon (Node) handler latency for migrated routes.
9
10use crate::Binary::Build::PostHogPlugin::{CaptureAllowed, CaptureEvent};
11
12pub fn Fn(Feature:&str, DurationMs:u64, Successful:bool) {
13 if !CaptureAllowed::Fn() {
14 return;
15 }
16
17 let DurationString = format!("{}", DurationMs);
18
19 let OkString = if Successful { "true" } else { "false" };
20
21 CaptureEvent::Fn(
22 "land:mountain:handler:complete",
23 Some(vec![("feature", Feature), ("duration_ms", &DurationString), ("ok", OkString)]),
24 );
25}