Skip to content

Commit

Permalink
clean up sentry configs (#712)
Browse files Browse the repository at this point in the history
  • Loading branch information
armandobelardo authored Apr 26, 2024
1 parent f3c04c9 commit 3f99f7d
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 91 deletions.
7 changes: 6 additions & 1 deletion packages/ui/app/src/analytics/sentry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@ interface FernUIErrorContext {
}

export function captureSentryError(e: unknown, context: FernUIErrorContext): void {
Sentry.captureException(e, context);
Sentry.captureException(e, {
captureContext: {
extra: { context: context.context, source: context.errorSource, description: context.errorDescription },
},
data: context.data,
});
}

export function captureSentryErrorMessage(message: string): void {
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/docs-bundle/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ module.exports = withSentryConfig(

// Suppresses source map uploading logs during build
silent: true,
org: "fern-api",
org: "buildwithfern",
project: "docs-frontend",
},
{
Expand Down
1 change: 1 addition & 0 deletions packages/ui/docs-bundle/sentry.client.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Sentry.init({
dsn: "https://216ad381a8f652e036b1833af58627e5@o4507138224160768.ingest.us.sentry.io/4507148139495424",
// Do not enable sentry locally
enabled: process.env.NODE_ENV === "production",
environment: process?.env.NEXT_PUBLIC_APPLICATION_ENVIRONMENT ?? "dev",

// Adjust this value in production, or use tracesSampler for greater control
tracesSampleRate: 1,
Expand Down
1 change: 1 addition & 0 deletions packages/ui/docs-bundle/sentry.edge.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ Sentry.init({

// Setting this option to true will print useful information to the console while you're setting up Sentry.
debug: false,
environment: process?.env.NEXT_PUBLIC_APPLICATION_ENVIRONMENT ?? "dev",
});
1 change: 1 addition & 0 deletions packages/ui/docs-bundle/sentry.server.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Sentry.init({

// Setting this option to true will print useful information to the console while you're setting up Sentry.
debug: false,
environment: process?.env.NEXT_PUBLIC_APPLICATION_ENVIRONMENT ?? "dev",

// uncomment the line below to enable Spotlight (https://spotlightjs.com)
// spotlight: process.env.NODE_ENV === 'development',
Expand Down
5 changes: 0 additions & 5 deletions packages/ui/docs-bundle/src/pages/api/sentry-example-api.js

This file was deleted.

80 changes: 0 additions & 80 deletions packages/ui/docs-bundle/src/pages/sentry-example-page.jsx

This file was deleted.

2 changes: 1 addition & 1 deletion servers/fdr/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,6 @@
"lint:eslint:fix": "pnpm lint:eslint --fix",
"test:local": "dotenv -e .env.test -- vitest src/__test__/local --globals --config src/__test__/local/vitest.config.ts",
"test:ete": "dotenv -e .env.ete -- vitest src/__test__/ete --globals --config src/__test__/ete/vitest.config.ts",
"sentry:sourcemaps": "sentry-cli sourcemaps inject --org fern-api --project fdr ./dist && sentry-cli sourcemaps upload --org fern-api --project fdr ./dist"
"sentry:sourcemaps": "sentry-cli sourcemaps inject --org buildwithfern --project fdr ./dist && sentry-cli sourcemaps upload --org buildwithfern --project fdr ./dist"
}
}
6 changes: 3 additions & 3 deletions servers/fdr/src/server.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import * as Sentry from "@sentry/node";
import { nodeProfilingIntegration } from "@sentry/profiling-node";
import compression from "compression";
import cors from "cors";
Expand All @@ -14,7 +15,6 @@ import { getDocsWriteV2Service } from "./controllers/docs/v2/getDocsWriteV2Servi
import { getSnippetsFactoryService } from "./controllers/snippets/getSnippetsFactoryService";
import { getSnippetsService } from "./controllers/snippets/getSnippetsService";
import { getTemplateService } from "./controllers/snippets/getTemplateService";
import * as Sentry from "@sentry/node";

const PORT = 8080;

Expand All @@ -36,9 +36,9 @@ Sentry.init({
tracesSampleRate: 1.0, // Capture 100% of the transactions
// Set sampling rate for profiling - this is relative to tracesSampleRate
profilesSampleRate: 1.0,
environment: process.env.NODE_ENV,
environment: process?.env.NEXT_PUBLIC_APPLICATION_ENVIRONMENT ?? "dev",
maxValueLength: 1000,
enabled: process.env.NODE_ENV === "production", // Do not enavle sentry when running local
enabled: process.env.NODE_ENV === "production", // Do not enable sentry when running local
});

// The request handler must be the first middleware on the app
Expand Down

0 comments on commit 3f99f7d

Please sign in to comment.