Skip to main content

Mountain/Binary/Build/PostHogPlugin/
CaptureHandler.rs

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