use better place to init faro
This commit is contained in:
-33
@@ -1,41 +1,8 @@
|
||||
import "@/App.css";
|
||||
|
||||
import {
|
||||
ConsoleInstrumentation,
|
||||
ConsoleTransport,
|
||||
FetchTransport,
|
||||
getWebInstrumentations,
|
||||
initializeFaro,
|
||||
ReactIntegration,
|
||||
WebVitalsInstrumentation,
|
||||
} from "@grafana/faro-react";
|
||||
import Dashboard from "@/components/Dashboard/Dashboard";
|
||||
|
||||
function App() {
|
||||
const isProduction = import.meta.env.PROD;
|
||||
|
||||
if (window.location.hostname === "localhost" && isProduction) {
|
||||
initializeFaro({
|
||||
app: {
|
||||
name: "monitor-im-flur",
|
||||
version: "0.0.1",
|
||||
environment: "test",
|
||||
},
|
||||
instrumentations: [
|
||||
...getWebInstrumentations(),
|
||||
new ConsoleInstrumentation(),
|
||||
new WebVitalsInstrumentation(),
|
||||
new ReactIntegration(),
|
||||
],
|
||||
transports: [
|
||||
new FetchTransport({
|
||||
url: "http://192.168.2.51:12347/collect",
|
||||
}),
|
||||
new ConsoleTransport(),
|
||||
],
|
||||
});
|
||||
}
|
||||
|
||||
return <Dashboard />;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,42 @@
|
||||
import {
|
||||
ConsoleInstrumentation,
|
||||
ConsoleTransport,
|
||||
FetchTransport,
|
||||
getWebInstrumentations,
|
||||
initializeFaro,
|
||||
ReactIntegration,
|
||||
WebVitalsInstrumentation,
|
||||
} from "@grafana/faro-react";
|
||||
import { StrictMode } from "react";
|
||||
import { createRoot } from "react-dom/client";
|
||||
|
||||
import "./index.css";
|
||||
import App from "./App.tsx";
|
||||
|
||||
const isProduction = import.meta.env.PROD;
|
||||
|
||||
if (window.location.hostname === "localhost" && isProduction) {
|
||||
initializeFaro({
|
||||
app: {
|
||||
name: "monitor-im-flur",
|
||||
version: "0.0.1",
|
||||
environment: "test",
|
||||
},
|
||||
instrumentations: [
|
||||
...getWebInstrumentations(),
|
||||
new ConsoleInstrumentation(),
|
||||
new WebVitalsInstrumentation(),
|
||||
new ReactIntegration(),
|
||||
],
|
||||
transports: [
|
||||
new FetchTransport({
|
||||
url: "http://192.168.2.51:12347/collect",
|
||||
}),
|
||||
new ConsoleTransport(),
|
||||
],
|
||||
});
|
||||
}
|
||||
|
||||
// biome-ignore lint/style/noNonNullAssertion: if the root element is not found, the app should not render
|
||||
createRoot(document.getElementById("root")!).render(
|
||||
<StrictMode>
|
||||
|
||||
Reference in New Issue
Block a user