Skip to content

Commit

Permalink
feat: Replace NewRelic with self-hosted Sentry instead.
Browse files Browse the repository at this point in the history
  • Loading branch information
itssimple committed May 25, 2022
1 parent bf3611e commit 1b94d2b
Show file tree
Hide file tree
Showing 13 changed files with 234 additions and 34 deletions.
7 changes: 6 additions & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@
"game_ids": [21812]
},
"externally_connectable": {
"matches": ["https://www.bungie.net", "https://o2g.itssimple.se", "https://bam.eu01.nr-data.net"]
"matches": [
"https://www.bungie.net",
"https://o2g.itssimple.se",
"https://bam.eu01.nr-data.net",
"https://sentry.nolifeking85.tv"
]
},
"protocol_override_domains": { "googlesyndication": "http" },
"start_window": "background",
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
"typescript": "^4.6.2"
},
"dependencies": {
"@sentry/browser": "^6.19.7",
"@sentry/react": "^6.19.7",
"@sentry/tracing": "^6.19.7",
"react": "^17.0.2",
"react-dom": "^17.0.2"
}
Expand Down
7 changes: 6 additions & 1 deletion src/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@
"game_ids": [21812]
},
"externally_connectable": {
"matches": ["https://www.bungie.net", "https://o2g.itssimple.se", "https://bam.eu01.nr-data.net"]
"matches": [
"https://www.bungie.net",
"https://o2g.itssimple.se",
"https://bam.eu01.nr-data.net",
"https://sentry.nolifeking85.tv"
]
},
"protocol_override_domains": { "googlesyndication": "http" },
"start_window": "background",
Expand Down
13 changes: 13 additions & 0 deletions src/scripts/background.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
import * as Sentry from "@sentry/browser";
import { BrowserTracing } from "@sentry/tracing";

Sentry.init({
dsn: "https://cd1d4d46d6b14f3ea41d6ede28ad95a7@sentry.nolifeking85.tv/2",
integrations: [new BrowserTracing()],

// Set tracesSampleRate to 1.0 to capture 100%
// of transactions for performance monitoring.
// We recommend adjusting this value in production
tracesSampleRate: 1.0,
});

import { log } from "./log.js";
import { EventEmitter } from "./eventEmitter.js";
import { Destiny2Database } from "./indexedDB.js";
Expand Down
7 changes: 6 additions & 1 deletion src/scripts/eventEmitter.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,12 @@ export class EventEmitter {
this.eventListeners
.filter((ev) => ev.eventName == eventName)
.forEach(async (l) => {
await l.handler(...params);
try {
await l.handler(...params);
} catch (e) {
log("EVENT:ERROR", e);
reject(e);
}
});

resolve(true);
Expand Down
36 changes: 29 additions & 7 deletions src/scripts/react/Loading.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,20 @@

import React, { useEffect } from "react";
import ReactDOM from "react-dom";

import * as Sentry from "@sentry/react";
import { BrowserTracing } from "@sentry/tracing";

Sentry.init({
dsn: "https://cd1d4d46d6b14f3ea41d6ede28ad95a7@sentry.nolifeking85.tv/2",
integrations: [new BrowserTracing()],

// Set tracesSampleRate to 1.0 to capture 100%
// of transactions for performance monitoring.
// We recommend adjusting this value in production
tracesSampleRate: 1.0,
});

import { LoadingIndicator } from "./components/loadingIndicator";

import { DestinyApiClient } from "../destiny2/apiClient";
Expand Down Expand Up @@ -43,13 +57,21 @@ function LoadingWindow() {
}

loadingActivity.textContent = "Loading data...";
destinyApiClient.loadDataFromStorage().then(() => {
loadingActivity.textContent = "Loading data... done";
setTimeout(() => {
loadingActivity.textContent = "Opening application...";
eventEmitter.emit("manifests-loaded");
}, 1000);
});
destinyApiClient
.loadDataFromStorage()
.then(() => {
loadingActivity.textContent = "Loading data... done";
setTimeout(() => {
loadingActivity.textContent = "Opening application...";
eventEmitter.emit("manifests-loaded");
}, 1000);
})
.catch((error) => {
loadingActivity.textContent = "Loading data... failed. Try again later";
setTimeout(() => {
eventEmitter.emit("shutdown", error);
}, 5000);
});
});
});
}
Expand Down
13 changes: 13 additions & 0 deletions src/scripts/react/MainWindow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,19 @@
import React, { useEffect } from "react";
import ReactDOM from "react-dom";

