Skip to content

Commit

Permalink
feat: add sentry integration
Browse files Browse the repository at this point in the history
  • Loading branch information
jpedroh committed Aug 13, 2023
1 parent ed84b44 commit c340352
Show file tree
Hide file tree
Showing 7 changed files with 399 additions and 27 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -221,4 +221,7 @@ target/

# End of https://www.toptal.com/developers/gitignore/api/rust

.vscode/
.vscode/

# Sentry Auth Token
.sentryclirc
34 changes: 33 additions & 1 deletion packages/app/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,36 @@ const nextConfig = {
},
};

module.exports = nextConfig;
// Injected content via Sentry wizard below

const { withSentryConfig } = require("@sentry/nextjs");

module.exports = withSentryConfig(
nextConfig,
{
// For all available options, see:
// https://github.com/getsentry/sentry-webpack-plugin#options

// Suppresses source map uploading logs during build
silent: true,

org: "jpedroh",
project: "mach-vq",
},
{
// For all available options, see:
// https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/

// Upload a larger set of source maps for prettier stack traces (increases build time)
widenClientFileUpload: true,

// Transpiles SDK to be compatible with IE11 (increases bundle size)
transpileClientSDK: true,

// Hides source maps from generated client bundles
hideSourceMaps: true,

// Automatically tree-shake Sentry logger statements to reduce bundle size
disableLogger: true,
}
);
3 changes: 2 additions & 1 deletion packages/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"homepage": "https://jpedroh.github.io/mach",
"dependencies": {
"@mach/common": "*",
"@mach/database": "*"
"@mach/database": "*",
"@sentry/nextjs": "^7.63.0"
},
"scripts": {
"dev": "next dev",
Expand Down
32 changes: 32 additions & 0 deletions packages/app/sentry.client.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// This file configures the initialization of Sentry on the client.
// The config you add here will be used whenever a users loads a page in their browser.
// https://docs.sentry.io/platforms/javascript/guides/nextjs/

import * as Sentry from "@sentry/nextjs";

Sentry.init({
dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,
release: process.env.NEXT_PUBLIC_SENTRY_RELEASE,
environment: process.env.NEXT_PUBLIC_SENTRY_ENVIRONMENT,

// Adjust this value in production, or use tracesSampler for greater control
tracesSampleRate: 0.001,

// Setting this option to true will print useful information to the console while you're setting up Sentry.
debug: false,

replaysOnErrorSampleRate: 1.0,

// This sets the sample rate to be 10%. You may want this to be 100% while
// in development and sample at a lower rate in production
replaysSessionSampleRate: 0.1,

// You can remove this option if you're not planning to use the Sentry Session Replay feature:
integrations: [
new Sentry.Replay({
// Additional Replay configuration goes in here, for example:
maskAllText: true,
blockAllMedia: true,
}),
],
});
18 changes: 18 additions & 0 deletions packages/app/sentry.edge.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// This file configures the initialization of Sentry for edge features (middleware, edge routes, and so on).
// The config you add here will be used whenever one of the edge features is loaded.
// Note that this config is unrelated to the Vercel Edge Runtime and is also required when running locally.
// https://docs.sentry.io/platforms/javascript/guides/nextjs/

import * as Sentry from "@sentry/nextjs";

Sentry.init({
dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,
release: process.env.NEXT_PUBLIC_SENTRY_RELEASE,
environment: process.env.NEXT_PUBLIC_SENTRY_ENVIRONMENT,

// Adjust this value in production, or use tracesSampler for greater control
tracesSampleRate: 0.001,

// Setting this option to true will print useful information to the console while you're setting up Sentry.
debug: false,
});
17 changes: 17 additions & 0 deletions packages/app/sentry.server.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// This file configures the initialization of Sentry on the server.
// The config you add here will be used whenever the server handles a request.
// https://docs.sentry.io/platforms/javascript/guides/nextjs/

import * as Sentry from "@sentry/nextjs";

Sentry.init({
dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,
release: process.env.NEXT_PUBLIC_SENTRY_RELEASE,
environment: process.env.NEXT_PUBLIC_SENTRY_ENVIRONMENT,

// Adjust this value in production, or use tracesSampler for greater control
tracesSampleRate: 0.001,

// Setting this option to true will print useful information to the console while you're setting up Sentry.
debug: false,
});
Loading

0 comments on commit c340352

Please sign in to comment.