CommonLibrary/Telemetry/
Initialize.rs1#![allow(non_snake_case)]
2
3use crate::Telemetry::{CaptureSession, Client, IsAllowed, Tier};
19
20pub async fn Fn(Tier:Tier::Tier) {
21 let _ = Client::TIER.set(Tier);
22
23 if !IsAllowed::PostHog() {
24 return;
25 }
26
27 let Configuration = IsAllowed::Cached();
28 let Options = match posthog_rs::ClientOptionsBuilder::default()
29 .api_key(Configuration.Key.clone())
30 .host(Configuration.Host.clone())
31 .build()
32 {
33 Ok(O) => O,
34 Err(_) => return,
35 };
36
37 let PostHogClient = posthog_rs::client(Options).await;
38 let _ = Client::CLIENT.set(PostHogClient);
39
40 CaptureSession::Fn();
41}