Add telemetry
This commit is contained in:
parent
4cdd0cbd40
commit
a919b04cf0
3 changed files with 137 additions and 0 deletions
|
|
@ -11,6 +11,8 @@ import { HistoryView } from "./views/history/history-view";
|
|||
import { StatusBar } from "./views/status-bar/status-bar";
|
||||
import { LogsView } from "./views/logs/logs-view";
|
||||
import { StatusDescription } from "./views/status-description/status-description";
|
||||
import * as Sentry from "@sentry/browser";
|
||||
import { init as plausibleInit } from "@plausible-analytics/tracker";
|
||||
import {
|
||||
SyncClient,
|
||||
rateLimit,
|
||||
|
|
@ -50,6 +52,49 @@ export default class VaultLinkPlugin extends Plugin {
|
|||
|
||||
const isDebugBuild = process.env.NODE_ENV === "development";
|
||||
|
||||
if (!isDebugBuild) {
|
||||
plausibleInit({
|
||||
domain: "vault-link",
|
||||
endpoint: "https://stats.schmelczer.dev/status",
|
||||
autoCapturePageviews: true,
|
||||
captureOnLocalhost: true,
|
||||
logging: true
|
||||
});
|
||||
|
||||
Sentry.init({
|
||||
dsn: "https://56accd39d92442e788a457a04623cf57@bugs.schmelczer.dev/1",
|
||||
skipBrowserExtensionCheck: false
|
||||
});
|
||||
|
||||
const onError = (event: ErrorEvent): void => {
|
||||
Sentry.captureException(event.error, {
|
||||
extra: {
|
||||
message: event.message,
|
||||
filename: event.filename,
|
||||
lineno: event.lineno,
|
||||
colno: event.colno
|
||||
}
|
||||
});
|
||||
};
|
||||
window.addEventListener("error", onError);
|
||||
this.disposables.push(() => {
|
||||
window.removeEventListener("error", onError);
|
||||
});
|
||||
|
||||
const onUnhandledRejection = (
|
||||
event: PromiseRejectionEvent
|
||||
): void => {
|
||||
Sentry.captureException(event.reason);
|
||||
};
|
||||
window.addEventListener("unhandledrejection", onUnhandledRejection);
|
||||
this.disposables.push(() => {
|
||||
window.removeEventListener(
|
||||
"unhandledrejection",
|
||||
onUnhandledRejection
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
const debugOptions = isDebugBuild
|
||||
? {
|
||||
fetch: debugging.slowFetchFactory(1),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue