Skip to main content

Mountain/Binary/Build/PostHogPlugin/
CaptureAllowed.rs

1#![allow(non_snake_case)]
2
3//! Capture gate. Combines the compile-time `debug_assertions` check with
4//! the master telemetry kill switch (`Capture`) and the per-pipe
5//! `Report` toggle, both baked at build time. Cheap early-exit consulted
6//! by every PostHog capture path.
7//!
8//! Pair: the OTLP pipe in `IPC::DevLog::EmitOTLPSpan` runs the same
9//! `Capture` master + its own `OTLPEnabled` toggle. The `Capture` knob
10//! is distinct from `.env.Land.Diagnostics`'s `Disable`, which kills
11//! polyfills/shims (not telemetry).
12
13use crate::Binary::Build::PostHogPlugin::Constants;
14
15pub fn Fn() -> bool {
16	if !cfg!(debug_assertions) {
17		return false;
18	}
19	if matches!(Constants::TELEMETRY_CAPTURE, "false" | "0" | "off") {
20		return false;
21	}
22	!matches!(Constants::POSTHOG_ENABLED, "false" | "0" | "off")
23}