-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ask for diagnostic reporting on startup
- Loading branch information
1 parent
d87d1c9
commit 26ab58c
Showing
2 changed files
with
73 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,41 +48,6 @@ const sentryenv = import.meta.env.VITE_SENTRY_ENVIRONMENT || (DEV ? "dev" : ""); | |
export const makeMegaStoreContext = () => { | ||
const [searchParams] = useSearchParams(); | ||
const navigate = useNavigate(); | ||
const reportDiagnostics = | ||
localStorage.getItem("report_diagnostics") === "true"; | ||
|
||
// initialize both inside worker and outside | ||
if (reportDiagnostics && sentryenv !== "") { | ||
Sentry.init({ | ||
dsn: "https://[email protected]/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")>( | ||
|
@@ -123,7 +88,8 @@ export const makeMegaStoreContext = () => { | |
lang: localStorage.getItem("i18nexLng") || undefined, | ||
preferredInvoiceType: "unified" as "unified" | "lightning" | "onchain", | ||
should_zap_hodl: localStorage.getItem("should_zap_hodl") === "true", | ||
report_diagnostics: reportDiagnostics, | ||
report_diagnostics: | ||
localStorage.getItem("report_diagnostics") === "true", | ||
testflightPromptDismissed: | ||
localStorage.getItem("testflightPromptDismissed") === "true", | ||
federations: undefined as MutinyFederationIdentity[] | undefined, | ||
|
@@ -208,6 +174,41 @@ export const makeMegaStoreContext = () => { | |
const settings = await getSettings(); | ||
setState({ load_stage: "setup" }); | ||
|
||
const reportDiagnostics = | ||
localStorage.getItem("report_diagnostics") === "true"; | ||
|
||
if (reportDiagnostics && sentryenv !== "") { | ||
Sentry.init({ | ||
dsn: "https://[email protected]/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 | ||
}); | ||
} | ||
|
||
// handle lsp settings | ||
if (searchParams.lsps) { | ||
settings.lsp = ""; | ||
|
@@ -559,6 +560,14 @@ export const makeMegaStoreContext = () => { | |
); | ||
setState({ report_diagnostics }); | ||
}, | ||
setReportDiagnostics() { | ||
localStorage.setItem("report_diagnostics", "true"); | ||
setState({ report_diagnostics: true }); | ||
}, | ||
disableReportDiagnostics() { | ||
localStorage.setItem("report_diagnostics", "false"); | ||
setState({ report_diagnostics: false }); | ||
}, | ||
async refreshFederations() { | ||
const federations = await sw.list_federations(); | ||
|
||
|