Skip to content

Commit

Permalink
Implement review suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
rakyi committed Jan 17, 2025
1 parent 474df0b commit 1d28275
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 24 deletions.
11 changes: 8 additions & 3 deletions adminSiteClient/instrument.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import * as Sentry from "@sentry/react"
import {
COMMIT_SHA,
ENV,
SENTRY_ADMIN_DSN,
} from "../settings/clientSettings.js"

Sentry.init({
dsn: process.env.SENTRY_ADMIN_DSN,
environment: process.env.ENV,
release: process.env.COMMIT_SHA,
dsn: SENTRY_ADMIN_DSN,
environment: ENV,
release: COMMIT_SHA,
})
3 changes: 2 additions & 1 deletion adminSiteServer/app.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// This must be imported first for Sentry instrumentation to work.
// This should be imported as early as possible so the global error handler is
// set up before any errors are thrown.
import "../serverUtils/instrument.js"

import { GIT_CMS_DIR } from "../gitCms/GitCmsConstants.js"
Expand Down
4 changes: 2 additions & 2 deletions adminSiteServer/appClass.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@ export class OwidAdminApp {
app.use("/", mockSiteRouter)
}

// Add this after all routes,
// but before any and other error-handling middlewares are defined
// Add this after all routes, but before any other error-handling
// middlewares are defined.
Sentry.setupExpressErrorHandler(app)

// Give full error messages, including in production
Expand Down
10 changes: 2 additions & 8 deletions baker/SiteBaker.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// This must be imported first for Sentry instrumentation to work.
// This should be imported as early as possible so the global error handler is
// set up before any errors are thrown.
import "../serverUtils/instrument.js"

import fs from "fs-extra"
Expand Down Expand Up @@ -211,13 +212,6 @@ export class SiteBaker {
}
)
this.explorerAdminServer = new ExplorerAdminServer(GIT_CMS_DIR)
// if (BUGSNAG_NODE_API_KEY) {
// Bugsnag.start({
// apiKey: BUGSNAG_NODE_API_KEY,
// context: "site-baker",
// autoTrackSessions: false,
// })
// }
}

private async bakeEmbeds(knex: db.KnexReadonlyTransaction) {
Expand Down
3 changes: 2 additions & 1 deletion baker/algolia/indexChartsToAlgolia.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// This must be imported first for Sentry instrumentation to work.
// This should be imported as early as possible so the global error handler is
// set up before any errors are thrown.
import "../../serverUtils/instrument.js"

import * as db from "../../db/db.js"
Expand Down
3 changes: 2 additions & 1 deletion baker/algolia/indexExplorerViewsAndChartsToAlgolia.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// This must be imported first for Sentry instrumentation to work.
// This should be imported as early as possible so the global error handler is
// set up before any errors are thrown.
import "../../serverUtils/instrument.js"

import * as db from "../../db/db.js"
Expand Down
3 changes: 2 additions & 1 deletion baker/algolia/indexExplorerViewsToAlgolia.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// This must be imported first for Sentry instrumentation to work.
// This should be imported as early as possible so the global error handler is
// set up before any errors are thrown.
import "../../serverUtils/instrument.js"

import * as db from "../../db/db.js"
Expand Down
3 changes: 2 additions & 1 deletion baker/startDeployQueueServer.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// This must be imported first for Sentry instrumentation to work.
// This should be imported as early as possible so the global error handler is
// set up before any errors are thrown.
import "../serverUtils/instrument.js"

import fs from "fs-extra"
Expand Down
7 changes: 1 addition & 6 deletions site/instrument.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { getPreferenceValue, PreferenceType } from "./cookiePreferences.js"

const analyticsConsent = getPreferenceValue(PreferenceType.Analytics)

let sentryOpts: Sentry.BrowserOptions
let sentryOpts: Sentry.BrowserOptions = {}
if (analyticsConsent && !isInIFrame()) {
// only collect session replays from: users that have consented to analytics
// AND where page isn't embedded in an iframe
Expand All @@ -21,11 +21,6 @@ if (analyticsConsent && !isInIFrame()) {
replaysSessionSampleRate: ENV === "development" ? 1 : 0.1,
replaysOnErrorSampleRate: 0,
}
} else {
sentryOpts = {
replaysSessionSampleRate: 0,
replaysOnErrorSampleRate: 0,
}
}
Sentry.init({
dsn: SENTRY_DSN,
Expand Down

0 comments on commit 1d28275

Please sign in to comment.