diff --git a/src/main/java/com/eactive/eai/custom/statistics/collector/HourStatsAggregator.java b/src/main/java/com/eactive/eai/custom/statistics/collector/HourStatsAggregator.java index cef19b1..b8acfff 100644 --- a/src/main/java/com/eactive/eai/custom/statistics/collector/HourStatsAggregator.java +++ b/src/main/java/com/eactive/eai/custom/statistics/collector/HourStatsAggregator.java @@ -22,6 +22,7 @@ public class HourStatsAggregator { // 건수 메트릭 private final AtomicLong totalCnt = new AtomicLong(0); + private final AtomicLong successCnt = new AtomicLong(0); private final AtomicLong timeoutCnt = new AtomicLong(0); private final AtomicLong systemErrCnt = new AtomicLong(0); private final AtomicLong bizErrCnt = new AtomicLong(0); @@ -67,7 +68,11 @@ public class HourStatsAggregator { } // 로그 시퀀스 400: 응답시간 및 에러 타입 기록 else if (logSeq == 400) { - if (!event.isSuccess()) { + // 성공 여부 카운트 + if (event.isSuccess()) { + successCnt.incrementAndGet(); + } else { + // 에러 유형별 카운트 switch (event.getErrorType()) { case TIMEOUT: timeoutCnt.incrementAndGet(); @@ -185,11 +190,10 @@ public class HourStatsAggregator { // 건수 메트릭 long total = totalCnt.get(); + long success = successCnt.get(); long timeout = timeoutCnt.get(); long systemErr = systemErrCnt.get(); long bizErr = bizErrCnt.get(); - long success = total - (timeout + systemErr + bizErr); - success = Math.max(0, success); // 음수 방지 stats.setTotalCnt(total); stats.setSuccessCnt(success); diff --git a/src/main/java/com/eactive/eai/custom/statistics/collector/MinuteStatsAggregator.java b/src/main/java/com/eactive/eai/custom/statistics/collector/MinuteStatsAggregator.java index e4d42f5..d2eb524 100644 --- a/src/main/java/com/eactive/eai/custom/statistics/collector/MinuteStatsAggregator.java +++ b/src/main/java/com/eactive/eai/custom/statistics/collector/MinuteStatsAggregator.java @@ -22,6 +22,7 @@ public class MinuteStatsAggregator { // 건수 메트릭 private final AtomicLong totalCnt = new AtomicLong(0); + private final AtomicLong successCnt = new AtomicLong(0); private final AtomicLong timeoutCnt = new AtomicLong(0); private final AtomicLong systemErrCnt = new AtomicLong(0); private final AtomicLong bizErrCnt = new AtomicLong(0); @@ -67,7 +68,11 @@ public class MinuteStatsAggregator { } // 로그 시퀀스 400: 응답시간 및 에러 타입 기록 else if (logSeq == 400) { - if (!event.isSuccess()) { + // 성공 여부 카운트 + if (event.isSuccess()) { + successCnt.incrementAndGet(); + } else { + // 에러 유형별 카운트 switch (event.getErrorType()) { case TIMEOUT: timeoutCnt.incrementAndGet(); @@ -185,11 +190,10 @@ public class MinuteStatsAggregator { // 건수 메트릭 long total = totalCnt.get(); + long success = successCnt.get(); long timeout = timeoutCnt.get(); long systemErr = systemErrCnt.get(); long bizErr = bizErrCnt.get(); - long success = total - (timeout + systemErr + bizErr); - success = Math.max(0, success); // 음수 방지 stats.setTotalCnt(total); stats.setSuccessCnt(success);