Skip to content

[feat] PB-120 MDC3: 스케줄러 MDC + 도메인 구조화 로그 #231

Closed

Description

@geonusp

목적 (Why)

무엇을 추가/변경하나?

  • @Scheduled 작업에 스케줄러 실행 컨텍스트 MDC(schedulerName, jobId)를 짧은 scope로 주입한다.
  • 도메인 식별자(notificationId, outboxEventId 등)는 MDC가 아니라 structured argument(StructuredArguments.kv)로 기록한다.

왜 필요한가? (User value / Problem)

  • 스케줄러 로그는 HTTP requestId/userId가 없어 1회 실행 단위 상관관계 추적이 어렵다.
  • Outbox/Notification 처리 로그에서 도메인 식별자를 일관되게 찾기 어렵다.

비즈니스/기술적 배경

  • 선행: MDC1(HTTP requestId/userId), MDC2(@async MDC 전파, PB-119).
  • 정책 근거: ADR-010 로깅 표준.

전체 설계 (How)

핵심 아이디어/접근법

  • MDC는 실행 컨텍스트 전용(requestId, userId, traceId, spanId, schedulerName, jobId).
  • 도메인 식별자는 structured argument 우선. helper(MdcScope)는 이번 PR 제외(MDC.putCloseable 직접 사용).

주요 컴포넌트/모듈

  • logback-spring.xml: schedulerName, jobId 노출
  • OutboxSchedulingConfig, BeachConditionScheduler: 스케줄러 MDC scope
  • NotificationService, OutboxEventDispatcher, OutboxPublisher: structured log

전체 Acceptance Criteria (AC)

  • logback-spring.xml dev/prod 로그에 schedulerName, jobId 노출
  • Outbox/BeachCondition 스케줄러 실행 중 schedulerName/jobId MDC 주입, 종료 후 누수 없음
  • NotificationService/OutboxEventDispatcher 로그에 도메인 식별자가 structured field로 기록
  • 스케줄러에 requestId/userId 주입 안 함, traceId/spanId 직접 생성 안 함

영향 범위

  • 로그 필드만 추가 (API/DB/외부연동 런타임 계약 변경 없음)

Breaking Changes / 호환성

  • Breaking change 없음

의존성

증빙/참고 자료

  • 관련 ADR: ADR-010 로깅 표준 (도메인 로그 필드 / 스케줄러 MDC 정책 보강)

Activity

  1. github-actions commented on Jun 15, 2026

    @github-actions

    ✅ 지라 티켓이 생성되었습니다: PB-120

  2. self-assigned this
    on Jun 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions