From c02e26cf1f46177c1d88aa08420f88ca6f014f81 Mon Sep 17 00:00:00 2001 From: qier222 <68148142+qier222@users.noreply.github.com> Date: Thu, 22 Oct 2020 01:46:15 +0800 Subject: [PATCH] chore: add Sentry to track issues --- package.json | 5 ++- src/main.js | 29 ++++++++++++++-- yarn.lock | 97 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 127 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index ddb5346..ad45210 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "music-app", + "name": "YesPlayMusic", "version": "0.1.0", "private": true, "scripts": { @@ -8,6 +8,9 @@ "lint": "vue-cli-service lint" }, "dependencies": { + "@sentry/browser": "^5.27.0", + "@sentry/integrations": "^5.27.0", + "@sentry/tracing": "^5.27.0", "axios": "^0.20.0", "core-js": "^3.6.5", "crypto-js": "^4.0.0", diff --git a/src/main.js b/src/main.js index dd8958d..4f009fb 100644 --- a/src/main.js +++ b/src/main.js @@ -3,24 +3,47 @@ import VueAnalytics from "vue-analytics"; import App from "./App.vue"; import router from "./router"; import store from "./store"; -import i18n from '@/locale'; +import i18n from "@/locale"; import "@/assets/icons"; import "@/utils/filters"; import { initMediaSession } from "@/utils/mediaSession"; import "./registerServiceWorker"; +import * as Sentry from "@sentry/browser"; +import { Vue as VueIntegration } from "@sentry/integrations"; +import { Integrations } from "@sentry/tracing"; + Vue.use(VueAnalytics, { id: "UA-180189423-1", - router, + router }); Vue.config.productionTip = false; initMediaSession(); +if (process.env.VUE_APP_ENABLE_SENTRY === "true") { + console.log("VUE_APP_ENABLE_SENTRY"); + Sentry.init({ + dsn: + "https://30aaa25152974f48971912a394ab6bc3@o436528.ingest.sentry.io/5477409", + integrations: [ + new VueIntegration({ + Vue, + tracing: true + }), + new Integrations.BrowserTracing() + ], + + // We recommend adjusting this value in production, or using tracesSampler + // for finer control + tracesSampleRate: 1.0 + }); +} + new Vue({ i18n, store, router, - render: (h) => h(App), + render: h => h(App) }).$mount("#app"); diff --git a/yarn.lock b/yarn.lock index efd1ac5..807b1de 100644 --- a/yarn.lock +++ b/yarn.lock @@ -915,6 +915,79 @@ resolved "https://registry.npm.taobao.org/@nodelib/fs.stat/download/@nodelib/fs.stat-1.1.3.tgz#2b5a3ab3f918cca48a8c754c08168e3f03eba61b" integrity sha1-K1o6s/kYzKSKjHVMCBaOPwPrphs= +"@sentry/browser@^5.27.0": + version "5.27.0" + resolved "https://registry.yarnpkg.com/@sentry/browser/-/browser-5.27.0.tgz#35b77f076fb5f08c91eff23f3c067ee15df0ab90" + integrity sha512-AByUVSy5YctTxWGA6HaeTkZXDCmHbeurqLkR6U9h4HzEHZq3laxrYQ1HiWcaW1IgFDqZcEmD14kDOVY4GhF3QQ== + dependencies: + "@sentry/core" "5.27.0" + "@sentry/types" "5.27.0" + "@sentry/utils" "5.27.0" + tslib "^1.9.3" + +"@sentry/core@5.27.0": + version "5.27.0" + resolved "https://registry.yarnpkg.com/@sentry/core/-/core-5.27.0.tgz#661b2fd1beecaa37c013a6c364330fa29c847b3c" + integrity sha512-ddvAxVszsHzFzGedii1NxfKU3GxAEGJV5eXNlA2hqS0/OKl+IOjuI6aJjg55LMTEEejqr9djXqDMk6y5av6UKg== + dependencies: + "@sentry/hub" "5.27.0" + "@sentry/minimal" "5.27.0" + "@sentry/types" "5.27.0" + "@sentry/utils" "5.27.0" + tslib "^1.9.3" + +"@sentry/hub@5.27.0": + version "5.27.0" + resolved "https://registry.yarnpkg.com/@sentry/hub/-/hub-5.27.0.tgz#dcd7b36d216997f0283bd3334cbce8004d56ef89" + integrity sha512-Qe4nndgDEY8n3kKEWJTw5M201dgsoB9ZQ10483cVpGCtOfZZuzXEr4EaLG3BefH8YFvlgUP3YlxD7XFoJioRjg== + dependencies: + "@sentry/types" "5.27.0" + "@sentry/utils" "5.27.0" + tslib "^1.9.3" + +"@sentry/integrations@^5.27.0": + version "5.27.0" + resolved "https://registry.yarnpkg.com/@sentry/integrations/-/integrations-5.27.0.tgz#8760bd0827db07fc72f90026d64df88e653a9e28" + integrity sha512-iIphS8b/wz4RXzYd09eGnf5FuJzqAYo55NDPBpH2bN0hnIgshVFvRJe1rbo2sA+r8u+ODLvc3b6jvXB4gBupzA== + dependencies: + "@sentry/types" "5.27.0" + "@sentry/utils" "5.27.0" + localforage "1.8.1" + tslib "^1.9.3" + +"@sentry/minimal@5.27.0": + version "5.27.0" + resolved "https://registry.yarnpkg.com/@sentry/minimal/-/minimal-5.27.0.tgz#8c2fdcf9cd1e59d8ff1848a7905bac304f8e206b" + integrity sha512-KidWjo2jNd8IwPhEIDC0YddjwuIdVxTEsmpRkZ6afuiR5rMQsiqA0EwsndWiAjs67qxQRj/VD/1Xghxe0nHzXQ== + dependencies: + "@sentry/hub" "5.27.0" + "@sentry/types" "5.27.0" + tslib "^1.9.3" + +"@sentry/tracing@^5.27.0": + version "5.27.0" + resolved "https://registry.yarnpkg.com/@sentry/tracing/-/tracing-5.27.0.tgz#133b03a02640a0d63d11f341a00e96315c9d0303" + integrity sha512-h82VmO4loeWd5bMFgNWBO+eY6bEpPt5iRc1YZouC10fouhlzw2O4p2A4n1/rVQ+eIKAsfkkgsjEuKBnTPxDAsw== + dependencies: + "@sentry/hub" "5.27.0" + "@sentry/minimal" "5.27.0" + "@sentry/types" "5.27.0" + "@sentry/utils" "5.27.0" + tslib "^1.9.3" + +"@sentry/types@5.27.0": + version "5.27.0" + resolved "https://registry.yarnpkg.com/@sentry/types/-/types-5.27.0.tgz#cea288d02c727ef83541768b8738e6a829dfc831" + integrity sha512-coB2bMDxmzTwIWcXbzbnE2JtEqDkvmK9+KyZZNI/Mk3wwabFYqL7hOnqXB45/+hx+6l9/siWmB1l5um3tzqdOw== + +"@sentry/utils@5.27.0": + version "5.27.0" + resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-5.27.0.tgz#21c15401b43041b1208521465c09c64eafc2e0ff" + integrity sha512-XrdoxOsjqF9AVmeCefNgY0r3lvZBj34bzsG3TI8Z1bjQKB3iF/2yAI/bdo+sUqAiJiiPSk5p6SiPkyeTsSdBhg== + dependencies: + "@sentry/types" "5.27.0" + tslib "^1.9.3" + "@soda/friendly-errors-webpack-plugin@^1.7.1": version "1.7.1" resolved "https://registry.npm.taobao.org/@soda/friendly-errors-webpack-plugin/download/@soda/friendly-errors-webpack-plugin-1.7.1.tgz#706f64bcb4a8b9642b48ae3ace444c70334d615d" @@ -4581,6 +4654,11 @@ image-size@^0.5.1: resolved "https://registry.yarnpkg.com/image-size/-/image-size-0.5.5.tgz#09dfd4ab9d20e29eb1c3e80b8990378df9e3cb9c" integrity sha1-Cd/Uq50g4p6xw+gLiZA3jfnjy5w= +immediate@~3.0.5: + version "3.0.6" + resolved "https://registry.yarnpkg.com/immediate/-/immediate-3.0.6.tgz#9db1dbd0faf8de6fbe0f5dd5e56bb606280de69b" + integrity sha1-nbHb0Pr43m++D13V5Wu2BigN5ps= + import-cwd@^2.0.0: version "2.1.0" resolved "https://registry.npm.taobao.org/import-cwd/download/import-cwd-2.1.0.tgz#aa6cf36e722761285cb371ec6519f53e2435b0a9" @@ -5244,6 +5322,13 @@ levn@^0.3.0, levn@~0.3.0: prelude-ls "~1.1.2" type-check "~0.3.2" +lie@3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/lie/-/lie-3.1.1.tgz#9a436b2cc7746ca59de7a41fa469b3efb76bd87e" + integrity sha1-mkNrLMd0bKWd56QfpGmz77dr2H4= + dependencies: + immediate "~3.0.5" + lines-and-columns@^1.1.6: version "1.1.6" resolved "https://registry.npm.taobao.org/lines-and-columns/download/lines-and-columns-1.1.6.tgz#1c00c743b433cd0a4e80758f7b64a57440d9ff00" @@ -5295,6 +5380,13 @@ loadjs@^4.2.0: resolved "https://registry.yarnpkg.com/loadjs/-/loadjs-4.2.0.tgz#2a0336376397a6a43edf98c9ec3229ddd5abb6f6" integrity sha512-AgQGZisAlTPbTEzrHPb6q+NYBMD+DP9uvGSIjSUM5uG+0jG15cb8axWpxuOIqrmQjn6scaaH8JwloiP27b2KXA== +localforage@1.8.1: + version "1.8.1" + resolved "https://registry.yarnpkg.com/localforage/-/localforage-1.8.1.tgz#f6c0a24b41ab33b10e4dc84342dd696f6f3e3433" + integrity sha512-azSSJJfc7h4bVpi0PGi+SmLQKJl2/8NErI+LhJsrORNikMZnhaQ7rv9fHj+ofwgSHrKRlsDCL/639a6nECIKuQ== + dependencies: + lie "3.1.1" + locate-path@^3.0.0: version "3.0.0" resolved "https://registry.npm.taobao.org/locate-path/download/locate-path-3.0.0.tgz#dbec3b3ab759758071b58fe59fc41871af21400e" @@ -8205,6 +8297,11 @@ tslib@^1.9.0: resolved "https://registry.npm.taobao.org/tslib/download/tslib-1.13.0.tgz?cache=0&sync_timestamp=1596753875166&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Ftslib%2Fdownload%2Ftslib-1.13.0.tgz#c881e13cc7015894ed914862d276436fa9a47043" integrity sha1-yIHhPMcBWJTtkUhi0nZDb6mkcEM= +tslib@^1.9.3: + version "1.14.1" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" + integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== + tty-browserify@0.0.0: version "0.0.0" resolved "https://registry.npm.taobao.org/tty-browserify/download/tty-browserify-0.0.0.tgz#a157ba402da24e9bf957f9aa69d524eed42901a6"