Skip to content

feat: 샘플 앱과 백엔드(8081) Observe API E2E 연동 및 비차단 검증 (#13) - #76

Closed
rlagusgh2199 wants to merge 1 commit into
mainfrom
feature/issue-13
Closed

rlagusgh2199 wants to merge 1 commit into
mainfrom
feature/issue-13

Conversation

@rlagusgh2199

Copy link
Copy Markdown
Contributor

📌 작업 내용

  • E2E 연동: 샘플 앱(8080)의 토큰 사용량 로그를 백엔드 수집 API(http://localhost:8081/internal/usage-logs)로 비동기 전송(201 Created 및 DB 적재 확인)
  • 장애 주입(Fault Injection) 테스트: 8081 서버를 내린 상태(ConnectException)에서도 8080 앱이 멈추지 않고 정상 응답하는지(비차단) 검증 완료
  • Runbook 문서화: 국문/영문 데모 런북에 E2E 및 장애 주입 테스트 가이드 추가

🛠️ 주요 변경 파일

  • ObserveLedgerListener.java: HttpClient.sendAsync 기반 비동기 통신 및 8081 API 페이로드 스키마 맞춤
  • DemoScenarioService.java: 정산 성공 시점에 Observe 리스너 호출 연결
  • DEMO_RUNBOOK.md / DEMO_RUNBOOK_EN.md: 검증 절차 및 장애 주입 시나리오 추가

@coderabbitai

coderabbitai Bot commented Oct 2, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: a6d53704-653b-4970-bd8c-bc6cea8239ab

  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@HuitaePark

Copy link
Copy Markdown
Member

@rlagusgh2199 작업 감사합니다! 다만 이 PR이 해결하려는 이슈는 token-pilot-cloud-api#13 (Phase 2 Observe E2E·장애 주입·runbook)이라 API 리포지토리(tokenpliot/token-pilot-cloud-api)에서 작업해야 합니다. tokenpilot은 오픈소스 라이브러리 저장소라 Cloud API 전용 연동 코드나 런북을 여기에 넣지 않으려고 해서 이 PR은 닫겠습니다.

API 리포지토리에서 다시 작업할 때 리뷰하면서 확인한 내용도 같이 반영해 주세요.

  • ObserveLedgerListener가 @Component라서 LedgerManager에 자동 등록됩니다. 그래서 모든 기록 이벤트마다 onRecord가 실행되고, 실제 사용량 대신 고정값(gpt-4o-mini, 1200/800 토큰, 0.0035 USD)을 보냅니다. DemoScenarioService에서 직접 부르는 호출까지 더해지면 중복으로 전송될 수 있습니다. → CostRecordedEvent의 모델·토큰·비용을 그대로 매핑해 주세요.
  • occurredAt이 2026-10-02T18:35:00으로 고정되어 있고, requestId는 currentTimeMillis 기반이며, 금액은 String.format("%.4f")(로케일 영향)과 double로 만들어집니다. → 실제 발생 시각, UUID, BigDecimal과 JSON 직렬화기를 써 주세요.
  • 엔드포인트(localhost:8081)와 organization/project ID가 하드코딩되어 있고 끌 수 있는 방법이 없습니다. 그래서 테스트를 포함한 모든 실행에서 외부 HTTP 호출이 일어납니다. → 설정 프로퍼티와 enabled 플래그(기본값 off)로 바꿔 주세요.
  • 런북에서 Cloud API는 기본 포트가 8080이라 ./gradlew bootRun만 실행하면 8081에서 뜨지 않고 샘플 앱과 포트가 충돌합니다(--server.port=8081 필요). 디렉터리 이름도 token-ledger-cloud-api가 아니라 token-pilot-cloud-api입니다. 6.1 같은 하위 섹션은 ###로, 명령어는 코드 블록으로 감싸 주세요.
  • 이슈 완료 기준 중 API Key 기반 전송, 실패/불명확 흐름 전송, 배치 부분 실패, 수집 실패 metric은 아직 포함되지 않았습니다.

@HuitaePark HuitaePark closed this Oct 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants