통계 에러 처리 로직 수정

This commit is contained in:
pksup
2026-01-13 13:51:16 +09:00
parent 84f816b6a8
commit b708aa7688
3 changed files with 36 additions and 28 deletions
@@ -25,9 +25,9 @@ public class ApiStatsMonitorImpl implements StatisticsMonitor {
@Override
public void recordStatistics(EAIMessage requestEaiMessage) {
try {
// 로그 시퀀스 400 또는 900만 처리
// 로그 시퀀스 100, 400, 900만 처리
int logSequence = requestEaiMessage.getLogPssSno();
if (logSequence != 400 && logSequence != 900) {
if (logSequence != 100 && logSequence != 400 && logSequence != 900) {
return;
}
@@ -22,7 +22,6 @@ 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);
@@ -62,13 +61,13 @@ public class HourStatsAggregator {
public void recordEvent(TransactionEvent event) {
int logSeq = event.getLogSequence();
// 로그 시퀀스 400: 일반 통계 집계
if (logSeq == 400) {
// 로그 시퀀스 100: 총 건수만 증가 (첫 호출)
if (logSeq == 100) {
totalCnt.incrementAndGet();
if (event.isSuccess()) {
successCnt.incrementAndGet();
} else {
}
// 로그 시퀀스 400: 응답시간 및 에러 타입 기록
else if (logSeq == 400) {
if (!event.isSuccess()) {
switch (event.getErrorType()) {
case TIMEOUT:
timeoutCnt.incrementAndGet();
@@ -185,11 +184,17 @@ public class HourStatsAggregator {
stats.setOutboundAdapter(key.getOutboundAdapter());
// 건수 메트릭
stats.setTotalCnt(totalCnt.get());
stats.setSuccessCnt(successCnt.get());
stats.setTimeoutCnt(timeoutCnt.get());
stats.setSystemErrCnt(systemErrCnt.get());
stats.setBizErrCnt(bizErrCnt.get());
long total = totalCnt.get();
long timeout = timeoutCnt.get();
long systemErr = systemErrCnt.get();
long bizErr = bizErrCnt.get();
long success = total - (timeout + systemErr + bizErr);
stats.setTotalCnt(total);
stats.setSuccessCnt(success);
stats.setTimeoutCnt(timeout);
stats.setSystemErrCnt(systemErr);
stats.setBizErrCnt(bizErr);
// 로그 시퀀스 900 구간 에러 카운트
stats.setSeq900TimeoutCnt(seq900TimeoutCnt.get());
@@ -197,7 +202,6 @@ public class HourStatsAggregator {
stats.setSeq900BizErrCnt(seq900BizErrCnt.get());
// 응답시간 메트릭
long total = totalCnt.get();
if (total > 0) {
// 평균
double avg = (double) totalRespTime.get() / total;
@@ -22,7 +22,6 @@ 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);
@@ -62,13 +61,13 @@ public class MinuteStatsAggregator {
public void recordEvent(TransactionEvent event) {
int logSeq = event.getLogSequence();
// 로그 시퀀스 400: 일반 통계 집계
if (logSeq == 400) {
// 로그 시퀀스 100: 총 건수만 증가 (첫 호출)
if (logSeq == 100) {
totalCnt.incrementAndGet();
if (event.isSuccess()) {
successCnt.incrementAndGet();
} else {
}
// 로그 시퀀스 400: 응답시간 및 에러 타입 기록
else if (logSeq == 400) {
if (!event.isSuccess()) {
switch (event.getErrorType()) {
case TIMEOUT:
timeoutCnt.incrementAndGet();
@@ -185,11 +184,17 @@ public class MinuteStatsAggregator {
stats.setOutboundAdapter(key.getOutboundAdapter());
// 건수 메트릭
stats.setTotalCnt(totalCnt.get());
stats.setSuccessCnt(successCnt.get());
stats.setTimeoutCnt(timeoutCnt.get());
stats.setSystemErrCnt(systemErrCnt.get());
stats.setBizErrCnt(bizErrCnt.get());
long total = totalCnt.get();
long timeout = timeoutCnt.get();
long systemErr = systemErrCnt.get();
long bizErr = bizErrCnt.get();
long success = total - (timeout + systemErr + bizErr);
stats.setTotalCnt(total);
stats.setSuccessCnt(success);
stats.setTimeoutCnt(timeout);
stats.setSystemErrCnt(systemErr);
stats.setBizErrCnt(bizErr);
// 로그 시퀀스 900 구간 에러 카운트
stats.setSeq900TimeoutCnt(seq900TimeoutCnt.get());
@@ -197,7 +202,6 @@ public class MinuteStatsAggregator {
stats.setSeq900BizErrCnt(seq900BizErrCnt.get());
// 응답시간 메트릭
long total = totalCnt.get();
if (total > 0) {
// 평균
double avg = (double) totalRespTime.get() / total;