sentry-browser-sdk은(는) 무엇을 하나요?
브라우저 JavaScript를 위한 완전한 Sentry SDK 설정입니다. '웹사이트에 Sentry 추가', '@sentry/browser 설치', 또는 순수 JavaScript, jQuery, 정적 사이트, WordPress에서 오류 모니터링, 추적, 세션 리플레이, 로깅을 구성하라는 요청이 있을 때 사용하세요.
설치
npm install @sentry/browser
# 또는
yarn add @sentry/browser
# 또는
pnpm add @sentry/browser
기본 설정
import * as Sentry from '@sentry/browser';
Sentry.init({
dsn: 'https://[email protected]/0',
integrations: [
Sentry.browserTracingIntegration(),
Sentry.replayIntegration(),
],
// 성능 추적을 위한 샘플링 비율 설정
tracesSampleRate: 1.0,
// 세션 리플레이 설정
replaysSessionSampleRate: 0.1,
replaysOnErrorSampleRate: 1.0,
});
오류 보고
try {
// 오류가 발생할 수 있는 코드
} catch (error) {
Sentry.captureException(error);
}