Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Init Sentry at service side #4419

Merged
merged 50 commits into from
Mar 14, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
0b6f9b5
feat(condo): INFRA-229 init sentry
sitozzz Feb 20, 2024
8f923a8
feat(condo): INFRA-229 downgrade sentry package version for compatibi…
sitozzz Feb 20, 2024
3050d10
fix(condo): INFRA-229 move dsn url to runtime config
sitozzz Feb 21, 2024
c337a16
fix(condo): INFRA-229 set sentry to latest version & simplify config
sitozzz Feb 21, 2024
544fbe0
fix(condo): INFRA-229 move sentry related values to a single config r…
sitozzz Feb 22, 2024
97ba49e
feat(condo): INFRA-229 add sentry apollo logger & profiler
sitozzz Feb 27, 2024
7330f2d
fix(condo): INFRA-229 disable debug mode by default
sitozzz Feb 28, 2024
bfc0825
fix(condo): INFRA-229 rebase & little sentry config optimisation
sitozzz Mar 6, 2024
68397a9
chore(condo): INFRA-229 add sentry config
sitozzz Mar 6, 2024
7b5f9cf
chore(condo): INFRA-229 sentry client side config adjustments
sitozzz Mar 7, 2024
edb6930
fix(global): INFRA-229 add sentry config inside build stage
sitozzz Mar 7, 2024
fc47976
chore(condo): INFRA-229 temp changes for debug proposes
sitozzz Mar 7, 2024
26e1b4a
chore(condo): INFRA-229 temp changes for debug proposes
sitozzz Mar 7, 2024
98a0f0a
chore(condo): INFRA-229 temp changes for debug proposes
sitozzz Mar 7, 2024
f9c5d83
chore(condo): INFRA-229 temp changes for debug proposes
sitozzz Mar 7, 2024
94eb486
chore(condo): INFRA-229 temp changes for debug proposes
sitozzz Mar 7, 2024
7ed8935
chore(condo): INFRA-229 temp changes for debug proposes
sitozzz Mar 7, 2024
24ddfa8
chore(condo): INFRA-229 temp changes for debug proposes
sitozzz Mar 7, 2024
cc370f2
chore(condo): INFRA-229 temp changes for debug proposes
sitozzz Mar 7, 2024
0e8b827
chore(condo): INFRA-229 temp changes for debug proposes
sitozzz Mar 7, 2024
be2bbb3
fix(condo): INFRA-229 revert werf env changes & try set vars only at …
sitozzz Mar 11, 2024
d05c0ab
chore(condo): INFRA-229 remove unused log
sitozzz Mar 11, 2024
5762efa
fix(keystone): INFRA-229 disable sentry apollo plugin when no config …
sitozzz Mar 11, 2024
6ec23ca
chore(condo): INFRA-229 second try to pass gh env to werf setup stage
sitozzz Mar 11, 2024
4866cc9
chore(condo): INFRA-229 second try to pass gh env to werf setup stage
sitozzz Mar 11, 2024
af4999c
chore(condo): INFRA-229 second try to pass gh env to werf setup stage
sitozzz Mar 11, 2024
bb1a6ed
chore(condo): INFRA-229 second try to pass gh env to werf setup stage
sitozzz Mar 11, 2024
13dab51
chore(condo): INFRA-229 second try to pass gh env to werf setup stage
sitozzz Mar 11, 2024
1dfd71d
chore(condo): INFRA-229 second try to pass gh env to werf setup stage
sitozzz Mar 11, 2024
c66c3c0
chore(condo): INFRA-229 second try to pass gh env to werf setup stage
sitozzz Mar 11, 2024
675c663
fix(condo): INFRA-229 disable sentry debug mode
sitozzz Mar 12, 2024
3ddb2e3
fix(condo): INFRA-229 try to integrate with sentry release gh action …
sitozzz Mar 12, 2024
bbfbd7d
fix(condo): INFRA-229 try to integrate with sentry release gh action …
sitozzz Mar 12, 2024
b3f6dc0
fix(condo): INFRA-229 try to integrate with sentry release gh action …
sitozzz Mar 12, 2024
8c03024
fix(condo): INFRA-229 try to integrate with sentry release gh action …
sitozzz Mar 12, 2024
603c98a
fix(condo): INFRA-229 try to integrate with sentry release gh action …
sitozzz Mar 12, 2024
ed894e0
fix(condo): INFRA-229 try to integrate with sentry release gh action …
sitozzz Mar 12, 2024
8f8fd09
fix(condo): INFRA-229 try to integrate with sentry release gh action …
sitozzz Mar 12, 2024
a88dfb9
fix(condo): INFRA-229 try to integrate with sentry release gh action …
sitozzz Mar 12, 2024
cc0bc9b
fix(condo): INFRA-229 try to integrate with sentry release gh action …
sitozzz Mar 12, 2024
1b086d1
fix(condo): INFRA-229 try to integrate with sentry release gh action …
sitozzz Mar 12, 2024
5d24994
fix(condo): INFRA-229 try to integrate with sentry release gh action …
sitozzz Mar 12, 2024
d5f4551
fix(condo): INFRA-229 try to integrate with sentry release gh action …
sitozzz Mar 12, 2024
9b480ed
fix(condo): INFRA-229 try to integrate with sentry release gh action …
sitozzz Mar 12, 2024
5561ae5
fix(condo): INFRA-229 add release name for review env
sitozzz Mar 13, 2024
058aa33
fix(condo): INFRA-229 set commit sha as release anchor at both sides …
sitozzz Mar 13, 2024
1c64d25
chore(condo): INFRA-229 update values at helm
sitozzz Mar 13, 2024
efd1c8a
fix(condo): INFRA-229 update config at helm & point submodule to master
sitozzz Mar 13, 2024
f710b9b
fix(keystone): INFRA-229 remove comment lines
sitozzz Mar 14, 2024
c60eff8
chore(condo): INFRA-229 simplify wrapper logic at next.config
sitozzz Mar 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
feat(condo): INFRA-229 init sentry
  • Loading branch information
