From 0fe42006f9596cd6ad79f5dbcefbff6bf2f9314e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ra=C4=8D=C3=A1k?= Date: Tue, 14 Jan 2025 10:10:33 +0100 Subject: [PATCH] Add button to test Sentry --- site/gdocs/pages/AboutPage.tsx | 8 ++++++++ site/instrument.ts | 14 +++++++++----- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/site/gdocs/pages/AboutPage.tsx b/site/gdocs/pages/AboutPage.tsx index dbe4f18e8b..88e86081d7 100644 --- a/site/gdocs/pages/AboutPage.tsx +++ b/site/gdocs/pages/AboutPage.tsx @@ -10,6 +10,14 @@ import Footnotes from "../components/Footnotes.js" export default function AboutPage({ content, slug }: OwidGdocAboutInterface) { return (
+

About

diff --git a/site/instrument.ts b/site/instrument.ts index b8a7f57709..cb8a62c43a 100644 --- a/site/instrument.ts +++ b/site/instrument.ts @@ -1,9 +1,9 @@ import * as Sentry from "@sentry/react" import { isInIFrame } from "@ourworldindata/utils" +import { COMMIT_SHA, ENV, SENTRY_DSN } from "../settings/clientSettings.js" import { getPreferenceValue, PreferenceType } from "./cookiePreferences.js" const analyticsConsent = getPreferenceValue(PreferenceType.Analytics) -const environment = process.env.ENV || "development" let sentryOpts: Sentry.BrowserOptions if (analyticsConsent && !isInIFrame()) { @@ -18,7 +18,7 @@ if (analyticsConsent && !isInIFrame()) { mask: [".sentry-mask"], }), ], - replaysSessionSampleRate: environment === "development" ? 1 : 0.1, + replaysSessionSampleRate: ENV === "development" ? 1 : 0.1, replaysOnErrorSampleRate: 0, } } else { @@ -27,9 +27,13 @@ if (analyticsConsent && !isInIFrame()) { replaysOnErrorSampleRate: 0, } } +console.log("SENTRY_DSN", SENTRY_DSN) +console.log("ENV", ENV) +console.log("COMMIT_SHA", COMMIT_SHA) +console.log("sentryOpts", sentryOpts) Sentry.init({ - dsn: process.env.SENTRY_DSN, - environment, - release: process.env.COMMIT_SHA, + dsn: SENTRY_DSN, + environment: ENV, + release: COMMIT_SHA, ...sentryOpts, })