Skip to content

[feat] PB-117 TRACE-1 공통 Trace 계약·HTTP ingress 구축 #228

Closed

Description

@PHJ2000

목적 (Why)

무엇을 추가/변경하나?

  • Jira 키: PB-117
  • TRACE-1 공통 Trace 계약과 HTTP ingress Trace를 구축한다.
  • Micrometer Tracing + OpenTelemetry bridge를 기준으로 HTTP 요청에 실제 traceId/spanId를 생성하고 구조화 로그와 연결한다.
  • 기존 requestId 응답·로그 계약을 유지하면서 W3C traceparent와 성공·4xx·5xx 상태를 추적한다.

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

  • 현재 MDC 로그는 같은 요청 검색에는 유용하지만 실행 구간의 부모·자식 관계와 처리시간을 설명하지 못한다.
  • 이후 TRACE-2·3·4·5·6이 동일한 sampling, 전파, 로그, 개인정보 보호 계약을 사용하려면 공통 기반이 먼저 필요하다.

Out of scope / Non-goals


전체 설계 (How)

HTTP request
  -> W3C traceparent 추출 또는 신규 trace 생성
  -> Spring MVC http.server.requests span
  -> security / controller / service
  -> response status + requestId/traceId/spanId 로그
  -> OTLP exporter -> #233 Tempo
  • Spring MVC 자동 계측을 우선하고 수동 server span을 중복 생성하지 않는다.
  • requestId는 고객 문의·로그 검색용, traceId/spanId는 실행 관계 표현용으로 함께 유지한다.
  • OTLP endpoint와 sampling은 환경변수로 제어하고 endpoint 미설정 시 exporter를 구성하지 않는다.
  • baggage는 비활성화하고 span attribute를 낮은 cardinality 계약으로 제한한다.

PR 분할 전략

  • Stacked PR
  1. PR #236 (1/2) 공통 Trace 기반 구성 (main 기반)
  2. PR #237 (2/2) HTTP ingress Trace 계약 (feature/trace-core 기반)

부분 머지 안전성

  • PR #236만 머지: 공통 tracing/OTLP/log 기반이 추가되고 기존 API·업무 로직은 유지된다.
  • PR #237까지 머지: TRACE-1 코드 범위가 완료된다.
  • 이슈 종료: 코드 병합만으로 자동 종료하지 않고, dev에서 HTTP Trace와 로그 상관관계를 확인한 뒤 수동 종료한다.

Acceptance Criteria

  • AC1: HTTP 요청에 유효한 실제 traceId/spanId가 생성되고 구조화 로그에 기록된다.
  • AC2: 유효한 W3C traceparent의 remote parent가 유지되고, traceparent가 없으면 새 trace가 생성된다.
  • AC3: HTTP 성공·인증 실패·4xx·5xx가 bounded status/outcome으로 구분되며 기존 X-Request-Id 응답·로그 계약이 유지된다.
  • AC4: sampling·OTLP endpoint·timeout·service/resource attribute를 환경별로 제어하고 endpoint 미설정 시 exporter가 구성되지 않는다.
  • AC5: Authorization, query 원문, requestId/userId 등 민감정보·고카디널리티 값이 span attribute에 남지 않는다.
  • AC6: API 응답과 DB schema를 변경하지 않고 관련 단위·통합 테스트와 전체 테스트가 통과한다.
  • AC7: dev에서 대표 HTTP Trace를 조회하고 로그의 traceId와 일치하며 exporter 장애가 API 실패로 전파되지 않음을 증명한다.

PR별 완료 범위

검증 명령

  • ./gradlew test --tests '*TracingCoreConfigurationTest' --tests '*MdcRequestFilterTest' --tests '*DtoLoggingCatalogTest'
  • ./gradlew test --tests '*HttpIngressTracingIntegrationTest'
  • ./gradlew check

영향 범위

  • API 스펙 변경
  • DB 스키마 변경
  • 설정/환경변수 변경 (sampling, W3C propagation, OTLP endpoint·timeout, resource attribute)
  • 라이브러리 추가 (Micrometer Tracing OpenTelemetry bridge, OTLP exporter)

리스크 & 롤백

  • exporter endpoint 장애나 queue 포화로 에러 로그 또는 span drop이 증가할 수 있다.
  • 잘못된 filter/observation 순서는 requestId와 Trace MDC 상관관계를 끊을 수 있다.
  • 문제 시 endpoint 제거와 sampling 0.0으로 수집을 중지하고 각 PR을 독립적으로 revert한다.

의존성

Activity

  1. github-actions commented on May 21, 2026

    @github-actions

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

  2. changed the title [-][chore] PB-117 OpenTelemetry 기반 트레이싱 도입[/-] [+][feat] PB-117 OpenTelemetry 기반 트레이싱 도입[/+] on May 21, 2026
  3. geonusp commented on May 21, 2026

    @geonusp
    Collaborator

    아직 로깅 표준도 못 끝냈는데 트레이싱을 논의하는 것은 맞지않다고 봅니다.

  4. changed the title [-][feat] PB-117 OpenTelemetry 기반 트레이싱 도입[/-] [+][feat] PB-117 공통·비동기 이메일·Scheduler Trace 구축[/+] on Aug 11, 2026
  5. changed the title [-][feat] PB-117 공통·비동기 이메일·Scheduler Trace 구축[/-] [+][feat] PB-117 TRACE-1 공통 Trace 계약·HTTP ingress 구축[/+] on Aug 14, 2026
  6. PHJ2000 commented on Aug 14, 2026

    @PHJ2000
    CollaboratorAuthor

    TRACE 단위 진행률과 의존성을 독립적으로 추적할 수 있도록 기존 통합 범위를 분리했습니다.

    기존 5개 PR의 단일 순번은 제거하고, 각 TRACE 내부 PR 순번과 runtime 완료 조건을 각 이슈에서 관리합니다.

  7. PHJ2000 commented on Aug 14, 2026

    @PHJ2000
    CollaboratorAuthor

    참고: 이번 본문 범위 축소를 Jira PB-117에 반영하는 동기화도 동일한 Atlassian 로그인 404로 실패했습니다.

    Actions: https://github.com/Beach-complex/Beach_complex/actions/runs/31808058520

    GitHub의 TRACE 분리 내용은 반영됐으며, Jira 연결 복구 후 이 실행을 재시도해야 합니다.

  8. geonusp commented on Aug 14, 2026

    @geonusp
    Collaborator

    참고: 이번 본문 범위 축소를 Jira PB-117에 반영하는 동기화도 동일한 Atlassian 로그인 404로 실패했습니다.

    Actions: https://github.com/Beach-complex/Beach_complex/actions/runs/31808058520

    GitHub의 TRACE 분리 내용은 반영됐으며, Jira 연결 복구 후 이 실행을 재시도해야 합니다.

    Jira 복구 관련해서 연락 온 거 있나요?

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