Skip to content

Commit

Permalink
Add button to test Sentry
Browse files Browse the repository at this point in the history
  • Loading branch information
rakyi committed Jan 14, 2025
1 parent d67fc63 commit fe458c8
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
8 changes: 8 additions & 0 deletions site/gdocs/pages/AboutPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ import Footnotes from "../components/Footnotes.js"
export default function AboutPage({ content, slug }: OwidGdocAboutInterface) {
return (
<main className="about-page centered-article-container grid grid-cols-12-full-width">
<button
className=""
onClick={() => {
throw new Error("Test Sentry error from site")
}}
>
Break the world
</button>
<h1 className="about-header col-start-2 col-end-limit display-2-semibold">
About
</h1>
Expand Down
15 changes: 10 additions & 5 deletions site/instrument.ts
Original file line number Diff line number Diff line change
@@ -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()) {
Expand All @@ -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 {
Expand All @@ -27,9 +27,14 @@ if (analyticsConsent && !isInIFrame()) {
replaysOnErrorSampleRate: 0,
}
}
console.log("SENTRY_DSN", SENTRY_DSN)

Check warning on line 30 in site/instrument.ts

View workflow job for this annotation

GitHub Actions / eslint

Unexpected console statement

Check warning on line 30 in site/instrument.ts

View workflow job for this annotation

GitHub Actions / eslint

Unexpected console statement
console.log("ENV", ENV)

Check warning on line 31 in site/instrument.ts

View workflow job for this annotation

GitHub Actions / eslint

Unexpected console statement

Check warning on line 31 in site/instrument.ts

View workflow job for this annotation

GitHub Actions / eslint

Unexpected console statement
console.log("COMMIT_SHA", COMMIT_SHA)

Check warning on line 32 in site/instrument.ts

View workflow job for this annotation

GitHub Actions / eslint

Unexpected console statement

Check warning on line 32 in site/instrument.ts

View workflow job for this annotation

GitHub Actions / eslint

Unexpected console statement
console.log("sentryOpts", sentryOpts)

Check warning on line 33 in site/instrument.ts

View workflow job for this annotation

GitHub Actions / eslint

Unexpected console statement

Check warning on line 33 in site/instrument.ts

View workflow job for this annotation

GitHub Actions / eslint

Unexpected console statement
Sentry.init({
dsn: process.env.SENTRY_DSN,
environment,
release: process.env.COMMIT_SHA,
debug: true,
dsn: SENTRY_DSN,
environment: ENV,
release: COMMIT_SHA,
...sentryOpts,
})

0 comments on commit fe458c8

Please sign in to comment.