Browse Source

add dbms-pool-status api

HANTE 3 weeks ago
parent
commit
81d6f6d78c

+ 0 - 4
utic-incident-common/src/main/java/com/utic/incident/common/annotation/DbmsElapsed.java

@@ -1,4 +0,0 @@
-package com.utic.incident.common.annotation;
-
-public @interface DbmsElapsed {
-}

+ 0 - 96
utic-incident-common/src/main/java/com/utic/incident/common/annotation/LoggingAspect.java

@@ -1,96 +0,0 @@
-package com.utic.incident.common.annotation;
-
-import lombok.extern.slf4j.Slf4j;
-
-@Slf4j
-//@Aspect
-//@Component
-public class LoggingAspect {
-//    public enum ProcessType {
-//        JOB_5MIN,
-//        DATA_PROCESSING,
-//        LOGGING
-//    }
-//
-//    @Retention(RetentionPolicy.RUNTIME)
-//    @Target(ElementType.METHOD)
-//    public @interface ProcessingElapsed {
-//        ProcessType[] value();
-//    }
-
-//    @Retention(RetentionPolicy.RUNTIME)
-//    @Target(ElementType.METHOD)
-//    public @interface ProcessingElapsed {
-//        String[] value();
-//    }
-
-
-//    private void logElapsedStart(String processName) {
-//        log.info("[05MIN...] ..... {}: [{}]", LogUtils.elapsedLog(processName + " 시작"), TimeUtils.getCurrentTimeString());
-//    }
-//    private void logElapsedTime(String processName, Elapsed elapsed) {
-//        log.info("[05MIN...] ..... {}", LogUtils.elapsedLog(processName + " 종료", elapsed.milliSeconds()));
-//    }
-
-//    @Around("@annotation(ProcessingElapsed)")
-//    public Object processingElapsedTime(ProceedingJoinPoint joinPoint) throws Throwable {
-//        MethodSignature signature = (MethodSignature)joinPoint.getSignature();
-//        ProcessingElapsed annotation = signature.getMethod().getAnnotation(ProcessingElapsed.class);
-//        String processName = annotation != null ? annotation.value() : "UNKNOWN_PROCESS";
-//
-//        long start = System.currentTimeMillis();
-//        Object proceed = joinPoint.proceed();
-//        long executionTime = System.currentTimeMillis() - start;
-//
-//        log.info("[05MIN...] {} 종료, 실행 시간: {} ms", processName, executionTime);
-//
-//        return proceed;
-//    }
-
-//    @Around("@annotation(ProcessingElapsed)")
-//    public Object logExecutionTime(ProceedingJoinPoint joinPoint) throws Throwable {
-//        MethodSignature signature = (MethodSignature) joinPoint.getSignature();
-//        ProcessingElapsed annotation = signature.getMethod().getAnnotation(ProcessingElapsed.class);
-//
-//        // 여러 개의 값 가져오기
-//        String processNames = annotation != null ? String.join(", ", annotation.value()) : "Unknown Process";
-//
-//        long start = System.currentTimeMillis();
-//        Object proceed = joinPoint.proceed();
-//        long executionTime = System.currentTimeMillis() - start;
-//
-//        log.info("[05MIN...] {} 종료, 실행 시간: {} ms", processNames, executionTime);
-//        return proceed;
-//    }
-//    @Around("@annotation(ProcessingElapsed)")
-//    public Object logExecutionTime2(ProceedingJoinPoint joinPoint) throws Throwable {
-//        MethodSignature signature = (MethodSignature) joinPoint.getSignature();
-//        ProcessingElapsed annotation = signature.getMethod().getAnnotation(ProcessingElapsed.class);
-//
-//        // 배열을 List로 변환
-//        List<String> processNameList = annotation != null ? Arrays.asList(annotation.value()) : Collections.emptyList();
-//        String processNames = String.join(", ", processNameList);
-//
-//        long start = System.currentTimeMillis();
-//        Object proceed = joinPoint.proceed();
-//        long executionTime = System.currentTimeMillis() - start;
-//
-//        log.info("[05MIN...] {} 종료, 실행 시간: {} ms", processNames, executionTime);
-//        return proceed;
-//    }
-//    @Around("@annotation(com.utic.com\.utic\.common\.common.annotation.ProcessingElapsed)")
-//    public Object logExecutionTime(ProceedingJoinPoint joinPoint) throws Throwable {
-//        MethodSignature signature = (MethodSignature) joinPoint.getSignature();
-//        ProcessingElapsed annotation = signature.getMethod().getAnnotation(ProcessingElapsed.class);
-//
-//        String processName = annotation != null ? annotation.processName() : "Unknown Process";
-//        String description = annotation != null ? annotation.description() : "No Description";
-//
-//        long start = System.currentTimeMillis();
-//        Object proceed = joinPoint.proceed();
-//        long executionTime = System.currentTimeMillis() - start;
-//
-//        log.info("[05MIN...] {} 종료, 실행 시간: {} ms (설명: {})", processName, executionTime, description);
-//        return proceed;
-//    }
-}

