Adds comprehensive client-side telemetry capabilities for usage, errors, and performance metrics. This includes integrating OpenTelemetry standards into both the frontend (Svelte) and backend (Tauri/Rust) layers to capture events, spans, and system resource utilization. The implementation ensures that all collected data is privacy-filtered by design, explicitly excluding sensitive information like repository paths, credentials, source code, or email addresses from being logged. - Updates README with detailed SigNoz telemetry guide - Adds process metrics collection (CPU/Memory) in Rust backend - Exposes `setTelemetryEnabled` state management to the frontend
16 lines
619 B
TypeScript
16 lines
619 B
TypeScript
import { invoke } from "@tauri-apps/api/core";
|
|
import { telemetryLog } from "./telemetry";
|
|
|
|
export type AnalyticsEventProperties = Record<string, string | number>;
|
|
|
|
export function trackAnalyticsEvent(name: string, props?: AnalyticsEventProperties) {
|
|
const details = props && Object.keys(props).length > 0 ? ` ${JSON.stringify(props)}` : "";
|
|
telemetryLog("info", `${name}${details}`, `product.${name}`);
|
|
void invoke("plugin:aptabase|track_event", {
|
|
name,
|
|
props: props && Object.keys(props).length > 0 ? props : undefined,
|
|
}).catch(() => {
|
|
// Analytics must never interrupt the Git workflow.
|
|
});
|
|
}
|