- IncidentKind 열거형 지연(DELAY) 상태 추가 및 관련 로직 정비
eapim-portal CI (from elink-portal-common) / build (push) Has been cancelled

- 레포지토리 메서드 수정: 장애/지연 복수 상태 조회 지원
- 지연 상태 자동 탐지 및 병합 시 기존 로직 호환성 유지
This commit is contained in:
Rinjae
2026-08-03 17:06:50 +09:00
parent d231a2b330
commit c315d352ad
2 changed files with 45 additions and 6 deletions
@@ -1,6 +1,39 @@
package com.eactive.apim.portal.djb.apistatus.incident.entity; package com.eactive.apim.portal.djb.apistatus.incident.entity;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
/**
* 이슈 종류.
*
* <p>{@link #INCIDENT} 와 {@link #DELAY} 는 둘 다 서비스 저하이며 {@code STATE} 를 가진다.
* {@link #MAINTENANCE} 만 계획된 작업이라 {@code STATE} 가 없다 (ADR-F15).</p>
*
* <p>{@link #DELAY} 는 자동 탐지(응답시간 임계 초과) 전용이며 공지(PTL_NOTICE)를 만들지 않는다.
* 관리자 검수 화면이 없고 복구 이벤트({@code DELAY_END}/{@code ERROR_END})로 자동 종결된다.</p>
*/
public enum IncidentKind { public enum IncidentKind {
/** 장애 */
INCIDENT, INCIDENT,
MAINTENANCE
/** 지연 - 자동 탐지 전용, 연결 공지 없음 */
DELAY,
/** 점검 */
MAINTENANCE;
/**
* 서비스 저하로 취급하는 종류 (장애 + 지연).
*
* <p>가동률 차감, 복구 처리, 진행 중 이슈 조회의 대상이다. 점검은 계획된 작업이라 제외된다.</p>
*/
public static final Collection<IncidentKind> DEGRADING =
Collections.unmodifiableList(Arrays.asList(INCIDENT, DELAY));
/** {@link #DEGRADING} 여부 */
public boolean isDegrading() {
return this != MAINTENANCE;
}
} }
@@ -23,23 +23,29 @@ public interface DjbApistatusIncidentRepository
Optional<DjbApistatusIncident> findByInterfaceId(String interfaceId); Optional<DjbApistatusIncident> findByInterfaceId(String interfaceId);
List<DjbApistatusIncident> findByKindAndStateNotInOrderByStartedAtDesc( /**
IncidentKind kind, Collection<IncidentState> excludedStates); * 미종결 이슈. 장애와 지연을 함께 봐야 하므로 종류는 복수로 받는다
* ({@link IncidentKind#DEGRADING}).
*/
List<DjbApistatusIncident> findByKindInAndStateNotInOrderByStartedAtDesc(
Collection<IncidentKind> kinds, Collection<IncidentState> excludedStates);
/** /**
* 특정 API 들에 영향을 주는 미종결 장애. 자동 탐지 시 기존 장애 병합 대상 판별용. * 특정 API 들에 영향을 주는 미종결 이슈. 자동 탐지 시 기존 이슈 병합 대상 판별용.
* *
* <p>{@code detectedBy} 로 등록 주체를 한정한다. 자동 탐지는 자동 등록 건에만 영향 API 를 덧붙여야 * <p>{@code detectedBy} 로 등록 주체를 한정한다. 자동 탐지는 자동 등록 건에만 영향 API 를 덧붙여야
* 관리자가 직접 작성한 장애 공지의 내용이 바뀌지 않는다.</p> * 관리자가 직접 작성한 장애 공지의 내용이 바뀌지 않는다.</p>
*
* <p>지연(DELAY)이 장애(INCIDENT)로 번지는 경우가 있어 종류는 복수로 받는다.</p>
*/ */
@Query("SELECT DISTINCT i FROM DjbApistatusIncident i, DjbApistatusIncidentApi a" @Query("SELECT DISTINCT i FROM DjbApistatusIncident i, DjbApistatusIncidentApi a"
+ " WHERE a.incidentId = i.incidentId" + " WHERE a.incidentId = i.incidentId"
+ " AND i.kind = :kind" + " AND i.kind IN :kinds"
+ " AND i.detectedBy = :detectedBy" + " AND i.detectedBy = :detectedBy"
+ " AND i.state NOT IN :excludedStates" + " AND i.state NOT IN :excludedStates"
+ " AND a.apiId IN :apiIds" + " AND a.apiId IN :apiIds"
+ " ORDER BY i.startedAt DESC") + " ORDER BY i.startedAt DESC")
List<DjbApistatusIncident> findOpenByApiIds(@Param("kind") IncidentKind kind, List<DjbApistatusIncident> findOpenByApiIds(@Param("kinds") Collection<IncidentKind> kinds,
@Param("detectedBy") String detectedBy, @Param("detectedBy") String detectedBy,
@Param("excludedStates") Collection<IncidentState> excludedStates, @Param("excludedStates") Collection<IncidentState> excludedStates,
@Param("apiIds") Collection<String> apiIds); @Param("apiIds") Collection<String> apiIds);