umi-plugin-sentry-react
v0.0.2
Published
umi项目接入监控快捷配置,支持umi3.x和umi4.x
Downloads
3
Readme
umi-plugin-sentry-react
umi项目接入监控快捷配置,支持umi3.x和umi4.x
Install
pnpm i umi-plugin-sentry-react
Usage
配置.umirc.ts
, 启用插件
export default {
plugins: [
['umi-plugin-sentry-react'],
],
sentry: {
sourceMap: { ... }
}
}
Options
sourceMap: 同@sentry/webpack-plugin
配置sourceMap且环境为production时启用sourcemap上传
Initialize
在src
目录下创建app.js
文件,并导出getSentryInitConfig用于初始化sentry
export function getSentryInitConfig() {
return {
dsn: 'your-dsn',
integrations: [
// 根据自己项目使用的router版本选择对应的integration
Sentry.reactRouterV6BrowserTracingIntegration({
useEffect: React.useEffect,
useLocation,
useNavigationType,
createRoutesFromChildren,
matchRoutes
}),
Sentry.browserTracingIntegration(),
Sentry.replayIntegration({
maskAllText: false,
blockAllMedia: false,
}),
rewriteFramesIntegration()
],
// Performance Monitoring
tracesSampleRate: 1.0, // Capture 100% of the transactions
// Session Replay
replaysSessionSampleRate: 1, // This sets the sample rate at 10%. You may want to change it to 100% while in development and then sample at a lower rate in production.
replaysOnErrorSampleRate: 1.0, // If you're not already sampling the entire session, change the sample rate to 100% when sampling sessions where errors occur.
}
}
LICENSE
MIT