Skip to content

Commit b171752

Browse files
authored
[MERGE] 메인서버의 애플리케이션 성능 측정을 위한 프로메테우스 의존성 추가
[MERGE] 메인서버의 애플리케이션 성능 측정을 위한 프로메테우스 의존성 추가
2 parents bddb53a + a96bb7d commit b171752

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

build.gradle

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ dependencies {
6969
// Spring Batch
7070
implementation 'org.springframework.boot:spring-boot-starter-batch'
7171

72+
// Monitoring
73+
implementation 'io.micrometer:micrometer-registry-prometheus'
74+
7275
}
7376

7477
//QueryDSL 초기 설정
@@ -100,4 +103,4 @@ configurations {
100103

101104
tasks.named('test') {
102105
useJUnitPlatform()
103-
}
106+
}

src/main/java/org/terning/terningserver/common/exception/GlobalExceptionHandler.java

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,25 +47,23 @@ public ResponseEntity<ErrorResponse> handleAuthException(JwtException e) {
4747
}
4848

4949
@ExceptionHandler(Exception.class)
50-
public ResponseEntity handleException(Exception e){
50+
public ResponseEntity<ErrorResponse> handleException(Exception e){
5151
log.warn("[Exception] cause: {} , message: {}", NestedExceptionUtils.getMostSpecificCause(e), e.getMessage());
5252
ErrorMessage errorCode = ErrorMessage.INTERNAL_SERVER_ERROR;
5353
return ResponseEntity
5454
.status(errorCode.getStatus())
5555
.body(ErrorResponse.of(errorCode.getStatus(), errorCode.getMessage()));
5656
}
5757

58-
//메소드가 잘못되었거나 부적합한 인수를 전달했을 경우 -> 필수 파라미터 없을 때
5958
@ExceptionHandler(IllegalArgumentException.class)
60-
public ResponseEntity handleIllegalArgumentException(IllegalArgumentException e){
59+
public ResponseEntity<ErrorResponse> handleIllegalArgumentException(IllegalArgumentException e){
6160
log.warn("[IlleagalArgumentException] cause: {} , message: {}", NestedExceptionUtils.getMostSpecificCause(e), e.getMessage());
6261
ErrorMessage errorCode = ErrorMessage.ILLEGAL_ARGUMENT_ERROR;
6362
return ResponseEntity
6463
.status(errorCode.getStatus())
6564
.body(ErrorResponse.of(errorCode.getStatus(), errorCode.getMessage()));
6665
}
6766

68-
//@Valid 유효성 검사에서 예외가 발생했을 때 -> requestbody에 잘못 들어왔을 때
6967
@ExceptionHandler(MethodArgumentNotValidException.class)
7068
public ResponseEntity<ErrorResponse> handleMethodArgumentNotValidException(MethodArgumentNotValidException e){
7169
log.warn("[MethodArgumentNotValidException] cause: {}, message: {}", NestedExceptionUtils.getMostSpecificCause(e), e.getMessage());
@@ -75,7 +73,6 @@ public ResponseEntity<ErrorResponse> handleMethodArgumentNotValidException(Metho
7573
.body(ErrorResponse.of(errorCode.getStatus(), errorCode.getMessage()));
7674
}
7775

78-
//잘못된 포맷 요청 -> Json으로 안보내다던지
7976
@ExceptionHandler(HttpMessageNotReadableException.class)
8077
public ResponseEntity<ErrorResponse> handleHttpMessageNotReadableException(HttpMessageNotReadableException e){
8178
log.warn("[HttpMessageNotReadableException] cause: {}, message: {}", NestedExceptionUtils.getMostSpecificCause(e), e.getMessage());
@@ -84,6 +81,7 @@ public ResponseEntity<ErrorResponse> handleHttpMessageNotReadableException(HttpM
8481
.status(errorCode.getStatus())
8582
.body(ErrorResponse.of(errorCode.getStatus(), errorCode.getMessage()));
8683
}
84+
8785
@ExceptionHandler(HttpRequestMethodNotSupportedException.class)
8886
public ResponseEntity<ErrorResponse> handleHttpMethodException(
8987
HttpRequestMethodNotSupportedException e,
@@ -95,5 +93,4 @@ public ResponseEntity<ErrorResponse> handleHttpMethodException(
9593
.status(errorCode.getStatus())
9694
.body(ErrorResponse.of(errorCode.getStatus(), errorCode.getMessage()));
9795
}
98-
}
99-
96+
}

0 commit comments

Comments
 (0)