Repository navigation
[Feat] PB-119 @Async 경계 MDC(requestId/userId) 전파 - #230
Merged
Merged
Conversation
- MdcTaskDecorator 신규 추가: 작업 제출 시점의 부모 MDC를 worker thread 실행 직전 주입하고 종료 후 원래 값으로 복원 - 부모 MDC가 비어 있으면 worker thread MDC를 clear해 스레드풀 재사용 시 이전 작업 컨텍스트 누수 차단 - emailTaskExecutor에 MdcTaskDecorator 적용해 비동기 이메일 작업 로그에도 동일 requestId/userId가 찍히도록 전파 - MdcTaskDecorator 단위 테스트 추가: 전파/정리/예외 시 정리/worker 기존 MDC 복원 검증 - ApplicationContextRunner로 실제 emailTaskExecutor 경유 전파 및 제출 스레드 MDC 유지 통합 테스트 추가 Refs: #229
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
PHJ2000
reviewed
Jun 10, 2026
Collaborator
|
수고하셨습니다 |
3 of 12 tasks
5 of 24 tasks
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.
✨ Feature PR
🔗 이슈 링크 (필수)
🧩 이 PR의 변경사항 (필수)
전체 중 위치 (Stacked PR 시)
이 PR에서 변경한 것
global/logging/MdcTaskDecorator.java(신규):TaskDecorator구현. 제출 시점 부모 MDC 복사 → worker thread 주입 → 실행 후 복원/정리global/config/AsyncConfig.java(수정):emailTaskExecutor에setTaskDecorator(new MdcTaskDecorator())적용 (initialize()전 호출)test/.../logging/MdcTaskDecoratorTest.java(신규): 전파/정리/예외/복원 단위 테스트test/.../config/AsyncConfigTest.java(신규):ApplicationContextRunner로 실 executor 경유 전파 + 제출 스레드 MDC 유지 검증✅ 이 PR이 커버하는 AC (필수)
Covers (이 PR에서 완료)
requestId/userId)가 decorated runnable 내부에서 동일하게 보임emailTaskExecutor에MdcTaskDecorator적용 확인 (통합 테스트)userId유지 / 비인증은 비어 있음 (전파 로직상 보장)Not covered (후속 작업)
notificationId/outboxEventId등) 로그 정책 → 별도 ADR로 정책 결정 후 후속 PRjobId/schedulerName정책 → 별도 ADR로 정책 결정 후 후속 PRtraceId/spanId자동 주입 → ADR-0XX 트레이싱 도입 범위🧪 테스트 결과 (필수)
로컬
AsyncConfigTest는ApplicationContextRunner사용으로 Testcontainers/Docker 불필요CI
Smoke 테스트
email-*worker thread 로그에 동일requestId노출, 다음 비동기 작업에 이전requestId/userId미누수 확인🧭 영향 범위 체크 (필수)
emailTaskExecutor빈에 TaskDecorator 적용 — 외부 설정/환경변수 변경 없음)💬 리뷰 포인트 (필수)
MdcTaskDecorator#decorate—finally의previousContext복원/clear 분기 (worker thread 재사용 누수 차단 지점)AsyncConfig#emailTaskExecutor—setTaskDecorator(...)가initialize()이전에 호출되는지clear가 아니라previousContext로 복원 — 같은 스레드에 프레임워크/테스트가 미리 넣어둔 값까지 안전하게 보존하기 위함requestId/userId)만 전파 (도메인/스케줄러 키는 ADR 선행)