Skip to content

[Feat] - 애플워치 건강 데이터 연동 + 배포 안정성 강화 (v3)#182

Merged
thingineeer merged 2 commits intomainfrom
dev
Feb 23, 2026
Merged

[Feat] - 애플워치 건강 데이터 연동 + 배포 안정성 강화 (v3)#182
thingineeer merged 2 commits intomainfrom
dev

Conversation

@thingineeer
Copy link
Contributor

Summary

  • Apple Watch 건강 데이터 연동 API (POST/GET/DELETE /api/record/{recordId}/health, GET /api/health/summary)
  • 활동 기록 조회 시 건강 데이터(평균 심박수, 칼로리) 포함
  • 배포 안정성 강화 (이전 배포 실패 원인 모두 해결)

배포 실패 원인 분석 및 수정

1차 배포 실패 원인

  • ControllerExceptionAdvice.handleException()throws IOException 선언
  • SlackApi.sendAlert() 실패 시 에러 핸들러 자체가 throw → 모든 500 에러가 Spring 기본 포맷으로 반환 (연쇄 장애)

2차 배포 실패 원인

  • PROD-CD 파이프라인 완료까지 약 10-15분 소요
  • 2분 후 테스트하여 이전 인스턴스(수정 전 코드)가 응답
  • 즉시 롤백 push로 수정 배포와 경쟁(race condition) 발생

수정 사항

  1. ControllerExceptionAdvice: throws IOException 제거, slackApi/Sentry 호출 try-catch 감싸기
  2. SlackApi: 공유 StringBuilder → 지역변수 (thread-safety), readRootStackTrace null 체크
  3. RecordService: 건강 데이터 조회 try-catch + warn 로깅 (실패해도 기록 목록 정상 반환)

중요: 배포 후 테스트 시 최소 15분 대기 필요

PROD-CD 파이프라인: build → S3 → CodeDeploy → deploy.sh(health check + Nginx switch) = 약 10-15분

Test plan

  • 배포 후 15분 대기
  • GET /api/public-course (visitor) → 200
  • POST /api/auth → 정상 동작
  • GET /api/record → 200 + healthData 필드 포함
  • POST /api/record/{id}/health → 201
  • GET /api/record/{id}/health → 200
  • GET /api/health/summary → 200

@thingineeer thingineeer merged commit b0e895e into main Feb 23, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant