sentry 前端监控配置

使用sentry 监控前端报错

在这里插入图片描述
1.先创建项目

2.关联叮叮报警

将叮叮机器人token填入
在这里插入图片描述
3.寻找叮叮token 这里可能需要权限 找找就有了填入上面在这里插入图片描述

4,项目配置

使用 “@sentry/webpack-plugin”: “^1.12.1”,
安装

使用

webpack 项目
const SentryCliPlugin = require("@sentry/webpack-plugin");

//条件自己定义 根据情况来设置是否开启
if (config.build.sentry && config.build.sentry.user) {
  console.log('SentryCliPlugin','线上');
  webpackConfig.plugins.push(
    new SentryCliPlugin({
      include: "./dist",
      ignore: ["node_modules"],
      configFile: "./.sentryclirc",
      release: config.build.sentry.release, // 版本号
      environment: config.build.sentry.environment,
      deleteAfterCompile: true,
      ext: ["map"]
    })
  );
}

vue项目

vue.config.js
const SentryPlugin = require('@sentry/webpack-plugin');

module.exports = {
   
    chainWebpack: config => {
 
           config.plugin('sentry').use(SentryPlugin, [{
               ignore: ['node_modules'],
               include: './dist', // 上传dist文件的js
               configFile: './.sentryclirc', // 配置文件地址
               release: PZ.RELEASE_SENTRY, // 版本号
               environment: PZ.ENVIRONMENT,
               deleteAfterCompile: true
           }]);
        
    },
    
};

5.配置sentryclirc文件

根目录下新建 .sentryclirc 文件

[defaults]
url = http://10.300.48.120:9000/ //监控地址
org = sentry  //项目团队
project = jingtian //项目名称

[auth]
token = x x x x x x

6.上面的token取
创建一个

在这里插入图片描述

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值