import * as Sentry from "@sentry/react";
import { BrowserTracing } from "@sentry/tracing";

Sentry.init({
dsn: "https://cd1d4d46d6b14f3ea41d6ede28ad95a7@sentry.nolifeking85.tv/2",
integrations: [new BrowserTracing()],

// Set tracesSampleRate to 1.0 to capture 100%
// of transactions for performance monitoring.
// We recommend adjusting this value in production
tracesSampleRate: 1.0,
});

import "../../public/css/bootstrap.min.css";
import "../../public/css/main-window.css";
import "../../public/css/window-styles.css";
Expand Down
13 changes: 13 additions & 0 deletions src/scripts/react/Overlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,19 @@
import React, { useEffect, useState } from "react";
import ReactDOM from "react-dom";

import * as Sentry from "@sentry/react";
import { BrowserTracing } from "@sentry/tracing";

Sentry.init({
dsn: "https://cd1d4d46d6b14f3ea41d6ede28ad95a7@sentry.nolifeking85.tv/2",
integrations: [new BrowserTracing()],

// Set tracesSampleRate to 1.0 to capture 100%
// of transactions for performance monitoring.
// We recommend adjusting this value in production
tracesSampleRate: 1.0,
});

import { Titlebar } from "./Overlay/Titlebar";
import { EventEmitter } from "../eventEmitter";
import { GoalList } from "./Overlay/GoalList";
Expand Down
20 changes: 14 additions & 6 deletions src/windows/background-window.html

Large diffs are not rendered by default.

19 changes: 13 additions & 6 deletions src/windows/loading-window.html

Large diffs are not rendered by default.

19 changes: 13 additions & 6 deletions src/windows/main-window.html

Large diffs are not rendered by default.

19 changes: 13 additions & 6 deletions src/windows/overlay-window.html

Large diffs are not rendered by default.

92 changes: 92 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1117,6 +1117,81 @@
estree-walker "^1.0.1"
picomatch "^2.2.2"

"@sentry/browser@6.19.7", "@sentry/browser@^6.19.7":
version "6.19.7"
resolved "https://registry.yarnpkg.com/@sentry/browser/-/browser-6.19.7.tgz#a40b6b72d911b5f1ed70ed3b4e7d4d4e625c0b5f"
integrity sha512-oDbklp4O3MtAM4mtuwyZLrgO1qDVYIujzNJQzXmi9YzymJCuzMLSRDvhY83NNDCRxf0pds4DShgYeZdbSyKraA==
dependencies:
"@sentry/core" "6.19.7"
"@sentry/types" "6.19.7"
"@sentry/utils" "6.19.7"
tslib "^1.9.3"

"@sentry/core@6.19.7":
version "6.19.7"
resolved "https://registry.yarnpkg.com/@sentry/core/-/core-6.19.7.tgz#156aaa56dd7fad8c89c145be6ad7a4f7209f9785"
integrity sha512-tOfZ/umqB2AcHPGbIrsFLcvApdTm9ggpi/kQZFkej7kMphjT+SGBiQfYtjyg9jcRW+ilAR4JXC9BGKsdEQ+8Vw==
dependencies:
"@sentry/hub" "6.19.7"
"@sentry/minimal" "6.19.7"
"@sentry/types" "6.19.7"
"@sentry/utils" "6.19.7"
tslib "^1.9.3"

"@sentry/hub@6.19.7":
version "6.19.7"
resolved "https://registry.yarnpkg.com/@sentry/hub/-/hub-6.19.7.tgz#58ad7776bbd31e9596a8ec46365b45cd8b9cfd11"
integrity sha512-y3OtbYFAqKHCWezF0EGGr5lcyI2KbaXW2Ik7Xp8Mu9TxbSTuwTe4rTntwg8ngPjUQU3SUHzgjqVB8qjiGqFXCA==
dependencies:
"@sentry/types" "6.19.7"
"@sentry/utils" "6.19.7"
tslib "^1.9.3"

