梗概

  • 一套web app的错误日志监测方案
  • 可以在捕获app中的错误,并上传到sentry后台服务器

使用教程

详细教程

Sentry (vue3 vite)前端监控搭建进阶指南(纯干货) - 掘金

示例

向sentry上报数据

child::

export default defineConfig(({ command, mode }) => {
 
  const config: UserConfig = {
    plugins: [
      command === 'build'
        ? sentryVitePlugin({
            url: 'https://newsentry.qidian.com/',
            org: 'yue',
            project: 'zhuanti-web',
            // Auth tokens can be obtained from https://sentry.io/settings/account/api/auth-tokens/
            // and needs the `project:releases` and `org:read` scopes
            authToken: SENTRY_AUTH_TOKEN,
            release: env?.SENTRY_RELEASE,
            include: [
              {
                paths: ['./dist/server'],
                urlPrefix:
                  mode === 'production'
                    ? join(resolve(__dirname), 'dist/server')
                    : '/usr/local/trpc/bin/src/packages/m/dist/server',
              },
            ],
          })
        : null,
      command === 'build'
        ? sentryVitePlugin({
            url: 'https://newsentry.qidian.com/',
            org: 'yue',
            project: 'zhuanti-web',
            // Auth tokens can be obtained from https://sentry.io/settings/account/api/auth-tokens/
            // and needs the `project:releases` and `org:read` scopes
            authToken: SENTRY_AUTH_TOKEN,
            release: env?.SENTRY_RELEASE,
            include: [
              {
                paths: ['./dist/client'],
                urlPrefix: mode === 'production' ? '~/' : env.VITE_BASE,
              },
            ],
          })
        : null,
    ],
  }
  return config
})
 
指向原始笔记的链接

father:: 错误监测

child:: sentry_看板工具