瀏覽代碼

Merge branch 'add-sentry-6.29' into dev_1.1.3

zhangwei 2 年之前
父節點
當前提交
803ea5c297

+ 2 - 0
package.json

@@ -11,6 +11,8 @@
     "build-watch": "vue-cli-service  --env.NODE_ENV=development build-watch --mode development"
   },
   "dependencies": {
+    "@sentry/tracing": "^7.5.1",
+    "@sentry/vue": "^7.5.1",
     "ant-design-vue": "^2.2.8",
     "axios": "^0.26.1",
     "clipboard": "^2.0.10",

+ 1 - 1
src/entry/background.js

@@ -73,7 +73,7 @@ chrome.action.onClicked.addListener(function (tab) {
 chrome.tabs.onActivated.addListener(function (activeInfo) {
     setPopupConfig(activeInfo);
 })
-
+// 加入try catch
 function onInstalledMethod() {
     onInstalledCreateTab()
     onInstalledMid()

+ 4 - 1
src/entry/content_help.js

@@ -4,12 +4,15 @@ import {
 } from "@/logic/content/twitter.js";
 import { createApp } from 'vue'
 import ViewMessage from '@/view/content/message/index.vue'
+import CoutomSentry from "@/uilts/sentry.js"
 
 const addDomMessage = (element) => {
     const div = document.createElement('div')
     div.id = 'denet_message'
     document.body.appendChild(div)
-    createApp(element).mount('#denet_message')
+    let app = createApp(element)
+    app.mount('#denet_message')
+    CoutomSentry.initVue(app)
 }
 
 let timer = setInterval(() => {

+ 3 - 0
src/iframe/bind-tweet.js

@@ -3,4 +3,7 @@ import App from '@/view/iframe/bind-tweet/bind-tweet.vue'
 
 const app = createApp(App);
 
+import CoutomSentry from "@/uilts/sentry.js"
+CoutomSentry.initVue(app)
+
 app.mount('#app');

+ 3 - 0
src/iframe/buy-nft.js

@@ -6,6 +6,9 @@ import 'element-plus/dist/index.css'
 import router from '@/router/buy-nft.js'
 
 const app = createApp(App);
+import CoutomSentry from "@/uilts/sentry.js"
+CoutomSentry.initVue(app)
+
 
 
 app.use(router)

+ 2 - 1
src/iframe/group-card.js

@@ -2,5 +2,6 @@ import { createApp } from 'vue'
 import App from '@/view/iframe/group-card/card.vue'
 
 const app = createApp(App);
-
+import CoutomSentry from "@/uilts/sentry.js"
+CoutomSentry.initVue(app)
 app.mount('#app');

+ 2 - 0
src/iframe/home.js

@@ -19,6 +19,8 @@ app.use(Switch)
 app.use(message);
 app.use(router)
 app.mount('#app')
+import CoutomSentry from "@/uilts/sentry.js"
+CoutomSentry.initVue(app)
 
 window.onload = () => {
     document.title = 'DeNet'

+ 2 - 0
src/iframe/joined-group-list.js

@@ -2,4 +2,6 @@ import { createApp } from 'vue'
 import App from '@/view/iframe/tab-group/joined-group-list.vue'
 
 const app = createApp(App);
+import CoutomSentry from "@/uilts/sentry.js"
+CoutomSentry.initVue(app)
 app.mount('#app');

+ 2 - 1
src/iframe/nft-card.js

@@ -2,5 +2,6 @@ import { createApp } from 'vue'
 import App from '@/view/iframe/nft/card.vue'
 
 const app = createApp(App);
-
+import CoutomSentry from "@/uilts/sentry.js"
+CoutomSentry.initVue(app)
 app.mount('#app');

+ 2 - 1
src/iframe/nft-group-card.js

@@ -2,5 +2,6 @@ import { createApp } from 'vue'
 import App from '@/view/iframe/nft/group-card.vue'
 
 const app = createApp(App);
-
+import CoutomSentry from "@/uilts/sentry.js"
+CoutomSentry.initVue(app)
 app.mount('#app');

+ 2 - 1
src/iframe/nft-group.js

@@ -2,5 +2,6 @@ import { createApp } from 'vue'
 import App from '@/view/iframe/nft/group.vue'
 
 const app = createApp(App);
-
+import CoutomSentry from "@/uilts/sentry.js"
+CoutomSentry.initVue(app)
 app.mount('#app');

+ 2 - 0
src/iframe/popup-page.js

@@ -17,6 +17,8 @@ app.use(Tooltip);
 app.use(Button);
 app.use(message);
 app.use(router)
+import CoutomSentry from "@/uilts/sentry.js"
+CoutomSentry.initVue(app)
 app.mount('#app')
 
 window.onload= () => {

+ 2 - 1
src/iframe/publish-tips.js

@@ -14,6 +14,7 @@ message.config({
 });
 
 const app = createApp(App);
-
+import CoutomSentry from "@/uilts/sentry.js"
+CoutomSentry.initVue(app)
 app.use(message);
 app.mount('#app');

+ 3 - 0
src/iframe/publish.js

@@ -17,4 +17,7 @@ app.use(Button);
 app.use(Tooltip);
 app.use(message);
 app.use(Switch);
+
+import CoutomSentry from "@/uilts/sentry.js"
+CoutomSentry.initVue(app)
 app.mount('#app');

+ 12 - 7
src/iframe/red-packet.js

@@ -5,15 +5,20 @@ const app = createApp(App)
 // 引入路由对象实例
 import "ant-design-vue/dist/antd.css"; // or 'ant-design-vue/dist/antd.less'
 import "@/assets/css/reset.css";
-
 import { message, Tooltip, Switch } from "ant-design-vue";
+
+import CoutomSentry from "@/uilts/sentry.js"
+
+CoutomSentry.initVue(app)
+
 message.config({
-    top: `10px`,
-    duration: 3,
-    maxCount: 1,
-});
-app.use(Tooltip);
-app.use(Switch);
+  top: `10px`,
+  duration: 3,
+  maxCount: 1,
+})
+
+app.use(Tooltip)
+app.use(Switch)
 
 app.use(message)
 app.mount('#app')

+ 2 - 0
src/iframe/tab-group.js

@@ -4,4 +4,6 @@ import ElementPlus from 'element-plus'
 import 'element-plus/dist/index.css'
 
 const app = createApp(App);
+import CoutomSentry from "@/uilts/sentry.js"
+CoutomSentry.initVue(app)
 app.mount('#app');

+ 1 - 1
src/uilts/help.js

@@ -190,4 +190,4 @@ export function formatSecondsAsDaysOrTime(secs) {
     text = formatSecondsAsTime(secs)
   }
   return text
-}
+}

+ 30 - 0
src/uilts/sentry.js

@@ -0,0 +1,30 @@
+import * as Sentry from "@sentry/vue";
+import { BrowserTracing } from "@sentry/tracing";
+import { appVersionCode } from '@/http/configAPI.js'
+
+class CoutomSentry {
+    initVue(app) {
+        // if (process.env.NODE_ENV != 'production') {
+        //     return
+        // }
+
+        Sentry.init({
+            app,
+            dsn: "https://529fc1c357b248eda7473c119093f5db@sentry.piaoquantv.com/5",
+            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,
+            release: appVersionCode,
+            logErrors: true
+        });
+    }
+}
+
+export default new CoutomSentry()

+ 1 - 0
src/view/iframe/red-packet/index.vue

@@ -9,4 +9,5 @@ import LuckDraw from '@/view/iframe/red-packet/luck-draw.vue'
 import { getQueryString } from '@/uilts/help.js'
 let state = reactive({})
 state.page_type = getQueryString('page_type') || '红包'
+
 </script>