Skip to content

Commit f11a15f

Browse files
cdxkerskeptrunedev
authored andcommittedAug 26, 2024·
feature: add analytics to sentry
1 parent 5323ecd commit f11a15f

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed
 

‎.env.analytics

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# .env.analytics
22
VITE_API_HOST=http://localhost:8090/api
33
VITE_SEARCH_UI_URL="http://localhost:5174"
4-
VITE_DASHBOARD_URL="http://localhost:5173"
4+
VITE_DASHBOARD_URL="http://localhost:5173"
5+
VITE_SENTRY_ANALYTICS_DSN=""

‎frontends/analytics/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
},
1414
"dependencies": {
1515
"@nozbe/microfuzz": "^1.0.0",
16+
"@sentry/browser": "^7.110.0",
1617
"@solidjs/router": "^0.13.6",
1718
"@tanstack/solid-query": "^5.48.0",
1819
"@tanstack/solid-query-devtools": "^5.48.0",

‎frontends/analytics/src/index.tsx

+19
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import "./index.css";
66
import { RouteDefinition, Router } from "@solidjs/router";
77
import { SearchAnalyticsPage } from "./pages/SearchAnalyticsPage";
88
import { UserAuthContextProvider } from "./contexts/UserAuthContext";
9+
import * as Sentry from "@sentry/browser";
10+
import { DEV } from "solid-js";
911
import { QueryClient, QueryClientProvider } from "@tanstack/solid-query";
1012
import { TrendExplorer } from "./pages/TrendExplorer";
1113
import { Chart, registerables } from "chart.js";
@@ -19,6 +21,23 @@ import { SingleQueryPage } from "./pages/SingleQueryPage";
1921

2022
const queryClient = new QueryClient();
2123

24+
if (!DEV) {
25+
Sentry.init({
26+
dsn: `${import.meta.env.VITE_SENTRY_ANALYTICS_DSN as string}`,
27+
integrations: [
28+
Sentry.browserTracingIntegration(),
29+
Sentry.replayIntegration(),
30+
],
31+
32+
tracesSampleRate: 1.0,
33+
34+
tracePropagationTargets: ["localhost", /^https:\/\/trieve\.ai\/api/],
35+
36+
replaysSessionSampleRate: 0.1,
37+
replaysOnErrorSampleRate: 1.0,
38+
});
39+
}
40+
2241
Chart.register(...registerables);
2342

2443
const routes: RouteDefinition[] = [

0 commit comments

Comments
 (0)
Please sign in to comment.