From 7079ce69a0f579c41ae8ce4a5b7ccd59161b4724 Mon Sep 17 00:00:00 2001 From: pksup Date: Thu, 15 Jan 2026 09:45:47 +0900 Subject: [PATCH] =?UTF-8?q?400=20=EC=84=B1=EA=B3=B5=EC=8B=9C=20=EC=84=B1?= =?UTF-8?q?=EA=B3=B5=EC=9C=BC=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../statistics/collector/HourStatsAggregator.java | 10 +++++++--- .../statistics/collector/MinuteStatsAggregator.java | 10 +++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) 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);