feat: 주기 작업 실행 이력과 데이터 신선도 지표 - #121
Merged
Merged
Conversation
스케줄 작업 12개가 로그만 남겨서 "마지막으로 성공한 게 언제인가" 를 질의할 수 없었다. 동기화가 조용히 멈추면 데이터는 낡아가는데 화면은 그대로 보여준다 — 이 프로젝트에서 반복된 실패 방식이고, 지금까지 감시 수단이 없었다. - TBL_SYNC_RUN (V19): 작업별 실행 이력. SUCCESS/PARTIAL/INCOMPLETE/FAILED 구분. PARTIAL 은 데이터가 갱신됐으므로 신선도로 인정한다. - SyncRunTracker: 스케줄러 작업을 감싸 이력을 남긴다. 예외는 잡아 기록·알림 후 삼킨다 (한 작업 실패가 다음 작업을 막지 않게). 이력 저장은 별도 트랜잭션. - SyncFreshnessService: 작업별 경과 시간·기준 초과 여부. Prometheus 게이지 2종. - 매일 11시 신선도 점검 → 기준 넘긴 작업을 묶어 운영 알림. 기동 후 48시간은 유예. - GET /api/admin/sync/status: 관리자용 상태 목록. - 공개 통계(/facilities/statistics, /health/hospitals/statistics)에 dataUpdatedAt 추가. 소개 사이트가 "○월 ○일 기준" 을 자동으로 표시할 수 있다. 이력이 없으면 null. - 수동 동기화(/api/admin/public-data/*)도 이력에 남긴다. - 이력은 90일 후 정리.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #120
왜
작업 12개가 로그만 남겨 "마지막으로 성공한 게 언제인가" 를 질의할 수 없었다. 동기화가 조용히 멈추면 데이터는 낡아가는데 화면은 그대로다.
무엇
TBL_SYNC_RUN(V19)SUCCESS/PARTIAL/INCOMPLETE/FAILEDSyncRunTrackerSyncFreshnessServiceGET /api/admin/sync/statusdataUpdatedAtPARTIAL을 신선도로 인정하는 이유: 일부 항목이 실패했어도 나머지는 갱신됐다. 인정하지 않으면 실패 1건에 "데이터 낡음" 알림이 계속 나간다.테스트
SyncRunTrackerTest(6) — 상태 분류, 예외 기록 후 삼킴, 이력 저장 실패가 작업을 망가뜨리지 않음SyncFreshnessServiceTest(8) — 기준 판정, 주간 작업 1회 누락 허용, 설정 덮어쓰기, 조회 실패 격리PublicStatsContractTest—dataUpdatedAt노출, 상태 조회 401/403/200운영 주의
신선도 기준을 넘기면 알림이 옵니다. 지금 운영 서버는 이력이 없으므로 배포 후 48시간 뒤부터 판단합니다.