에러 검출 로직 수정

This commit is contained in:
pksup
2026-01-13 11:07:21 +09:00
parent bd3a157468
commit 84f816b6a8
@@ -39,7 +39,7 @@ public class ApiStatsMonitorImpl implements StatisticsMonitor {
String outboundAdapter = extractOutboundAdapter(requestEaiMessage); String outboundAdapter = extractOutboundAdapter(requestEaiMessage);
long responseTimeMs = extractResponseTime(requestEaiMessage); long responseTimeMs = extractResponseTime(requestEaiMessage);
boolean success = extractSuccess(requestEaiMessage); boolean success = extractSuccess(requestEaiMessage);
TransactionEvent.ErrorType errorType = extractErrorType(requestEaiMessage); TransactionEvent.ErrorType errorType = extractErrorType(requestEaiMessage, success);
// TransactionEvent 생성 // TransactionEvent 생성
TransactionEvent event = TransactionEvent.builder().apiName(apiName).gwInstanceId(gwInstanceId) TransactionEvent event = TransactionEvent.builder().apiName(apiName).gwInstanceId(gwInstanceId)
@@ -127,26 +127,30 @@ public class ApiStatsMonitorImpl implements StatisticsMonitor {
* 성공 여부 추출 * 성공 여부 추출
*/ */
private boolean extractSuccess(EAIMessage msg) { private boolean extractSuccess(EAIMessage msg) {
// logPssSno가 900이면 에러로 처리
if (msg.getLogPssSno() == 900) {
return false;
}
return msg.getStatErrorCode() == 0; return msg.getStatErrorCode() == 0;
} }
/** /**
* 에러 유형 추출 * 에러 유형 추출
*/ */
private TransactionEvent.ErrorType extractErrorType(EAIMessage msg) { private TransactionEvent.ErrorType extractErrorType(EAIMessage msg, boolean success) {
int errorCode = msg.getStatErrorCode(); int errorCode = msg.getStatErrorCode();
switch (errorCode) { switch (errorCode) {
case 0: case 0:
return null; // 정상 return success ? null : TransactionEvent.ErrorType.SYSTEM_ERROR;
case 1:
return TransactionEvent.ErrorType.BUSINESS_ERROR;
case 2: case 2:
return TransactionEvent.ErrorType.TIMEOUT; return TransactionEvent.ErrorType.TIMEOUT;
case 3: case 3:
return TransactionEvent.ErrorType.SYSTEM_ERROR; return TransactionEvent.ErrorType.SYSTEM_ERROR;
case 1:
return TransactionEvent.ErrorType.BUSINESS_ERROR;
default: default:
return null; return success ? null : TransactionEvent.ErrorType.SYSTEM_ERROR;
} }
} }
} }