Commit 5b1b86ea authored by 郭志伟's avatar 郭志伟

feat: sentry接入

parent c9bed617
module.exports = {
// Sentry options are required
organization: 'sentry',
project: 'vcc-spider-center-ui',
apiKey: '0d3fa45c10f047d7bfe03eb268a93c23a878d7585dc749418f728f88d65e1477',
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);
// Release version name/hash is required
release: 'vcc-spider-center-ui@1.0.1',
baseSentryURL: 'http://sentry.quantgroups.com/api/0',
deleteAfterCompile: true,
include: /static\/js\//, // 只上传js和map文件
ignore: ['node_modules'],
suppressErrors: true,
filenameTransform: function (filename) {
return '~/vcc-spider-center-ui/public/' + filename
},
}
module.exports = {
org: 'sentry',
project,
authToken: '3f1f6f3789594e3a81280c1cd8d4d1008037a7abad714698b60b6f358c3d7562',
url: 'http://newsentry.quantgroups.com',
release: `${project}@1.0.0`,
ignore: ['node_modules', 'tests'],
silent: true,
include: [
{
paths: ['./dist/js'],
urlPrefix: `https://misc.lkbang.net/${hashName}/`
}
]
};
This diff is collapsed.
{
"name": "vcc-spider-center-ui",
"name": "phobos-ui",
"version": "1.0.0",
"private": true,
"scripts": {
......@@ -15,10 +15,10 @@
"@qg/qg-scroll": "^1.4.2",
"@qg/ui-request": "^0.0.20",
"@qg/ui-track-web": "0.0.3",
"@sentry/vue": "^7.9.0",
"core-js": "^3.6.5",
"crypto-js": "^3.1.9-1",
"js-cookie": "^2.2.1",
"raven-js": "^3.27.2",
"sa-sdk-javascript": "^1.15.16",
"vue": "2.6.11",
"vue-router": "^3.2.0",
......@@ -29,6 +29,7 @@
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.12.1",
"@babel/plugin-proposal-optional-chaining": "^7.12.7",
"@qg/webpack-cos-cdn-upload-plugin": "1.0.2",
"@qg/sentry-webpack-plugin": "^1.19.0",
"@vue/cli-plugin-babel": "^4.4.0",
"@vue/cli-plugin-eslint": "^4.4.0",
"@vue/cli-plugin-router": "^4.4.0",
......@@ -47,8 +48,7 @@
"postcss-px2rem": "^0.3.0",
"prettier": "^1.19.1",
"svg-sprite-loader": "^5.2.1",
"vue-template-compiler": "^2.6.11",
"webpack-sentry-plugin": "^2.0.3"
"vue-template-compiler": "^2.6.11"
},
"lint-staged": {
"src/**/*.{js,vue}": [
......
......@@ -8,16 +8,15 @@ import '@/service/cherryUI.service';
import './style/index.less';
import saService from '@/service/sa.service';
import Bridge from '@qg/js-bridge';
import Raven from 'raven-js';
import RavenVue from 'raven-js/plugins/vue';
import { release } from '../.sentryclirc';
import { init as sentryInit } from '@sentry/vue';
if (process.env.SENTRY_ENV !== 'test' && process.env.NODE_ENV === 'production') {
Raven.config('//7b09a4aeffca4a49b37328da6a5468a9@sentry.q-gp.com/83', {
release,
sentryInit({
Vue,
dsn: 'http://ab941e35776348e6aed32324658798f3@sentry.q-gp.com/17', // 项目设置中的Client Keys
release: 'phobos-ui@1.0.0', // 项目名加版本号
tracesSampleRate: 0.5, // 上报频率, 1最大, 0最小, 建议验证设置为1, 项目运行根据情况降低频率
environment: process.env.NODE_ENV
})
.addPlugin(RavenVue, Vue)
.install();
});
}
Vue.prototype.util = new Bridge();
Vue.prototype.$track = saService;
......
......@@ -2,8 +2,9 @@ const path = require('path');
const resolve = dir => path.join(__dirname, dir);
const IS_PROD = process.env.NODE_ENV === 'production';
const WebpackCosCdnUploadPlugin = require('@qg/webpack-cos-cdn-upload-plugin');
// const SentryPlugin = require('webpack-sentry-plugin');
// const SentryConfig = require('./.sentryclirc');
const SentryPlugin = require('@qg/sentry-webpack-plugin');
const SentryConfig = require('./.sentryclirc');
const webpack = require('webpack');
// cdn预加载使用
const externals = {
vue: 'Vue',
......@@ -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 WebpackCosCdnUploadPlugin(),
new SentryPlugin(SentryConfig),
new webpack.DefinePlugin({
'process.env.SENTRY_ENV': `"${process.env.SENTRY_ENV || ''}"`
})
]
};
}
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