From 5ee4f013ff9776790e3a7f4e7a76708e45ba966a Mon Sep 17 00:00:00 2001 From: mrjvs Date: Fri, 21 Apr 2023 20:49:47 +0200 Subject: [PATCH] Sentry integration Co-authored-by: Jip Frijlink --- package.json | 2 + src/index.tsx | 1 + src/setup/constants.ts | 2 + src/setup/sentry.tsx | 15 +++++++ yarn.lock | 97 +++++++++++++++++++++++++++++++++++++++++- 5 files changed, 115 insertions(+), 2 deletions(-) create mode 100644 src/setup/sentry.tsx diff --git a/package.json b/package.json index 2223761f..31c7f631 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,8 @@ "@formkit/auto-animate": "^1.0.0-beta.5", "@headlessui/react": "^1.5.0", "@react-spring/web": "^9.7.1", + "@sentry/integrations": "^7.49.0", + "@sentry/react": "^7.49.0", "@use-gesture/react": "^10.2.24", "core-js": "^3.29.1", "crypto-js": "^4.1.1", diff --git a/src/index.tsx b/src/index.tsx index 1ba12d5e..d47668e7 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -9,6 +9,7 @@ import { registerSW } from "virtual:pwa-register"; import App from "@/setup/App"; import "@/setup/ga"; +import "@/setup/sentry"; import "@/setup/i18n"; import "@/setup/index.css"; import "@/backend"; diff --git a/src/setup/constants.ts b/src/setup/constants.ts index 927aecbc..f8a1cc59 100644 --- a/src/setup/constants.ts +++ b/src/setup/constants.ts @@ -2,3 +2,5 @@ export const APP_VERSION = import.meta.env.PACKAGE_VERSION; export const DISCORD_LINK = "https://discord.gg/Jhqt4Xzpfb"; export const GITHUB_LINK = "https://github.com/movie-web/movie-web"; export const GA_ID = "G-44YVXRL61C"; +export const SENTRY_DSN = + "https://b267ab7d52674c23af4e4e6cf2956251@o4505053491167232.ingest.sentry.io/4505053495296000"; diff --git a/src/setup/sentry.tsx b/src/setup/sentry.tsx new file mode 100644 index 00000000..417a0d4c --- /dev/null +++ b/src/setup/sentry.tsx @@ -0,0 +1,15 @@ +import * as Sentry from "@sentry/react"; +import { CaptureConsole, HttpClient } from "@sentry/integrations"; +import { SENTRY_DSN } from "@/setup/constants"; +import { conf } from "@/setup/config"; + +Sentry.init({ + dsn: SENTRY_DSN, + release: `movie-web@${conf().APP_VERSION}`, + sampleRate: 0.5, + integrations: [ + new Sentry.BrowserTracing(), + new CaptureConsole(), + new HttpClient(), + ], +}); diff --git a/yarn.lock b/yarn.lock index 48e68bc8..25213135 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1301,6 +1301,80 @@ estree-walker "^2.0.2" picomatch "^2.3.1" +"@sentry-internal/tracing@7.49.0": + version "7.49.0" + resolved "https://registry.yarnpkg.com/@sentry-internal/tracing/-/tracing-7.49.0.tgz#f589de565370884b9a13f82c98463de9b2d25dcd" + integrity sha512-ESh3+ZneQk/3HESTUmIPNrW5GVPu/HrRJU+eAJJto74vm+6vP7zDn2YV2gJ1w18O/37nc7W/bVCgZJlhZ3cwew== + dependencies: + "@sentry/core" "7.49.0" + "@sentry/types" "7.49.0" + "@sentry/utils" "7.49.0" + tslib "^1.9.3" + +"@sentry/browser@7.49.0": + version "7.49.0" + resolved "https://registry.yarnpkg.com/@sentry/browser/-/browser-7.49.0.tgz#5ce1cdb8d883c129d9a4e313c08a54c5ada4661b" + integrity sha512-x2DekKkQoY7/dhBzE4J25mdQ978NtPBTVQb+uZqlF/t5mp4K44TAszmPqy8lC/CmVHkp7qcpRGSCIzeboUL4KA== + dependencies: + "@sentry-internal/tracing" "7.49.0" + "@sentry/core" "7.49.0" + "@sentry/replay" "7.49.0" + "@sentry/types" "7.49.0" + "@sentry/utils" "7.49.0" + tslib "^1.9.3" + +"@sentry/core@7.49.0": + version "7.49.0" + resolved "https://registry.yarnpkg.com/@sentry/core/-/core-7.49.0.tgz#340d059f5efeff1a3359fef66d0c8e34e79ac992" + integrity sha512-AlSnCYgfEbvK8pkNluUkmdW/cD9UpvOVCa+ERQswXNRkAv5aDGCL6Ihv6fnIajE++BYuwZh0+HwZUBVKTFzoZg== + dependencies: + "@sentry/types" "7.49.0" + "@sentry/utils" "7.49.0" + tslib "^1.9.3" + +"@sentry/integrations@^7.49.0": + version "7.49.0" + resolved "https://registry.yarnpkg.com/@sentry/integrations/-/integrations-7.49.0.tgz#e123f687e0abe10d3428027e3879ce231503fc2f" + integrity sha512-qsEVkcZjw+toFGnzsVo+Cozz+hMK9LugzkfJyOFL+CyiEx9MfkEmsvRpZe1ETEWKe/VZylYU27NQzl6UNuAUjw== + dependencies: + "@sentry/types" "7.49.0" + "@sentry/utils" "7.49.0" + localforage "^1.8.1" + tslib "^1.9.3" + +"@sentry/react@^7.49.0": + version "7.49.0" + resolved "https://registry.yarnpkg.com/@sentry/react/-/react-7.49.0.tgz#9a31808d4232d3010019e09d7c706b3d4fe54960" + integrity sha512-s+ROJr1tP9zVBmoOn94JM+fu2TuoJKxkSXTEUOKoQ9P6P5ROzpDqTzHRGk6u4OjZTy5tftRyEqBGM2Iaf9Y+UA== + dependencies: + "@sentry/browser" "7.49.0" + "@sentry/types" "7.49.0" + "@sentry/utils" "7.49.0" + hoist-non-react-statics "^3.3.2" + tslib "^1.9.3" + +"@sentry/replay@7.49.0": + version "7.49.0" + resolved "https://registry.yarnpkg.com/@sentry/replay/-/replay-7.49.0.tgz#c7f16bc3ca0c5911f641738f8894eb596c5da00d" + integrity sha512-UY3bHoBDPOu4Dpq3m3oxNjLrq09NiFVYUfrTN4QOq1Am2SA04XbuCj/YZ+jNVy/NrFtoz9cTovK6oQbNw53jog== + dependencies: + "@sentry/core" "7.49.0" + "@sentry/types" "7.49.0" + "@sentry/utils" "7.49.0" + +"@sentry/types@7.49.0": + version "7.49.0" + resolved "https://registry.yarnpkg.com/@sentry/types/-/types-7.49.0.tgz#2c217091e13dc373682f5be2e9b5baed9d2ae695" + integrity sha512-9yXXh7iv76+O6h2ONUVx0wsL1auqJFWez62mTjWk4350SgMmWp/zUkBxnVXhmcYqscz/CepC+Loz9vITLXtgxg== + +"@sentry/utils@7.49.0": + version "7.49.0" + resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-7.49.0.tgz#b1b3a2af52067dd27e660c7c3062a31cdf4b94f9" + integrity sha512-JdC9yGnOgev4ISJVwmIoFsk8Zx0psDZJAj2DV7x4wMZsO6QK+YjC7G3mUED/S5D5lsrkBZ/3uvQQhr8DQI4UcQ== + dependencies: + "@sentry/types" "7.49.0" + tslib "^1.9.3" + "@surma/rollup-plugin-off-main-thread@^2.2.3": version "2.2.3" resolved "https://registry.yarnpkg.com/@surma/rollup-plugin-off-main-thread/-/rollup-plugin-off-main-thread-2.2.3.tgz#ee34985952ca21558ab0d952f00298ad2190c053" @@ -3143,7 +3217,7 @@ hls.js@^1.0.7: resolved "https://registry.yarnpkg.com/hls.js/-/hls.js-1.3.5.tgz#0e8b0799ecf2feb7ba199f5e95f35ba9552e04f4" integrity sha512-uybAvKS6uDe0MnWNEPnO0krWVr+8m2R0hJ/viql8H3MVK+itq8gGQuIYoFHL3rECkIpNH98Lw8YuuWMKZxp3Ew== -hoist-non-react-statics@^3.1.0: +hoist-non-react-statics@^3.1.0, hoist-non-react-statics@^3.3.2: version "3.3.2" resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz#ece0acaf71d62c2969c2ec59feff42a4b1a85b45" integrity sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw== @@ -3217,6 +3291,11 @@ ignore@^5.2.0: resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.2.4.tgz#a291c0c6178ff1b960befe47fcdec301674a6324" integrity sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ== +immediate@~3.0.5: + version "3.0.6" + resolved "https://registry.yarnpkg.com/immediate/-/immediate-3.0.6.tgz#9db1dbd0faf8de6fbe0f5dd5e56bb606280de69b" + integrity sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ== + import-fresh@^3.0.0, import-fresh@^3.2.1: version "3.3.0" resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.3.0.tgz#37162c25fcb9ebaa2e6e53d5b4d88ce17d9e0c2b" @@ -3642,6 +3721,13 @@ 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 sha512-RiNhHysUjhrDQntfYSfY4MU24coXXdEOgw9WGcKHNeEwffDYbF//u87M1EWaMGzuFoSbqW0C9C6lEEhDOAswfw== + dependencies: + immediate "~3.0.5" + lilconfig@^2.0.5, lilconfig@^2.0.6: version "2.1.0" resolved "https://registry.yarnpkg.com/lilconfig/-/lilconfig-2.1.0.tgz#78e23ac89ebb7e1bfbf25b18043de756548e7f52" @@ -3652,6 +3738,13 @@ local-pkg@^0.4.2: resolved "https://registry.yarnpkg.com/local-pkg/-/local-pkg-0.4.3.tgz#0ff361ab3ae7f1c19113d9bb97b98b905dbc4963" integrity sha512-SFppqq5p42fe2qcZQqqEOiVRXl+WCP1MdT6k7BDEW1j++sp5fIY+/fdRQitvKgB5BrBcmrs5m/L0v2FrU5MY1g== +localforage@^1.8.1: + version "1.10.0" + resolved "https://registry.yarnpkg.com/localforage/-/localforage-1.10.0.tgz#5c465dc5f62b2807c3a84c0c6a1b1b3212781dd4" + integrity sha512-14/H1aX7hzBBmmh7sGPd+AOMkkIrHM3Z1PAyGgZigA1H1p5O5ANnMyWzvpAETtG68/dC4pC0ncy3+PPGzXZHPg== + dependencies: + lie "3.1.1" + locate-path@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-6.0.0.tgz#55321eb309febbc59c4801d931a72452a681d286" @@ -5021,7 +5114,7 @@ tsconfig-paths@^3.14.1: minimist "^1.2.6" strip-bom "^3.0.0" -tslib@^1.8.1: +tslib@^1.8.1, 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==