Start of sentry integration

This commit is contained in:
Tony Giorgio
2024-06-05 13:43:57 -05:00
committed by Tony Giorgio
parent 0da0dce559
commit 2b18c9568d
5 changed files with 179 additions and 6 deletions

View File

@@ -13,4 +13,4 @@ VITE_FEEDBACK="https://feedback.mutinywallet.com"
VITE_SCORER="https://scorer.mutinywallet.com"
VITE_PRIMAL="https://primal-cache.mutinywallet.com/api"
VITE_BLIND_AUTH="https://blind-auth.mutinywallet.com"
VITE_HERMES="https://mutiny.plus"
VITE_HERMES="https://mutiny.plus"

View File

@@ -33,11 +33,11 @@
"tailwindcss": "^3.4.1",
"typescript": "^5.4.5",
"vite": "^5.2.10",
"vite-plugin-comlink": "^4.0.3",
"vite-plugin-pwa": "^0.19.8",
"vite-plugin-solid": "^2.10.2",
"vite-plugin-wasm": "^3.3.0",
"workbox-window": "^7.0.0",
"vite-plugin-comlink": "^4.0.3"
"workbox-window": "^7.0.0"
},
"dependencies": {
"@capacitor-mlkit/barcode-scanning": "^6.0.0",
@@ -55,12 +55,15 @@
"@capacitor/toast": "^6.0.0",
"@kobalte/core": "^0.12.6",
"@kobalte/tailwindcss": "^0.9.0",
"@mutinywallet/mutiny-wasm": "1.7.5",
"@modular-forms/solid": "^0.20.0",
"@mutinywallet/mutiny-wasm": "1.7.5",
"@sentry/browser": "^8.7.0",
"@sentry/wasm": "^8.7.0",
"@solid-primitives/upload": "^0.0.117",
"@solidjs/meta": "^0.29.3",
"@solidjs/router": "^0.13.1",
"capacitor-secure-storage-plugin": "^0.9.0",
"comlink": "^4.4.1",
"i18next": "^23.10.1",
"i18next-browser-languagedetector": "^7.2.0",
"i18next-http-backend": "^2.5.0",
@@ -68,8 +71,7 @@
"qr-scanner": "^1.4.2",
"solid-js": "^1.8.16",
"solid-qr-code": "^0.0.8",
"solid-transition-group": "^0.2.3",
"comlink": "^4.4.1"
"solid-transition-group": "^0.2.3"
},
"engines": {
"node": ">=18"

87
pnpm-lock.yaml generated
View File

@@ -56,6 +56,12 @@ dependencies:
'@mutinywallet/mutiny-wasm':
specifier: 1.7.5
version: 1.7.5
'@sentry/browser':
specifier: ^8.7.0
version: 8.7.0
'@sentry/wasm':
specifier: ^8.7.0
version: 8.7.0
'@solid-primitives/upload':
specifier: ^0.0.117
version: 0.0.117(solid-js@1.8.16)
@@ -2399,6 +2405,87 @@ packages:
dev: true
optional: true
/@sentry-internal/browser-utils@8.7.0:
resolution: {integrity: sha512-RFBK1sYBwV5qGMEwWF0rjOTqQpp4/SvE+qHkOJNRUTVYmfjM+Y9lcxwn4B6lu3aboxePpBw/i1PlP6XwX4UnGA==}
engines: {node: '>=14.18'}
dependencies:
'@sentry/core': 8.7.0
'@sentry/types': 8.7.0
'@sentry/utils': 8.7.0
dev: false
/@sentry-internal/feedback@8.7.0:
resolution: {integrity: sha512-qcGtWCtRB4eP7NVQoxW936oPkU4qu9otMLYELPGmOJPnuAG0lujlJXW7BucaM7ADyJgJTE75hG849bHecfnbmQ==}
engines: {node: '>=14.18'}
dependencies:
'@sentry/core': 8.7.0
'@sentry/types': 8.7.0
'@sentry/utils': 8.7.0
dev: false
/@sentry-internal/replay-canvas@8.7.0:
resolution: {integrity: sha512-FOnvBPbq6MJVHPduc0hcsdE3PeeovQ2z5WJnZDGhvp/Obehxqe+XgX7K/595vRIknv4EokRn/3Kw0mFwG8E+ZQ==}
engines: {node: '>=14.18'}
dependencies:
'@sentry-internal/replay': 8.7.0
'@sentry/core': 8.7.0
'@sentry/types': 8.7.0
'@sentry/utils': 8.7.0
dev: false
/@sentry-internal/replay@8.7.0:
resolution: {integrity: sha512-bQzOkWplaWTe3u+aDBhxWY3Qy0aT7ss2A3VR8iC6N8ZIEP9PxqyJwTNoouhinfgmlnCguI7RDOO4f3r3e2M80Q==}
engines: {node: '>=14.18'}
dependencies:
'@sentry-internal/browser-utils': 8.7.0
'@sentry/core': 8.7.0
'@sentry/types': 8.7.0
'@sentry/utils': 8.7.0
dev: false
/@sentry/browser@8.7.0:
resolution: {integrity: sha512-4EEp+PlcktsMN0p+MdCPl/lghTkq7eOtZjQG9NGhWzfyWrJ3tuL1nsDr2SSivJ1V277F01KtKYo6BFwP2NtBZA==}
engines: {node: '>=14.18'}
dependencies:
'@sentry-internal/browser-utils': 8.7.0
'@sentry-internal/feedback': 8.7.0
'@sentry-internal/replay': 8.7.0
'@sentry-internal/replay-canvas': 8.7.0
'@sentry/core': 8.7.0
'@sentry/types': 8.7.0
'@sentry/utils': 8.7.0
dev: false
/@sentry/core@8.7.0:
resolution: {integrity: sha512-Sq/46B+5nWmgnCD6dEMZ6HTkKbV/KAdgaSvT8oXDb9OWoPy1jJ/gbLrhLs62KbjuDQk4/vWnOgHiKQbcslSzMw==}
engines: {node: '>=14.18'}
dependencies:
'@sentry/types': 8.7.0
'@sentry/utils': 8.7.0
dev: false
/@sentry/types@8.7.0:
resolution: {integrity: sha512-11KLOKumP6akugVGLvSoEig+JlP0ZEzW3nN9P+ppgdIx9HAxMIh6UvumbieG4/DWjAh2kh6NPNfUw3gk2Gfq1A==}
engines: {node: '>=14.18'}
dev: false
/@sentry/utils@8.7.0:
resolution: {integrity: sha512-aWmcbSoOmrbzll/FkNQFJcCtLAuJLvTYbRKiCSkV3FScA7UaA742HkTZAPFiioALFIESWk/fcGZqtN0s4I281Q==}
engines: {node: '>=14.18'}
dependencies:
'@sentry/types': 8.7.0
dev: false
/@sentry/wasm@8.7.0:
resolution: {integrity: sha512-kxzSR/H7A+h8c28gN4vivrukdk6wphf2Oz0MVQd18up1Fbwqmy226hCuAqZgw7aaPI4gfwatEQFm0Higghr9tA==}
engines: {node: '>=14.18'}
dependencies:
'@sentry/browser': 8.7.0
'@sentry/core': 8.7.0
'@sentry/types': 8.7.0
'@sentry/utils': 8.7.0
dev: false
/@solid-primitives/event-listener@2.3.3(solid-js@1.8.16):
resolution: {integrity: sha512-DAJbl+F0wrFW2xmcV8dKMBhk9QLVLuBSW+TR4JmIfTaObxd13PuL7nqaXnaYKDWOYa6otB00qcCUIGbuIhSUgQ==}
peerDependencies:

View File

@@ -1,9 +1,11 @@
// Inspired by https://github.com/solidjs/solid-realworld/blob/main/src/store/index.js
import { MutinyBalance, TagItem } from "@mutinywallet/mutiny-wasm";
import * as Sentry from "@sentry/browser";
import { useNavigate, useSearchParams } from "@solidjs/router";
import { SecureStoragePlugin } from "capacitor-secure-storage-plugin";
import { Remote } from "comlink";
import {
DEV,
createContext,
onCleanup,
onMount,
@@ -41,10 +43,42 @@ type LoadStage =
export type WalletWorker = Remote<typeof import("../workers/walletWorker")>;
const RELEASE_VERSION = import.meta.env.__RELEASE_VERSION__;
const sentryenv = import.meta.env.VITE_SENTRY_ENVIRONMENT || (DEV ? "dev" : "prod");
export const makeMegaStoreContext = () => {
const [searchParams] = useSearchParams();
const navigate = useNavigate();
// initialize both inside worker and outside
// TODO figure out when to set or not
Sentry.init({
dsn: "https://192c556849619517322719962a057376@sen.mutinywallet.com/2",
environment: sentryenv,
release: "mutiny-web@" + RELEASE_VERSION,
integrations: [
Sentry.browserTracingIntegration(),
Sentry.replayIntegration()
],
initialScope: {
tags: { component: "main" }
},
// Set tracesSampleRate to 1.0 to capture 100%
// of transactions for performance monitoring.
// We recommend adjusting this value in production
tracesSampleRate: 1.0,
// Set `tracePropagationTargets` to control for which URLs distributed tracing should be enabled
tracePropagationTargets: ["localhost", /^https:\/\/mutinywallet\.com/],
// Capture Replay for 10% of all sessions,
// plus 100% of sessions with an error
replaysSessionSampleRate: 0.1,
replaysOnErrorSampleRate: 1.0
});
// Not actually a shared worker, but it's the same code
const sw = new ComlinkWorker<typeof import("../workers/walletWorker")>(
new URL("../workers/walletWorker", import.meta.url),

View File

@@ -1,3 +1,4 @@
import { DEV } from "solid-js";
import initMutinyWallet, {
ActivityItem,
BudgetPeriod,
@@ -17,6 +18,7 @@ import initMutinyWallet, {
PendingNwcInvoice,
TagItem
} from "@mutinywallet/mutiny-wasm";
import * as Sentry from "@sentry/browser";
import { IActivityItem } from "~/components";
import { MutinyWalletSettingStrings } from "~/logic/mutinyWalletSetup";
@@ -26,6 +28,9 @@ import {
MutinyFederationIdentity
} from "~/routes/settings";
const RELEASE_VERSION = import.meta.env.__RELEASE_VERSION__;
const sentryenv = import.meta.env.VITE_SENTRY_ENVIRONMENT || (DEV ? "dev" : "prod");
// For some reason {...invoice } doesn't bring across the paid field
function destructureInvoice(invoice: MutinyInvoice): MutinyInvoice {
return {
@@ -95,6 +100,51 @@ export async function setupMutinyWallet(
shouldZapHodl?: boolean,
nsec?: string
): Promise<boolean> {
// initialize both inside worker and outside
// TODO figure out when to set or not
Sentry.init({
dsn: "https://192c556849619517322719962a057376@sen.mutinywallet.com/2",
environment: sentryenv,
release: "mutiny-web@" + RELEASE_VERSION,
integrations: [
Sentry.captureConsoleIntegration(), // grab all mutiny-node console lines
Sentry.browserTracingIntegration(),
Sentry.replayIntegration()
],
initialScope: {
tags: { component: "worker" }
},
// ignore any hex larger than 20 char
ignoreErrors: [/(?:[0-9a-fA-F]{20,}\b)+/],
// only do a new issue for errors w/ or w/o exceptions, and warnings
beforeSend(event, hint) {
const error = hint.originalException;
if (error && error.message) {
return event;
} else if (event.level == "warning" || event.level == "error") {
return event;
} else {
return null;
}
},
// Set tracesSampleRate to 1.0 to capture 100%
// of transactions for performance monitoring.
// We recommend adjusting this value in production
tracesSampleRate: 1.0,
// Set `tracePropagationTargets` to control for which URLs distributed tracing should be enabled
tracePropagationTargets: ["localhost", /^https:\/\/mutinywallet\.com/],
// Capture Replay for 10% of all sessions,
// plus 100% of sessions with an error
replaysSessionSampleRate: 0.1,
replaysOnErrorSampleRate: 1.0
});
console.log("Starting setup...");
const {