Skip to content

Commit

Permalink
DEVPROD-8620 Update sentry config to send larger values (#229)
Browse files Browse the repository at this point in the history
  • Loading branch information
khelif96 authored Jul 5, 2024
1 parent b3f3f93 commit b7ebed3
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 11 deletions.
1 change: 1 addition & 0 deletions apps/parsley/src/components/ErrorHandling/Sentry.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ const initializeSentry = () => {
debug: !isProduction(),
dsn: getSentryDSN(),
environment: getReleaseStage() || "development",
maxValueLength: 500,
normalizeDepth: 5,
sampleRate: 0.5,
});
Expand Down
3 changes: 3 additions & 0 deletions apps/parsley/src/components/ErrorHandling/initialize.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ describe("should initialize error handlers according to release stage", () => {
debug: false,
dsn: "fake-sentry-key",
environment: "production",
maxValueLength: 500,
normalizeDepth: 5,
sampleRate: 0.5,
});
Expand All @@ -57,6 +58,7 @@ describe("should initialize error handlers according to release stage", () => {
debug: true,
dsn: "fake-sentry-key",
environment: "beta",
maxValueLength: 500,
normalizeDepth: 5,
sampleRate: 0.5,
});
Expand All @@ -74,6 +76,7 @@ describe("should initialize error handlers according to release stage", () => {
debug: true,
dsn: "fake-sentry-key",
environment: "staging",
maxValueLength: 500,
normalizeDepth: 5,
sampleRate: 0.5,
});
Expand Down
11 changes: 6 additions & 5 deletions apps/spruce/src/components/ErrorHandling/Sentry.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ import { processHtmlAttributes } from "./utils";
const initializeSentry = () => {
try {
init({
// Don't send errors from unauthenticated users
beforeSend: (event) => (event.user?.id ? event : null),
sampleRate: 0.5,
beforeBreadcrumb: (breadcrumb, hint) => {
if (breadcrumb?.category?.startsWith("ui")) {
const { target } = hint?.event ?? {};
Expand All @@ -34,10 +31,14 @@ const initializeSentry = () => {
}
return breadcrumb;
},
dsn: getSentryDSN(),
// Don't send errors from unauthenticated users
beforeSend: (event) => (event.user?.id ? event : null),
debug: !isProduction(),
normalizeDepth: 5,
dsn: getSentryDSN(),
environment: getReleaseStage() || "development",
maxValueLength: 500,
normalizeDepth: 5,
sampleRate: 0.5,
});
} catch (e) {
console.error("Failed to initialize Sentry", e);
Expand Down
15 changes: 9 additions & 6 deletions apps/spruce/src/components/ErrorHandling/initialize.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,11 @@ describe("should initialize error handlers according to release stage", () => {
expect(vi.mocked(init)).toHaveBeenCalledWith({
beforeBreadcrumb: expect.any(Function),
beforeSend: expect.any(Function),
dsn: "fake-sentry-key",
debug: false,
normalizeDepth: 5,
dsn: "fake-sentry-key",
environment: "production",
maxValueLength: 500,
normalizeDepth: 5,
sampleRate: 0.5,
});
});
Expand All @@ -59,10 +60,11 @@ describe("should initialize error handlers according to release stage", () => {
expect(vi.mocked(init)).toHaveBeenCalledWith({
beforeBreadcrumb: expect.any(Function),
beforeSend: expect.any(Function),
dsn: "fake-sentry-key",
debug: true,
normalizeDepth: 5,
dsn: "fake-sentry-key",
environment: "beta",
maxValueLength: 500,
normalizeDepth: 5,
sampleRate: 0.5,
});
});
Expand All @@ -77,10 +79,11 @@ describe("should initialize error handlers according to release stage", () => {
expect(vi.mocked(init)).toHaveBeenCalledWith({
beforeBreadcrumb: expect.any(Function),
beforeSend: expect.any(Function),
dsn: "fake-sentry-key",
debug: true,
normalizeDepth: 5,
dsn: "fake-sentry-key",
environment: "staging",
maxValueLength: 500,
normalizeDepth: 5,
sampleRate: 0.5,
});
});
Expand Down

0 comments on commit b7ebed3

Please sign in to comment.