Sentry 高级使用教程
阅读原文时间:2023年07月08日阅读:2

Sentry 高级使用教程

Sentry versions

https://github.com/getsentry/sentry-docs

https://github.com/getsentry/sentry-docs/edit/master/src/docs/product/releases/index.mdx

版本控制

https://docs.sentry.io/product/releases/

https://docs.sentry.io/platform-redirect/?next=/configuration/releases/

https://docs.sentry.io/platforms/javascript/#configure

https://docs.sentry.io/platforms/javascript/sourcemaps/

https://docs.sentry.io/platforms/javascript/sourcemaps/#capturing-source-maps

process.env.SENTRY_AUTH_TOKEN

https://docs.sentry.io/product/integrations/integration-platform/#internal-integrations

sentry-cli

https://docs.sentry.io/product/cli/configuration/

webpack

https://docs.sentry.io/platforms/javascript/sourcemaps/tools/webpack/

$ yarn add -D @sentry/webpack-plugin

$ yarn add --dev @sentry/webpack-plugin


// webpack.config.js

const SentryWebpackPlugin = require("@sentry/webpack-plugin");

module.exports = {
  // other configuration
  configureWebpack: {
    plugins: [
      new SentryWebpackPlugin({
        // sentry-cli configuration
        authToken: process.env.SENTRY_AUTH_TOKEN,
        org: "fullstack-web",
        project: "react-app",

        // webpack specific configuration
        include: ".",
        ignore: ["node_modules", "webpack.config.js"],
      }),
    ],
  },
};

https://docs.sentry.io/product/releases/health/

问题,追责

https://docs.sentry.io/product/error-monitoring/issue-owners/

import * as Sentry from '@sentry/browser';
import { Vue as VueIntegration } from '@sentry/integrations';

import ErrorHandler from './ErrorHandler.js';

import * as PACKAGE from '../package.json';
// const PACKAGE = require('../package.json');

// package 是保留关键字,不能使用
// import * as package from '../package.json';
// const package = require('../package.json');

console.log(' package.name =', PACKAGE.name);
console.log(' package.version =', PACKAGE.version);
// console.log(' package.name =', package.name);
// console.log(' package.version =', package.version);

// const isDev = process.env.BABEL_ENV === 'development';
// const isProd = process.env.NODE_ENV === 'production';
// const env = process.env.NODE_ENV === 'production' ? true : false;
const env = process.env.NODE_ENV === 'production' ? 'prod' : 'dev';

Sentry.init({
    // To set your release version
    release: `$${PACKAGE.name}_${env}@${PACKAGE.version}`,
    // release: `$${package.name}_${env}@${package.version}`,
    // release: "my-project-name@" + process.env.npm_package_version,
    dsn: 'https://666ed2b5eb51410dbe24f05e67fc999@sentry.xgqfrms//110',
    integrations: [new VueIntegration({Vue, attachProps: true, logErrors: true})],
});

const errorHandler = new ErrorHandler('vue_error');

Vue.config.errorHandler = (err, vm, info) => errorHandler.onError(err, vm, info);

if(env === 'dev') {
    // 测试
    setTimeout(() => {
        console.log('window.Vue; =', window.Vue);
        throw new Error(' Sentry Vue Error 测试!');
    }, 3000);
}

http://eslint.org/docs/rules/

Parsing error: package is a reserved word in strict mode

https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Reserved_words

未来保留关键字

以下关键字只在严格模式中被当成保留关键字:

implements

interface

let

package

private

protected

public

static

sourcemap 关联、issue 关联、release 控制

https://segmentfault.com/a/1190000014683598



xgqfrms 2012-2020

www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!


手机扫一扫

移动阅读更方便

阿里云服务器
腾讯云服务器
七牛云服务器

你可能感兴趣的文章