Преглед на файлове

feat: sentry to dify account (#299)

Joel преди 1 година
родител
ревизия
d70086b841
променени са 6 файла, в които са добавени 20 реда и са изтрити 12 реда
  1. 6 1
      web/.env.example
  2. 6 5
      web/next.config.js
  3. 2 0
      web/package.json
  4. 2 2
      web/sentry.client.config.js
  5. 2 2
      web/sentry.edge.config.js
  6. 2 2
      web/sentry.server.config.js

+ 6 - 1
web/.env.example

@@ -9,4 +9,9 @@ NEXT_PUBLIC_API_PREFIX=http://localhost:5001/console/api
 # The URL for Web APP, refers to the Web App base URL of WEB service if web app domain is different from
 # console or api domain.
 # example: http://udify.app/api
-NEXT_PUBLIC_PUBLIC_API_PREFIX=http://localhost:5001/api
+NEXT_PUBLIC_PUBLIC_API_PREFIX=http://localhost:5001/api
+
+# SENTRY
+NEXT_PUBLIC_SENTRY_DSN=
+NEXT_PUBLIC_SENTRY_ORG=
+NEXT_PUBLIC_SENTRY_PROJECT=

+ 6 - 5
web/next.config.js

@@ -1,9 +1,10 @@
 const { withSentryConfig } = require('@sentry/nextjs')
 
-const EDITION = process.env.NEXT_PUBLIC_EDITION
-const IS_CE_EDITION = EDITION === 'SELF_HOSTED'
 const isDevelopment = process.env.NODE_ENV === 'development'
-const isHideSentry = isDevelopment || IS_CE_EDITION
+const SENTRY_DSN = process.env.NEXT_PUBLIC_SENTRY_DSN
+const SENTRY_ORG = process.env.NEXT_PUBLIC_SENTRY_ORG
+const SENTRY_PROJECT = process.env.NEXT_PUBLIC_SENTRY_PROJECT
+const isHideSentry = isDevelopment || !SENTRY_DSN || !SENTRY_ORG || !SENTRY_PROJECT
 
 const withMDX = require('@next/mdx')({
   extension: /\.mdx?$/,
@@ -56,8 +57,8 @@ const nextConfig = {
 
 // https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup
 const sentryWebpackPluginOptions = {
-  org: 'perfectworld',
-  project: 'javascript-nextjs',
+  org: SENTRY_ORG,
+  project: SENTRY_PROJECT,
   silent: true, // Suppresses all logs
   sourcemaps: {
     assets: './**',

+ 2 - 0
web/package.json

@@ -12,6 +12,7 @@
     "prepare": "cd ../ && husky install ./web/.husky"
   },
   "dependencies": {
+    "@babel/runtime": "^7.22.3",
     "@emoji-mart/data": "^1.1.2",
     "@formatjs/intl-localematcher": "^0.2.32",
     "@headlessui/react": "^1.7.13",
@@ -20,6 +21,7 @@
     "@mdx-js/react": "^2.3.0",
     "@next/mdx": "^13.2.4",
     "@sentry/nextjs": "^7.53.1",
+    "@sentry/utils": "^7.54.0",
     "@tailwindcss/line-clamp": "^0.4.2",
     "@types/crypto-js": "^4.1.1",
     "@types/lodash-es": "^4.17.7",

+ 2 - 2
web/sentry.client.config.js

@@ -1,14 +1,14 @@
 import * as Sentry from '@sentry/nextjs'
 
 Sentry.init({
-  dsn: 'https://6bf48a450f054d749398c02a61bae343@o4505264807215104.ingest.sentry.io/4505264809115648',
+  dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,
   // Replay may only be enabled for the client-side
   integrations: [new Sentry.Replay()],
 
   // Set tracesSampleRate to 1.0 to capture 100%
   // of transactions for performance monitoring.
   // We recommend adjusting this value in production
-  tracesSampleRate: 1.0,
+  tracesSampleRate: 0.1,
 
   // Capture Replay for 10% of all sessions,
   // plus for 100% of sessions with an error

+ 2 - 2
web/sentry.edge.config.js

@@ -1,12 +1,12 @@
 import * as Sentry from '@sentry/nextjs'
 
 Sentry.init({
-  dsn: 'https://6bf48a450f054d749398c02a61bae343@o4505264807215104.ingest.sentry.io/4505264809115648',
+  dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,
 
   // Set tracesSampleRate to 1.0 to capture 100%
   // of transactions for performance monitoring.
   // We recommend adjusting this value in production
-  tracesSampleRate: 1.0,
+  tracesSampleRate: 0.1,
 
   // ...
 

+ 2 - 2
web/sentry.server.config.js

@@ -1,10 +1,10 @@
 import * as Sentry from '@sentry/nextjs'
 
 Sentry.init({
-  dsn: 'https://6bf48a450f054d749398c02a61bae343@o4505264807215104.ingest.sentry.io/4505264809115648',
+  dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,
 
   // Set tracesSampleRate to 1.0 to capture 100%
   // of transactions for performance monitoring.
   // We recommend adjusting this value in production
-  tracesSampleRate: 1.0,
+  tracesSampleRate: 0.1,
 })