Commit 50c6a868 authored by 郭志伟's avatar 郭志伟

feat: sentry接入

parent d24fa207
const crypto = require('crypto');
const pkgInfo = require('./package.json');
const project = pkgInfo.name;
const hashName = crypto
.createHash('md5')
.update(project)
.digest('hex')
.substr(0, 8);
module.exports = {
org: 'sentry',
project: 'group-buy-ui',
project,
authToken: '3f1f6f3789594e3a81280c1cd8d4d1008037a7abad714698b60b6f358c3d7562',
url: 'http://newsentry.quantgroups.com',
dsn: 'http://d36508238b7c4e5fa8306948b52948e1@newsentry.quantgroups.com/11',
release: 'group-buy-ui@1.0.0',
release: `${project}@1.0.0`,
ignore: ['node_modules', 'tests'],
silent: true,
include: [
{
paths: ['./dist/js']
paths: ['./dist/js'],
urlPrefix: `https://misc.lkbang.net/${hashName}/`
}
]
};
......@@ -17,7 +17,6 @@
"@qg/qg-scroll": "^1.4.2",
"@qg/ui-request": "^0.0.20",
"@qg/ui-track-web": "0.0.3",
"@sentry/tracing": "^7.8.1",
"@sentry/vue": "^7.8.1",
"core-js": "^3.6.5",
"crypto-js": "^3.1.9-1",
......@@ -26,7 +25,6 @@
"intersection-observer": "^0.12.0",
"js-cookie": "^2.2.1",
"qiniu-js": "^3.3.1",
"raven-js": "^3.27.2",
"sa-sdk-javascript": "^1.15.16",
"swiper": "^4.0.7",
"vue": "2.6.11",
......@@ -72,4 +70,4 @@
"commit-msg": "commitlint -e $HUSKY_GIT_PARAMS"
}
}
}
}
\ No newline at end of file
......@@ -8,22 +8,15 @@ import '@/service/cherryUI.service';
import './style/index.less';
import saService from '@/service/sa.service';
import Bridge from '@qg/js-bridge';
import * as Sentry from '@sentry/vue';
import { Integrations } from '@sentry/tracing';
import { release, dsn } from '../.sentryclirc';
import { init as sentryInit } from '@sentry/vue';
import lazyload from '@qg/cherry-ui/src/lazyload/index';
import 'intersection-observer';
if (process.env.SENTRY_ENV !== 'test' && process.env.NODE_ENV === 'production') {
Sentry.init({
sentryInit({
Vue,
dsn,
integrations: [
new Integrations.BrowserTracing({
routingInstrumentation: Sentry.vueRouterInstrumentation(router)
})
],
release,
tracesSampleRate: 1.0, // 上报频率, 1最大, 0最小, 建议验证设置为1, 项目运行根据情况降低频率
dsn: 'https://d36508238b7c4e5fa8306948b52948e1@sentry.q-gp.com/11', // 项目设置中的Client Keys
release: 'group-buy-ui@1.0.0', // 项目名加版本号
tracesSampleRate: 0.5, // 上报频率, 1最大, 0最小, 建议验证设置为1, 项目运行根据情况降低频率
environment: process.env.NODE_ENV
});
}
......
const path = require('path');
const resolve = dir => path.join(__dirname, dir);
const IS_PROD = process.env.NODE_ENV === 'production';
const webpack = require('webpack');
const WebpackCosCdnUploadPlugin = require('@qg/webpack-cos-cdn-upload-plugin');
const SentryPlugin = require('@qg/sentry-webpack-plugin');
const SentryConfig = require('./.sentryclirc');
......@@ -88,6 +89,11 @@ module.exports = {
priority: 10,
chunks: 'initial' // only package third parties that are initially dependent
},
sentry: {
name: 'chunk-sentry', // sentry
priority: 20, // the weigh1t needs to be larger than libs and app or it will be packaged into libs or app
test: /[\\/]node_modules[\\/]@sentry[\\/]/ // in order to adapt to cnpm
},
libs: {
name: 'chunk-libs', // 分离非在入口加载的,但是引用超过2次的依赖
test: /[\\/]node_modules[\\/]/,
......@@ -127,8 +133,13 @@ module.exports = {
if (IS_PROD) {
config.externals = externals;
configObj = {
plugins: [new SentryPlugin(SentryConfig), new WebpackCosCdnUploadPlugin()]
// plugins: [new WebpackCosCdnUploadPlugin()]
plugins: [
new SentryPlugin(SentryConfig),
new webpack.DefinePlugin({
'process.env.SENTRY_ENV': `"${process.env.SENTRY_ENV || ''}"`
}),
new WebpackCosCdnUploadPlugin()
]
};
}
return configObj;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment