Skip to content

[health] health-core와 transports-http의 헬스체크 계약이 서로 다름 #702

Description

@kang-heewon

Problem

health-coretransports-http가 각각 별도의 health check registry/service와 응답 shape를 유지합니다. 개별 check status는 둘 다 up/down을 쓰지만 aggregate status는 한쪽이 up/down, 다른 쪽이 ok/error를 사용해 adapter 간 인지부하와 변환 비용이 생깁니다.

Evidence

  • packages/health-core/src/libs/HealthCheckService.ts:8-15는 aggregate status: HealthStatusresults 배열을 반환합니다.
  • packages/health-core/src/libs/HealthCheckService.ts:52-60는 aggregate status를 up 또는 down으로 계산합니다.
  • packages/transports-http/src/libs/HealthCheckRegistry.ts:4-15는 개별 check status를 up/down으로 정의합니다.
  • packages/transports-http/src/libs/HealthCheckRegistry.ts:35-38는 aggregate status를 ok 또는 error로 반환합니다.
  • 두 구현 모두 timeout/AbortController 로직을 별도로 보유합니다.

Desired Outcome

Health check core contract는 하나의 패키지에서 정의되고 HTTP adapter는 이를 표현만 해야 합니다. Aggregate status와 check result shape가 일관되어야 합니다.

Suggested Approach

  • health-core의 service/result 타입을 canonical contract로 삼을지 결정합니다.
  • transports-httpHealthCheckRegistry를 adapter 또는 wrapper로 축소합니다.
  • ok/error가 HTTP response body에 필요하다면 명시적인 serializer 레이어에서만 변환합니다.

Acceptance Criteria

  • health aggregate status vocabulary가 한 곳에서 정의됩니다.
  • timeout/check execution 로직 중복이 줄어듭니다.
  • HTTP health endpoint가 core health contract와 어긋나지 않는 테스트가 추가됩니다.

Validation

  • pnpm test --filter=@croco/health-core
  • pnpm test --filter=@croco/transports-http
  • health endpoint contract test

Metadata

Metadata

Assignees

Labels

P2Priority 2 issuearchitectureArchitecture and module boundary issuestech-debtTechnical debt

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions