Skip to content
Snippets Groups Projects
Commit b10a6711 authored by Will Hunt's avatar Will Hunt
Browse files

Add sentry support

parent cb80b81f
No related branches found
No related tags found
No related merge requests found
...@@ -11,6 +11,8 @@ ...@@ -11,6 +11,8 @@
"vite": "^2.7.2" "vite": "^2.7.2"
}, },
"dependencies": { "dependencies": {
"@sentry/browser": "^7.5.0",
"@sentry/tracing": "^7.5.0",
"hydrogen-view-sdk": "^0.0.13" "hydrogen-view-sdk": "^0.0.13"
} }
} }
...@@ -7,6 +7,9 @@ import workerPath from "hydrogen-view-sdk/main.js?url"; ...@@ -7,6 +7,9 @@ import workerPath from "hydrogen-view-sdk/main.js?url";
import olmWasmPath from "@matrix-org/olm/olm.wasm?url"; import olmWasmPath from "@matrix-org/olm/olm.wasm?url";
import olmJsPath from "@matrix-org/olm/olm.js?url"; import olmJsPath from "@matrix-org/olm/olm.js?url";
import olmLegacyJsPath from "@matrix-org/olm/olm_legacy.js?url"; import olmLegacyJsPath from "@matrix-org/olm/olm_legacy.js?url";
import * as Sentry from "@sentry/browser";
import { BrowserTracing } from "@sentry/tracing";
const assetPaths = { const assetPaths = {
downloadSandbox: downloadSandboxPath, downloadSandbox: downloadSandboxPath,
worker: workerPath, worker: workerPath,
...@@ -41,6 +44,25 @@ async function main() { ...@@ -41,6 +44,25 @@ async function main() {
} }
root.className = "hydrogen"; root.className = "hydrogen";
const config = await fetchConfig(); const config = await fetchConfig();
if (config.sentry) {
Sentry.init({
dsn: config.sentry.dsn,
release: "my-project-name@2.3.12",
integrations: [new BrowserTracing()],
});
Sentry.setTag("homeserver", config.homeserver);
Sentry.setTag("encrypt_room", config.encrypt_room);
if (config.invite_user) {
Sentry.setTag("mode", "invite_user");
} else if (config.auto_join_room) {
Sentry.setTag("mode", "auto_join_room");
} else {
Sentry.setTag("mode", "unknown");
}
}
const platform = new Platform({container: root, assetPaths, config: {}, options: { development: import.meta.env.DEV }}); const platform = new Platform({container: root, assetPaths, config: {}, options: { development: import.meta.env.DEV }});
const navigation = new Navigation(allowsChild); const navigation = new Navigation(allowsChild);
platform.setNavigation(navigation); platform.setNavigation(navigation);
...@@ -65,6 +87,9 @@ function allowsChild(parent, child) { ...@@ -65,6 +87,9 @@ function allowsChild(parent, child) {
function hideOnError() { function hideOnError() {
// When an error occurs, log it and then hide everything! // When an error occurs, log it and then hide everything!
const handler = e => { const handler = e => {
Sentry.captureException(e, {
})
if (e.message === "ResizeObserver loop completed with undelivered notifications." || if (e.message === "ResizeObserver loop completed with undelivered notifications." ||
e.message === "ResizeObserver loop limit exceeded" || e.message === "ResizeObserver loop limit exceeded" ||
// hydrogen renders an <img> with src = undefined while the image is being decrypted // hydrogen renders an <img> with src = undefined while the image is being decrypted
......
...@@ -15,6 +15,13 @@ export interface IChatterboxConfig { ...@@ -15,6 +15,13 @@ export interface IChatterboxConfig {
token: string; token: string;
// URL of the image that should be used as the users avatar // URL of the image that should be used as the users avatar
avatar: string; avatar: string;
// Configure this to enable Sentry (sentry.io) tracing.
sentry?: {
// The DSN URL where Sentry reports will be sent.
dsn: string;
// The environment to report to Sentry. E.g. "staging", "production"
environment: string;
}
} }
interface IHeader { interface IHeader {
......
...@@ -6,6 +6,58 @@ ...@@ -6,6 +6,58 @@
version "3.2.3" version "3.2.3"
resolved "https://gitlab.matrix.org/api/v4/projects/27/packages/npm/@matrix-org/olm/-/@matrix-org/olm-3.2.3.tgz#cc332fdd25c08ef0e40f4d33fc3f822a0f98b6f4" resolved "https://gitlab.matrix.org/api/v4/projects/27/packages/npm/@matrix-org/olm/-/@matrix-org/olm-3.2.3.tgz#cc332fdd25c08ef0e40f4d33fc3f822a0f98b6f4"
"@sentry/browser@^7.5.0":
version "7.5.0"
resolved "https://registry.yarnpkg.com/@sentry/browser/-/browser-7.5.0.tgz#1ac651117625c732de58cfbd46dd9cf302212e42"
integrity sha512-tTtccbqYti8liTuLudTI0Qrgpe3sKajm0lwsMN4tb1YE879a9JiQ6U6kZ1G/fOIMjOm09pE7J8ozQ+FihPHw5g==
dependencies:
"@sentry/core" "7.5.0"
"@sentry/types" "7.5.0"
"@sentry/utils" "7.5.0"
tslib "^1.9.3"
"@sentry/core@7.5.0":
version "7.5.0"
resolved "https://registry.yarnpkg.com/@sentry/core/-/core-7.5.0.tgz#4ccc2312017fc6158cc379f5828dc6bbe2cdf1f7"
integrity sha512-2KO2hVUki3WgvPlB0qj9+yea56CmsK2b1XtBSyAnqbs+JiXWgerF4qshVsH52kS/1h2B0CisyeIv64/WfuGvQQ==
dependencies:
"@sentry/hub" "7.5.0"
"@sentry/types" "7.5.0"
"@sentry/utils" "7.5.0"
tslib "^1.9.3"
"@sentry/hub@7.5.0":
version "7.5.0"
resolved "https://registry.yarnpkg.com/@sentry/hub/-/hub-7.5.0.tgz#30801accb9475cc3f155802a3fefd218d66fbfda"
integrity sha512-R3jGEOtRtZaYCswSNs/7SmjOj/Pp8BhRyXk4q0a5GXghbuVAdzZvlJH0XnD/6jOJAF0iSXFuyGSLqVUmjkY9Ow==
dependencies:
"@sentry/types" "7.5.0"
"@sentry/utils" "7.5.0"
tslib "^1.9.3"
"@sentry/tracing@^7.5.0":
version "7.5.0"
resolved "https://registry.yarnpkg.com/@sentry/tracing/-/tracing-7.5.0.tgz#ad6da27563246e9d754c36a2a3d398cfb979117e"
integrity sha512-tSVnCJNImsWms4tBhJ2Xr+HI1i9zKg4eZ0dImi93/H3sf5hmK9r2E11Xs/8rTxqpGWzB8axVi2tcmqmfqXKGTg==
dependencies:
"@sentry/hub" "7.5.0"
"@sentry/types" "7.5.0"
"@sentry/utils" "7.5.0"
tslib "^1.9.3"
"@sentry/types@7.5.0":
version "7.5.0"
resolved "https://registry.yarnpkg.com/@sentry/types/-/types-7.5.0.tgz#610f14c1219ba461ca84a3c89e06de8c0cf357bc"
integrity sha512-VPQ/53mLo5N8NQUB4k6R2GQBWoW8otFyhhPnC75gYXeBTItVCzJAylVyWy8b+gGqGst+pQN3wb2dl9xhrd69YQ==
"@sentry/utils@7.5.0":
version "7.5.0"
resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-7.5.0.tgz#64435ea094aa7d79d1dfe7586d2d5a2bff9e3839"
integrity sha512-DgHrkGgHplVMgMbU9hGBfGBV6LcOwNBrhHiVaFwo2NHiXnGwMkaILi5XTRjKm9Iu/m2choAFABA80HEtPKmjtA==
dependencies:
"@sentry/types" "7.5.0"
tslib "^1.9.3"
another-json@^0.2.0: another-json@^0.2.0:
version "0.2.0" version "0.2.0"
resolved "https://registry.yarnpkg.com/another-json/-/another-json-0.2.0.tgz#b5f4019c973b6dd5c6506a2d93469cb6d32aeedc" resolved "https://registry.yarnpkg.com/another-json/-/another-json-0.2.0.tgz#b5f4019c973b6dd5c6506a2d93469cb6d32aeedc"
...@@ -238,6 +290,11 @@ supports-preserve-symlinks-flag@^1.0.0: ...@@ -238,6 +290,11 @@ supports-preserve-symlinks-flag@^1.0.0:
resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09" resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09"
integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w== integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==
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==
typescript@^4.4.4: typescript@^4.4.4:
version "4.5.5" version "4.5.5"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.5.5.tgz#d8c953832d28924a9e3d37c73d729c846c5896f3" resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.5.5.tgz#d8c953832d28924a9e3d37c73d729c846c5896f3"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment