feat(web): add client-side telemetry with Web Vitals and dev metrics endpoint

This commit is contained in:
MythEclipse
2026-06-07 18:13:11 +07:00
parent eefb16ad1d
commit 5a47b0c658
8 changed files with 122 additions and 7 deletions
+9
View File
@@ -2,6 +2,15 @@ import React from "react";
import ReactDOM from "react-dom/client";
import { App } from "./app";
import "./index.css";
import { reportWebVitals } from "./lib/telemetry";
import { onCLS, onFCP, onINP, onLCP, onTTFB } from "web-vitals";
// Report Web Vitals to our in-memory telemetry store
onCLS((m) => reportWebVitals({ name: "CLS", value: m.value, rating: m.rating }));
onFCP((m) => reportWebVitals({ name: "FCP", value: m.value, rating: m.rating }));
onINP((m) => reportWebVitals({ name: "INP", value: m.value, rating: m.rating }));
onLCP((m) => reportWebVitals({ name: "LCP", value: m.value, rating: m.rating }));
onTTFB((m) => reportWebVitals({ name: "TTFB", value: m.value, rating: m.rating }));
ReactDOM.createRoot(document.getElementById("root")!).render(
<React.StrictMode>