修复 sentry 配置

This commit is contained in:
whyour 2023-12-06 16:35:35 +08:00
parent 6e0ee6f627
commit 20249119a0
4 changed files with 6 additions and 19 deletions

View File

@ -1,6 +1,5 @@
import { Application } from 'express';
import * as Sentry from '@sentry/node';
import * as Tracing from '@sentry/tracing';
import Logger from './logger';
import config from '../config';
import fs from 'fs';
@ -16,10 +15,10 @@ export default async ({ expressApp }: { expressApp: Application }) => {
/UnauthorizedError/i,
/celebrate request validation failed/i,
],
dsn: 'https://f4b5b55fb3c645b29a5dc2d70a1a4ef4@o1098464.ingest.sentry.io/6122819',
dsn: 'https://8b5c84cfef3e22541bc84de0ed00497b@o1098464.ingest.sentry.io/6122819',
integrations: [
new Sentry.Integrations.Http({ tracing: true }),
new Tracing.Integrations.Express({ app: expressApp }),
new Sentry.Integrations.Express({ app: expressApp }),
],
tracesSampleRate: 0.8,
release: version,

View File

@ -58,7 +58,6 @@
"@grpc/grpc-js": "^1.8.13",
"@otplib/preset-default": "^12.0.1",
"@sentry/node": "^7.12.1",
"@sentry/tracing": "^7.12.1",
"body-parser": "^1.19.2",
"celebrate": "^15.0.1",
"chokidar": "^3.5.3",

View File

@ -10,9 +10,6 @@ dependencies:
'@sentry/node':
specifier: ^7.12.1
version: 7.54.0
'@sentry/tracing':
specifier: ^7.12.1
version: 7.54.0
body-parser:
specifier: ^1.19.2
version: 1.20.2
@ -4043,7 +4040,7 @@ packages:
nopt: 5.0.0
npmlog: 5.0.1
rimraf: 3.0.2
semver: 7.5.1
semver: 7.5.4
tar: 6.1.15
transitivePeerDependencies:
- encoding
@ -4480,13 +4477,6 @@ packages:
'@sentry/utils': 7.54.0
dev: true
/@sentry/tracing@7.54.0:
resolution: {integrity: sha512-IyflAAqOiKuNvhWXrJsXN8yfl8DbHRpfgtCEPo5TBvdkpcyxUyfE8W2a2MQ8MXDzgfJT1IixXEwleO+qPIi3Gg==}
engines: {node: '>=8'}
dependencies:
'@sentry-internal/tracing': 7.54.0
dev: false
/@sentry/types@7.54.0:
resolution: {integrity: sha512-D+i9xogBeawvQi2r0NOrM7zYcUaPuijeME4O9eOTrDF20tj71hWtJLilK+KTGLYFtpGg1h+9bPaz7OHEIyVopg==}
engines: {node: '>=8'}
@ -11262,7 +11252,7 @@ packages:
nopt: 5.0.0
npmlog: 6.0.2
rimraf: 3.0.2
semver: 7.5.1
semver: 7.5.4
tar: 6.1.15
which: 2.0.2
transitivePeerDependencies:

View File

@ -1,13 +1,12 @@
import * as Sentry from '@sentry/react';
import { Integrations } from '@sentry/tracing';
import { loader } from '@monaco-editor/react';
export function init(version: string) {
// sentry监控 init
Sentry.init({
dsn: 'https://3406424fb1dc4813a62d39e844a9d0ac@o1098464.ingest.sentry.io/6122818',
dsn: 'https://49b9ad1a6201bfe027db296ab7c6d672@o1098464.ingest.sentry.io/6122818',
integrations: [
new Integrations.BrowserTracing({
new Sentry.BrowserTracing({
shouldCreateSpanForRequest(url) {
return !url.includes('/api/ws') && !url.includes('/api/static');
},