"@sentry/minimal@6.19.7":
version "6.19.7"
resolved "https://registry.yarnpkg.com/@sentry/minimal/-/minimal-6.19.7.tgz#b3ee46d6abef9ef3dd4837ebcb6bdfd01b9aa7b4"
integrity sha512-wcYmSJOdvk6VAPx8IcmZgN08XTXRwRtB1aOLZm+MVHjIZIhHoBGZJYTVQS/BWjldsamj2cX3YGbGXNunaCfYJQ==
dependencies:
"@sentry/hub" "6.19.7"
"@sentry/types" "6.19.7"
tslib "^1.9.3"

"@sentry/react@^6.19.7":
version "6.19.7"
resolved "https://registry.yarnpkg.com/@sentry/react/-/react-6.19.7.tgz#58cc2d6da20f7d3b0df40638dfbbbc86c9c85caf"
integrity sha512-VzJeBg/v41jfxUYPkH2WYrKjWc4YiMLzDX0f4Zf6WkJ4v3IlDDSkX6DfmWekjTKBho6wiMkSNy2hJ1dHfGZ9jA==
dependencies:
"@sentry/browser" "6.19.7"
"@sentry/minimal" "6.19.7"
"@sentry/types" "6.19.7"
"@sentry/utils" "6.19.7"
hoist-non-react-statics "^3.3.2"
tslib "^1.9.3"

"@sentry/tracing@^6.19.7":
version "6.19.7"
resolved "https://registry.yarnpkg.com/@sentry/tracing/-/tracing-6.19.7.tgz#54bb99ed5705931cd33caf71da347af769f02a4c"
integrity sha512-ol4TupNnv9Zd+bZei7B6Ygnr9N3Gp1PUrNI761QSlHtPC25xXC5ssSD3GMhBgyQrcvpuRcCFHVNNM97tN5cZiA==
dependencies:
"@sentry/hub" "6.19.7"
"@sentry/minimal" "6.19.7"
"@sentry/types" "6.19.7"
"@sentry/utils" "6.19.7"
tslib "^1.9.3"

"@sentry/types@6.19.7":
version "6.19.7"
resolved "https://registry.yarnpkg.com/@sentry/types/-/types-6.19.7.tgz#c6b337912e588083fc2896eb012526cf7cfec7c7"
integrity sha512-jH84pDYE+hHIbVnab3Hr+ZXr1v8QABfhx39KknxqKWr2l0oEItzepV0URvbEhB446lk/S/59230dlUUIBGsXbg==

"@sentry/utils@6.19.7":
version "6.19.7"
resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-6.19.7.tgz#6edd739f8185fd71afe49cbe351c1bbf5e7b7c79"
integrity sha512-z95ECmE3i9pbWoXQrD/7PgkBAzJYR+iXtPuTkpBjDKs86O3mT+PXOT3BAn79w2wkn7/i3vOGD2xVr1uiMl26dA==
dependencies:
"@sentry/types" "6.19.7"
tslib "^1.9.3"

"@sindresorhus/is@^4.0.0":
version "4.6.0"
resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-4.6.0.tgz#3c7c9c46e678feefe7a2e5bb609d3dbd665ffb3f"
Expand Down Expand Up @@ -4054,6 +4129,13 @@ has@^1.0.3:
dependencies:
function-bind "^1.1.1"

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==
dependencies:
react-is "^16.7.0"

home-or-tmp@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/home-or-tmp/-/home-or-tmp-2.0.0.tgz#e36c3f2d2cae7d746a857e38d18d5f32a7882db8"
Expand Down Expand Up @@ -6257,6 +6339,11 @@ react-dom@^17.0.2:
object-assign "^4.1.1"
scheduler "^0.20.2"

react-is@^16.7.0:
version "16.13.1"
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4"
integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==

react@^17.0.2:
version "17.0.2"
resolved "https://registry.yarnpkg.com/react/-/react-17.0.2.tgz#d0b5cc516d29eb3eee383f75b62864cfb6800037"
Expand Down Expand Up @@ -7380,6 +7467,11 @@ trim-right@^1.0.1:
resolved "https://registry.yarnpkg.com/trim-right/-/trim-right-1.0.1.tgz#cb2e1203067e0c8de1f614094b9fe45704ea6003"
integrity sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM=

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==

tslib@^2.2.0:
version "2.3.1"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.3.1.tgz#e8a335add5ceae51aa261d32a490158ef042ef01"
Expand Down

0 comments on commit 1b94d2b

Please sign in to comment.