## 배경 #91 에서 도메인 전반 E2E 트레이싱이 도입되었으나, HyDE 변환 단계가 현재 관찰되지 않음. - `synthesis/service.py:148` `_generate_hyde_answer`는 별도 LLM 호출이지만 `embedding` span 안에 숨어 latency·토큰이 구분되지 않음 - 질문 → 가상 답변 변환 결과가 저장되지 않아 "이 질문이 어떻게 변환됐는지" 재현·분석 불가 또한 `production.db.traces/spans`에 데이터가 쌓이고 있으나 직접 SQL 치지 않으면 열람이 불가능. 간단한 테이블 뷰 UI 가 필요. 관련: #91 ## 목적 - HyDE 변환 과정을 독립 span으로 분리해 단계별 latency·토큰 관찰 - 생성된 가상 답변(hypothetical doc) 을 영속 기록해 질문-변환 쌍 사후 조회 - trace 목록을 프론트에서 테이블 형태로 열람 (sql 없이) ## 작업 내용 ### 백엔드 — HyDE span - [ ] `synthesis/service.py` `_generate_hyde_answer` 호출을 `trace_span("hyde")`로 감싸기 - [ ] span `attributes`에 기록: `model`, `tokens`(input/output/total), `hyde_answer`(가상 답변 텍스트) - [ ] span 위치: `embedding` 이전 (`retrieve()` 내부) ### 백엔드 — trace 조회 API - [ ] `GET /api/traces` — 목록 (페이지네이션, filter: `root_operation`, `session_id`, `status`) - [ ] `GET /api/traces/{trace_id}` — 단일 trace + 모든 spans 반환 ### 프론트 — 트레이싱 뷰 - [ ] `/traces` 라우트 + 테이블 UI - 컬럼: `created_at`, `root_operation`, `status`, `total_ms`, `session_id`, `feedback`, 질문(`payload.question` 요약) - [ ] row 클릭 → 상세 패널: spans timeline, attributes/payload JSON, HyDE 변환 결과 포함 ## 비범위 - 고도화된 timeline 시각화(flamegraph 등) — 테이블 + 간단 span 리스트로 시작 - 외부 observability 스택(OTel collector/Jaeger) 연동 — #91 에서 이미 비범위 확정 - 실시간 스트리밍 — 새로고침 기반으로 시작
배경
#91 에서 도메인 전반 E2E 트레이싱이 도입되었으나, HyDE 변환 단계가 현재 관찰되지 않음.
synthesis/service.py:148_generate_hyde_answer는 별도 LLM 호출이지만embeddingspan 안에 숨어 latency·토큰이 구분되지 않음또한
production.db.traces/spans에 데이터가 쌓이고 있으나 직접 SQL 치지 않으면 열람이 불가능. 간단한 테이블 뷰 UI 가 필요.관련: #91
목적
작업 내용
백엔드 — HyDE span
synthesis/service.py_generate_hyde_answer호출을trace_span("hyde")로 감싸기attributes에 기록:model,tokens(input/output/total),hyde_answer(가상 답변 텍스트)embedding이전 (retrieve()내부)백엔드 — trace 조회 API
GET /api/traces— 목록 (페이지네이션, filter:root_operation,session_id,status)GET /api/traces/{trace_id}— 단일 trace + 모든 spans 반환프론트 — 트레이싱 뷰
/traces라우트 + 테이블 UIcreated_at,root_operation,status,total_ms,session_id,feedback, 질문(payload.question요약)비범위