+ 0 - 4
utic-incident-common/src/main/java/com/utic/incident/common/annotation/ProcessElapsed.java

@@ -1,4 +0,0 @@
-package com.utic.incident.common.annotation;
-
-public @interface ProcessElapsed {
-}

+ 0 - 4
utic-incident-common/src/main/java/com/utic/incident/common/annotation/ScheduleElapsed.java

@@ -1,4 +0,0 @@
-package com.utic.incident.common.annotation;
-
-public @interface ScheduleElapsed {
-}

+ 1 - 1
utic-incident-common/src/main/java/com/utic/incident/common/annotation/SchedulingElapsed.java

@@ -9,6 +9,6 @@ import java.lang.annotation.Target;
 @Target(ElementType.METHOD)
 public @interface SchedulingElapsed {
     String type() default "-----";
-    String name() default "UNKNOWN_PROCESS";
+    String name() default "UNKNOWN_SCHEDULE";
 }
 

+ 6 - 6
utic-incident-common/src/main/java/com/utic/incident/common/annotation/SqlOperation.java

@@ -7,17 +7,17 @@ import java.lang.annotation.Target;
 
 
 
-// SQL 연산을 정의하는 사용자 지정 어노테이션
+// SQL 연산을 정의하는 사용자 지정 어노테이션
 @Target(ElementType.METHOD)
 @Retention(RetentionPolicy.RUNTIME)
 public @interface SqlOperation {
-    SqlType type();  // SQL 연산 타입
-    String table();  // 테이블 이름
-    String param() default "";  // 특정 파라미터명을 저장하는 속성 추가
-    String param2() default "";  // 특정 파라미터명을 저장하는 속성 추가
+    SqlType type();  // SQL 연산 타입
+    String table();  // 테이블 이름
+    String param() default "";  // 특정 파라미터명을 저장하는 속성 추가
+    String param2() default "";  // 특정 파라미터명을 저장하는 속성 추가
 
 
-    // SQL 연산 타입을 안전하게 관리하는 Enum
+    // SQL 연산 타입을 안전하게 관리하는 Enum
     enum SqlType {
         SELECT, INSERT, UPDATE, DELETE, TRUNCATE, MERGE;
 //

+ 1 - 2
utic-incident-common/src/main/java/com/utic/incident/common/aspect/LoggingAspect.java

@@ -43,14 +43,13 @@ public class LoggingAspect extends AbstractLoggingAspect {
         String processName = annotation.name();
         String schedulingType = "----------------------";
 
-        log.info("-");
         log.info("[{}] {}: [{}], {}", type, LogUtils.elapsedLog(schedulingType), TimeUtils.getCurrentTimeString(), "SCHEDULE START");
 
         long start = System.currentTimeMillis();
         try {
             joinPoint.proceed();
         } catch (InterruptedException e) {
-            log.error("Thread interrupted", e);
+            log.error("[{}] {}: [{}], Exception: {}", type, LogUtils.elapsedLog(schedulingType), TimeUtils.getCurrentTimeString(), e.getMessage());
         }
         long executionTime = System.currentTimeMillis() - start;
 

+ 5 - 5
utic-incident-common/src/main/java/com/utic/incident/common/aspect/SqlOperationAspect.java

@@ -30,11 +30,11 @@ public class SqlOperationAspect extends AbstractLoggingAspect {
 
     @Around("@annotation(com.utic.incident.common.annotation.SqlOperation)")
     public Object aspectSqlOperation(ProceedingJoinPoint joinPoint) throws Throwable {
-        MethodSignature signature = (MethodSignature) joinPoint.getSignature();                 // joinPoint 의 시그니처 가져오기
-        SqlOperation sqlOperation  = signature.getMethod().getAnnotation(SqlOperation.class);   // annotation 가져오기
-        String param = sqlOperation.param();                                                    // 특정 파라미터명 가져오기
-        String param2 = sqlOperation.param2();                                                  // 특정 파라미터명 가져오기
-        Object[] args = joinPoint.getArgs();                                                    // 실행된 메서드의 모든 파라미터 값 가져오기
+        MethodSignature signature = (MethodSignature) joinPoint.getSignature();                 // joinPoint 의 시그니처 가져오기
+        SqlOperation sqlOperation  = signature.getMethod().getAnnotation(SqlOperation.class);   // annotation 가져오기
+        String param = sqlOperation.param();                                                    // 특정 파라미터명 가져오기
+        String param2 = sqlOperation.param2();                                                  // 특정 파라미터명 가져오기
+        Object[] args = joinPoint.getArgs();                                                    // 실행된 메서드의 모든 파라미터 값 가져오기
 
         String type = typeString(sqlOperation.type().name());
         String tableName = sqlOperation.table();

+ 3 - 3
utic-incident-molit/src/main/java/com/utic/incident/molit/server/config/ApplicationConfig.java

@@ -23,12 +23,12 @@ public class ApplicationConfig {
     private int prcsThreadCount = 10;
     private int dbmsBatchSize = 1000;
 
-    private String bootingDateTime;
-    private boolean startSchedule;
-
     private int packetQueueSize = 0;
     private int dbmsQueueSize = 0;
 
+    private boolean startSchedule;
+    private String bootingDateTime;
+
     @PostConstruct
     private void init() {
         this.startSchedule = false;

+ 1 - 1
utic-incident-molit/src/main/resources/application.yml

@@ -40,7 +40,7 @@ management:
 
 application:
   process-id: 70010
-  err-time-gap: 300
+  err-time-gap: 120
   prcs-thread-count: 10
   dbms-batch-size: 1000
   thread-pool-initializer:

+ 1 - 1
utic-incident-molit/src/main/resources/logback-spring.xml

@@ -18,7 +18,7 @@
     <property name="LOG_PATTERN_FILE"        value="[%d{yyyy-MM-dd HH:mm:ss.SSS}] [%-5level] %msg%n"/>
     <!--    <property name="LOG_PATTERN_ERROR"       value="[%d{yyyy-MM-dd HH:mm:ss.SSS}] [%30t] [%5level] %42logger{35}.%-20M ${PID:-} %n%msg%n"/>-->
     <property name="LOG_PATTERN_ERROR"       value="[%d{yyyy-MM-dd HH:mm:ss.SSS}] [%-5level] %msg%n"/>
-    <property name="LOG_PATTERN_CONSOLE"     value="[%d{HH:mm:ss.SSS}] [%5level] %msg %n"/>
+    <property name="LOG_PATTERN_CONSOLE"     value="[%d{HH:mm:ss.SSS}] [%5level] %msg%n"/>
 
     <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
         <!--        <withJansi>true</withJansi>-->