forked from MetaMask/metamask-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement configurable sentry (MetaMask#1548)
Implement configurable sentry (MetaMask#1548)
- Loading branch information
Vlad Lobachov
authored
Sep 18, 2024
1 parent
282ec01
commit 0cd1786
Showing
7 changed files
with
159 additions
and
29 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
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import * as path from "path"; | ||
|
||
const SentryPlugin = () => { | ||
return { | ||
name: "docusaurus-plugin-sentry", | ||
getClientModules() { | ||
return [path.resolve(__dirname, "./sentry")]; | ||
}, | ||
configureWebpack() { | ||
return { | ||
resolve: { | ||
alias: { | ||
"sentry-plugin": path.resolve(__dirname, "./sentry.ts"), | ||
}, | ||
}, | ||
}; | ||
}, | ||
}; | ||
}; | ||
|
||
export default SentryPlugin; |
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"name": "docusaurus-plugin-sentry", | ||
"version": "1.0.0", | ||
"description": "A Sentry plugin to initialize the Sentry SDK", | ||
"main": "index.ts", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"keywords": [ | ||
"docusaurus-plugin", | ||
"sentry-plugin", | ||
"sentry" | ||
], | ||
"author": "Vlad Lo.", | ||
"license": "MIT" | ||
} |
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import ExecutionEnvironment from "@docusaurus/ExecutionEnvironment"; | ||
import siteConfig from "@generated/docusaurus.config"; | ||
import * as Sentry from "@sentry/browser"; | ||
|
||
const isProd = process.env.NODE_ENV === "production"; | ||
|
||
export default (function () { | ||
if (!ExecutionEnvironment.canUseDOM) { | ||
return null; | ||
} | ||
|
||
const { SENTRY_KEY } = siteConfig.customFields; | ||
|
||
Sentry.init({ | ||
dsn: SENTRY_KEY as string, | ||
replaysOnErrorSampleRate: isProd ? 1.0 : 0, | ||
replaysSessionSampleRate: isProd ? 1.0 : 0, | ||
sampleRate: isProd ? 0.25 : 0, | ||
tracesSampleRate: 0, | ||
debug: !isProd, | ||
}); | ||
|
||
Sentry.replayIntegration({ | ||
maskAllText: false, | ||
}); | ||
|
||
return Sentry; | ||
})(); |
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