래퍼런스
https://docs.sentry.io/platforms/java/
sentry.io/settings/projects/java-spring-boot/install/java-spring-boot/
https://docs.sentry.io/platforms/java/guides/spring-boot/performance/instrumentation/custom-instrumentation/
sentry는 애플리케이션의 에러 및 예외를 모니터링하고 수집하여 분석할 수 있는 오픈소스 기반의 오류 추적 및 모니터링 도구이다.
에러가 발생하면 핸들러를 통해 처리할 수 있다.
implementation 'io.sentry:sentry-spring-boot-starter:6.17.0'
implementation 'io.sentry:sentry-logback:6.17.0'
DSN 은 Data Source Name
의 약자로 Sentry와 클라이언트 애플리케이션 간의 통신을 위한 Endpoint URL이다.
애플리케이션에서 발생한 에러를 전송한다.
DSN 주소를 복사후 yml 추가한다.
sentry:
dsn: [복사한 dsn 주소]
몇가지 추가한 yml 설정
sentry:
#debug: true # 디버그 모드
enable-tracing: true
send-default-pii: true # 사용자 정보 기록
environment: development # 개발환경 / environment=production
logging: # 범위
minimum-event-level: "WARN"
minimum-breadcrumb-level: "INFO"
dsn: https://56ab2b3b2d344c9cac66ca3d3fa4efe1@o4504986976124928.ingest.sentry.io/4504986986217472
sample-rate: 1 # 샘플링 비율 1=100% 다 보냄
#traces-sample-rate # 트랜잭션 비율 설정
핸들러 처리가 안되었을 경우
핸들러 처리를 했을 경우
이메일에 알림도 온다.
slack을 연동하거나 웹훅을 이용해서 팀원에게 알림을 보낼수도 있다.
에러 메세지
간단하게 익센션 발생시
@PostMapping("/bootpaytest")
public String bootpaytest(@RequestBody String json){
try {
throw new RuntimeException();
} catch (Exception e) {
logger.error("Error occurred while processing JSON data+ jonnnnnnnnnnnnnnnnnnnnn\n\n" + json, e);
}
return "json";
}
결제 정보를 확인해봤다.