소스 검색

[add][sentry]

zhangwei 2 년 전
부모
커밋
8056178107

+ 2 - 2
package.json

@@ -11,8 +11,8 @@
     "build-watch": "vue-cli-service  --env.NODE_ENV=development build-watch --mode development"
   },
   "dependencies": {
-    "@sentry/tracing": "^7.3.1",
-    "@sentry/vue": "^7.3.1",
+    "@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

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

+ 2 - 15
src/entry/content_help.js

@@ -4,8 +4,7 @@ import {
 } from "@/logic/content/twitter.js";
 import { createApp } from 'vue'
 import ViewMessage from '@/view/content/message/index.vue'
-import * as Sentry from "@sentry/vue";
-import { BrowserTracing } from "@sentry/tracing";
+import CoutomSentry from "@/uilts/sentry.js"
 
 const addDomMessage = (element) => {
     const div = document.createElement('div')
@@ -13,19 +12,7 @@ const addDomMessage = (element) => {
     document.body.appendChild(div)
     let app = createApp(element)
     app.mount('#denet_message')
-    Sentry.init({
-        app,
-        dsn: "http://529fc1c357b248eda7473c119093f5db@sentry.denet.me/5",
-        integrations: [
-            new BrowserTracing({
-                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,
-    });
+    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');

+ 6 - 20
src/iframe/red-packet.js

@@ -7,32 +7,18 @@ 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 * as Sentry from "@sentry/vue";
-import { BrowserTracing } from "@sentry/tracing";
+import CoutomSentry from "@/uilts/sentry.js"
 
-// if (process.env.NODE_ENV === 'production') {
-Sentry.init({
-  app,
-  dsn: "http://529fc1c357b248eda7473c119093f5db@sentry.denet.me/5",
-  integrations: [
-    new BrowserTracing({
-      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,
-});
-// }
+CoutomSentry.initVue(app)
 
 message.config({
   top: `10px`,
   duration: 3,
   maxCount: 1,
-});
-app.use(Tooltip);
-app.use(Switch);
+})
+
+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');

+ 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()

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

@@ -9,8 +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') || '红包'
-setTimeout(() => {
-    console.log(gggggg)    
-}, 5000);
 
 </script>