Skip to main content

Mountain/Binary/Build/PostHogPlugin/
CaptureHandler.rs

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