Commit c901c65d by 张立顺

config: 接入sentry 监控

1 parent 9c3a7272
[defaults]
url='http://192.168.3.115:9000/'
org='sentry'
project='dj-car-life-system'
[auth]
token='2d992c92b53b40b9869313a353c037d1208ee8bfcc1d418eaec1777f846401b6'
\ No newline at end of file \ No newline at end of file
...@@ -15,6 +15,10 @@ ...@@ -15,6 +15,10 @@
"dependencies": { "dependencies": {
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.17.12", "@babel/plugin-proposal-nullish-coalescing-operator": "^7.17.12",
"@babel/plugin-proposal-optional-chaining": "7.13.12", "@babel/plugin-proposal-optional-chaining": "7.13.12",
"@sentry/browser": "^7.3.0",
"@sentry/tracing": "^7.3.0",
"@sentry/vue": "^7.3.0",
"@sentry/webpack-plugin": "^1.18.9",
"axios": "^0.18.0", "axios": "^0.18.0",
"better-scroll": "^1.15.2", "better-scroll": "^1.15.2",
"dayjs": "^1.8.12", "dayjs": "^1.8.12",
......
<template> <template>
<div id="app"> <div id="app">
<router-view /> <router-view />
</div> </div>
</template> </template>
<script> <script>
// import util from '@/libs/util' export default {
// export default { name: 'app',
// name: 'app',
// watch: { created() {
// '$i18n.locale': 'i18nHandle' // console.log(abcd.efg)
// }, },
// created () { methods: {
// this.i18nHandle(this.$i18n.locale)
// }, }
// methods: { }
// i18nHandle (val, oldVal) { </script>
// util.cookies.set('lang', val)
// document.querySelector('html').setAttribute('lang', val) <style lang="scss">
// } @import '~@/assets/style/public-class.scss';
// } .el_table {
// } thead {
</script> th {
background: #f5f7fa;
<style lang="scss"> }
@import "~@/assets/style/public-class.scss"; }
.el_table { }
thead { </style>
th {
background: #f5f7fa;
}
}
}
</style>
...@@ -10,6 +10,10 @@ import store from '@/store/index' ...@@ -10,6 +10,10 @@ import store from '@/store/index'
// 针对template模板中使用可选链操作符 // 针对template模板中使用可选链操作符
import chaining from '@/plugin/chaining' import chaining from '@/plugin/chaining'
// 接入sentry
import * as Sentry from '@sentry/vue'
import { BrowserTracing } from '@sentry/tracing'
// import D2Crud from '@d2-projects/d2-crud' // import D2Crud from '@d2-projects/d2-crud'
// 菜单和路由设置 // 菜单和路由设置
import router from './router' import router from './router'
...@@ -40,6 +44,24 @@ if (!isProd) { ...@@ -40,6 +44,24 @@ if (!isProd) {
Vue.config.devtools = true Vue.config.devtools = true
} }
// 实例化
process.env.NODE_ENV === 'production' &&
Sentry.init({
Vue,
dsn: 'http://6225fb8e73fb453a8455a9371f3517da@192.168.3.115:9000/4',
integrations: [
new BrowserTracing({
routingInstrumentation: Sentry.vueRouterInstrumentation(router),
tracingOrigins: ['localhost', 'my-site-url.com', /^\//]
})
],
// Set tracesSampleRate to 1.0 to capture 100%
// of transactions for performance monitoring.
// We recommend adjusting this value in production
tracesSampleRate: 1.0,
logErrors: true
})
// Vue.use(D2Crud) // Vue.use(D2Crud)
var baseConfig = '' var baseConfig = ''
axios({ axios({
......
const VueFilenameInjector = require('./tools/vue-filename-injector') const VueFilenameInjector = require('./tools/vue-filename-injector')
const ThemeColorReplacer = require('webpack-theme-color-replacer') const ThemeColorReplacer = require('webpack-theme-color-replacer')
const forElementUI = require('webpack-theme-color-replacer/forElementUI') const forElementUI = require('webpack-theme-color-replacer/forElementUI')
const SentryWebpackPlugin = require('@sentry/webpack-plugin')
const os = require('os') const os = require('os')
/** /**
* 获取当前机器的ip地址 * 获取当前机器的ip地址
...@@ -125,6 +127,21 @@ module.exports = { ...@@ -125,6 +127,21 @@ module.exports = {
// chunkFilename: devMode ? 'css/[id].css' : 'css/[id].[hash].css', // chunkFilename: devMode ? 'css/[id].css' : 'css/[id].[hash].css',
// })] // })]
// config.plugins = [...config.plugins, ...Plugins] // config.plugins = [...config.plugins, ...Plugins]
// sentry 配置
Object.assign(config, {
plugins: [
...config.plugins,
new SentryWebpackPlugin({
// webpack specific configuration
release: '0.0.1',
include: './dist', // 需要上传到sentry服务器的资源目录,会自动匹配js 以及map文件
ignore: ['node_modules', 'vue.config.js'], // 忽略文件目录,当然我们在inlcude中制定了文件路径,这个忽略目录可以不加
configFile: '.sentryclirc',
urlPrefix: '~/dj-carlife-web/'
})
]
})
}, },
// 默认设置: https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-service/lib/config/base.js // 默认设置: https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-service/lib/config/base.js
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!