sitozzz committed Mar 14, 2024
commit 0b6f9b5bf2d5b3d48dab0a916e38a3eeb2ab0a45
45 changes: 45 additions & 0 deletions apps/condo/next.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// @ts-check
const { withSentryConfig } = require('@sentry/nextjs')
const withCSS = require('@zeit/next-css')
const withLess = require('@zeit/next-less')
const AntdDayjsWebpackPlugin = require('antd-dayjs-webpack-plugin')
Expand Down Expand Up @@ -46,6 +47,7 @@ const newsItemsSendingDelay = Number(conf['NEWS_ITEMS_SENDING_DELAY_SEC']) || 15
const audioConfig = JSON.parse(conf['AUDIO_CONFIG'] || '{}')
const checkTLSClientCertConfig = JSON.parse(conf['CHECK_TLS_CLIENT_CERT_CONFIG'] || '{}')
const condoRBDomain = conf['CONDORB_DOMAIN']
const sentryDSN = conf['SENTRY_DSN']
const apolloBatchingEnabled = !falsey(conf['APOLLO_BATCHING_ENABLED'])

module.exports = withTM(withLess(withCSS({
Expand Down Expand Up @@ -104,4 +106,47 @@ module.exports = withTM(withLess(withCSS({

return config
},

})))

if (sentryDSN) {
module.exports = withSentryConfig(
module.exports,
sitozzz marked this conversation as resolved.
Show resolved Hide resolved
{
// For all available options, see:
// https://github.com/getsentry/sentry-webpack-plugin#options

// Suppresses source map uploading logs during build
silent: true,
org: 'qqorgldsp',
project: 'javascript-nextjs',
validate: true,
},
{
// 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: false,

// Routes browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers (increases server load)
// tunnelRoute: '/monitoring',

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

// Automatically tree-shake Sentry logger statements to reduce bundle size
disableLogger: true,

// Enables automatic instrumentation of Vercel Cron Monitors.
// See the following for more information:
// https://docs.sentry.io/product/crons/
// https://vercel.com/docs/cron-jobs
automaticVercelMonitors: true,

}
)
}
1 change: 1 addition & 0 deletions apps/condo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
"@opentelemetry/instrumentation-pg": "^0.36.1",
"@opentelemetry/sdk-metrics": "^1.15.2",
"@opentelemetry/sdk-node": "^0.41.2",
"@sentry/nextjs": "^7.101.1",
"@tinymce/tinymce-react": "^4.1.0",
"@types/lodash": "4.14.186",
"@types/wavesurfer.js": "^6.0.6",
Expand Down
4 changes: 3 additions & 1 deletion apps/condo/pages/_error.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Custom500 from '@app/condo/pages/500'
import * as Sentry from '@sentry/nextjs'
import get from 'lodash/get'
import { NextPageContext } from 'next'
import NextErrorComponent from 'next/error'
Expand All @@ -12,6 +13,7 @@ export default function ErrorPage (): React.ReactElement {
ErrorPage.container = <></>

ErrorPage.getInitialProps = async (props: NextPageContext) => {
await Sentry.captureUnderscoreErrorException(props)
const { req, asPath, pathname, res, err } = props

console.error('Pathname, asPath:', pathname, asPath)
Expand Down Expand Up @@ -43,4 +45,4 @@ ErrorPage.getInitialProps = async (props: NextPageContext) => {
}

return errorInitialProps
}
}
30 changes: 30 additions & 0 deletions apps/condo/sentry.client.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// 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/

sitozzz marked this conversation as resolved.
Show resolved Hide resolved
import * as Sentry from '@sentry/nextjs'

Sentry.init({
dsn: 'https://708218848724e5607e9eb3f3bf741b38@o4506776962400256.ingest.sentry.io/4506776963907584',

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

// 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: [
Sentry.replayIntegration({
// Additional Replay configuration goes in here, for example:
maskAllText: true,
blockAllMedia: true,
}),
],
})
16 changes: 16 additions & 0 deletions apps/condo/sentry.edge.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// 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: "https://708218848724e5607e9eb3f3bf741b38@o4506776962400256.ingest.sentry.io/4506776963907584",

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

// Setting this option to true will print useful information to the console while you're setting up Sentry.
debug: false,
});
15 changes: 15 additions & 0 deletions apps/condo/sentry.server.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// 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: "https://708218848724e5607e9eb3f3bf741b38@o4506776962400256.ingest.sentry.io/4506776963907584",

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

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