[BE-11] DropReconciliationWorker + 오버셀 감지·지표 (Observability)
작업 내용 (설계 의도)
변경 사항
Redis↔DB 대사와 관측 지표를 신설한다(근거 TDD: “Observability”, ADR-001 실패 경로). BE-10과 다른 파일(스케줄러·지표)이라 같은 wave 병렬 안전. 상태 전이·외부 연동 포함 → 롤백: 스케줄러 비활성 플래그.
DropReconciliationWorker(presentation,@Scheduled): 활성 회차별Redis remaining + DB deducted(limitedQuantity - remaining과 stock 차감량 대조)계산.deducted > limitedQuantity(오버셀) 또는 드리프트 감지 시 UseCase 경유로LimitedDropOversoldEvent발행(source=oversell·severity=critical, ⑥ 연계). 언더셀 드리프트는 슬롯 복원.- 지표(Micrometer, ⑦ 대시보드):
limited_drop_oversell_total·거부율(sold_out/throttled/per_user)·입장→주문 P95·Stock.@Version충돌·Redis 폴백(redis-degraded) 카운터. - 스케줄러는 UseCase 경유(Repository 직접 호출 금지). in-process
@Scheduled(전용 스케줄러 서버 불필요 — TDD 서버 토폴로지).
의존
- BE-03 (LimitedDropDomainService·OversoldEvent), BE-04 (DropReservationStore.remaining)
다이어그램
처리 흐름
sequenceDiagram participant W as ReconciliationWorker participant R as DropReservationStore participant D as LimitedDropDomainService W->>R: remaining(dropId) W->>D: reconcile(dropId, remaining) alt 오버셀 감지 D->>D: publish LimitedDropOversoldEvent end
테스트 케이스
- deducted가 limitedQuantity를 초과하면 LimitedDropOversoldEvent를 발행한다
- 정상(deducted≤limitedQuantity)이면 이벤트를 발행하지 않는다
- Redis 폴백 진입 시 redis-degraded 카운터가 증가한다
- 거부(sold_out/throttled/per_user)마다 대응 지표 카운터가 증가한다