Skip to content

docs(observability): ApeRAG 可观测性需求对齐文档 v1#1952

Closed
earayu wants to merge 2 commits into
mainfrom
architect/observability-requirements-alignment
Closed

docs(observability): ApeRAG 可观测性需求对齐文档 v1#1952
earayu wants to merge 2 commits into
mainfrom
architect/observability-requirements-alignment

Conversation

@earayu

@earayu earayu commented Apr 30, 2026

Copy link
Copy Markdown
Collaborator

Summary

per earayu2 飞书 directive (via @飞书 DM msg=d3042add): 汇总近期可观测性相关需求, 整理详细文档, 跟其他人讨论并对齐 — 先不考虑如何实现, 讨论完成发 PR 合并.

核心驱动场景

  • 太钢 token 消耗追问 (谭怀远 飞书群): PG 无 usage 表 / LiteLLM callback 禁用 / worker 不记 token → 答不上来
  • 私有大模型 cost 担忧 (ou_1d75b5... 飞书): 客户私有部署 cost 是对外可见的运维必需品
  • Singapore 大 PDF 现场: per-window 耗时 / entity-relation 计数无可查询数据
  • 财务分摊 + 容量预测

文档定位

全路径 4 layer capability map

  • Layer A: API 层 (P3 defer)
  • Layer B: 索引 worker 层 (P1 worker lane lifecycle)
  • Layer C: 业务执行层 (P0 graph extraction 2 metric + P1 vector/fulltext + P2 retrieval)
  • Layer D: LLM 调用层 cross-cutting (P2 LLM ledger 独立 event family per Weston msg=94df61b3 — 优先级最高 P2 跟 P1 几乎同时启动)

LLM 调用账本字段对齐

llm_call_event 独立 event family:

  • model_name / provider / prompt_tokens / completion_tokens / total_tokens / cost_usd / latency_ms / status / error_code
  • call_purpose: chunking/extraction/embedding/answer/rerank/summarization
  • 关联维度: collection_id / document_id / window_id / run_id / call_id

Privacy hard gate (跨 phase 共同基线)

  • 永远不进 attrs: chunk_text / query_text / prompt_text / completion_text / error_message / traceback
  • AST data-flow gate (NOT 全文 grep) 防误伤合法 extraction 路径
  • error 类仅 error_code/error_type whitelist enum
  • DISABLE_TELEMETRY 部署级 opt-out

Test plan / 跨域协作方对齐

  • @符炫炜 spec author
  • @不穷 PM 实施时机 + dispatch
  • @earayu2 P0/P1/P2 trigger 决策 ratify
  • @Planetegg SRE 部署可视化 + retention 容量
  • @weston 架构师 cross-CR LLM ledger 独立 event family 设计
  • @ziang index/worker producer 接入点
  • @huangzhangshu testing privacy boundary scope + fail-safe
  • @dongdong FE dashboard typed schema 三层区分
  • @cuiwenbo FE typed schema sync 一致性

🤖 Generated with Claude Code

per earayu2 飞书 directive (via @飞书 msg=d3042add): 汇总近期可观测性相关需求, 跟其他人讨论并对齐 — 先不考虑如何实现, 讨论完成发 PR 合并.

## scope (NOT 实现)
- 全路径 4 layer capability map (API / worker / 业务执行 / LLM call)
- 各层 capability 字段 + 关联维度 + 优先级 + 驱动场景
- LLM 调用账本独立 event family (per Weston msg=94df61b3 + 太钢 token 追问 + 私有大模型 cost)
- privacy hard gate 跨 phase 共同基线
- 实施 phase 拆分 (P0 已 spec PR #1951 / P1+P2 trigger condition)
- 跨域协作方对齐确认表

## 驱动场景
- 太钢 token 消耗追问 (谭怀远 飞书): PG 无 usage 表 / LiteLLM callback 禁用 / 答不上来
- 私有大模型 cost 担忧 (ou_1d75b5... 飞书): 客户私有部署 cost 是对外可见运维必需品
- Singapore 大 PDF 现场 (Planetegg msg=1314ac59): per-window 耗时 / entity-relation 计数无可查询数据
- 财务分摊 + 容量预测 driving

## 优先级 (per 4 guardrail + 真实需求驱动)
- P0: graph extraction 2 metric (window + document) - earayu2 已 confirm 立即启动
- P1: worker lane lifecycle + vector/fulltext indexing
- P2: retrieval + LLM ledger (LLM ledger 优先级最高 P2, 跟 P1 几乎同时启动)
- P3: HTTP request producer (defer)

## Privacy hard gate
- 永远 NOT 进 attrs payload: chunk_text / query_text / prompt_text / completion_text / error_message / traceback
- AST data-flow gate (NOT 全文 grep) 防误伤合法 extraction 路径
- error 类仅 error_code/error_type whitelist enum
- DISABLE_TELEMETRY 部署级 opt-out

format: 类比 task #31 Phase A 自然中文 onboarding doc, 面向决策者 + 跨域协作方对齐 capability/scope/trigger/privacy boundary.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@earayu

earayu commented Apr 30, 2026

Copy link
Copy Markdown
Collaborator Author

Testing / acceptance CR: LGTM ✅

I reviewed this as the macro requirements alignment doc, not an implementation spec. The important acceptance boundaries are clear enough:

  • PR docs(task-89): ApeRAG 全路径埋点 spec v1 #1951 P0 remains scoped to graph extraction window/document metrics; this doc does not pull LLM ledger or dashboards into P0.
  • The cross-layer correlation keys are sufficient for future tests and SQL examples: collection_id, document_id, parse_version, document_index_id, window_id, run_id, call_id, and call_purpose.
  • LLM ledger is correctly treated as a separate P2 event family / ledger table and must cover both API process calls and indexing-worker calls, instead of relying on LiteLLM callback availability.
  • Privacy hard gate is consistent with P0: metadata-only, no prompt/completion/chunk/query/entity-description text, and no raw error messages or tracebacks.
  • The acceptance path is testable by phase: P0 via SQL/query + tests, P1 via admin aggregate schemas, P2 via ledger SQL + cost attribution examples.

Non-blocking NIT for future P2 spec: §3.2 lists LLM ledger fields as first-class fields, while §5 SQL examples read them from llc.attrs->>.... That is fine for a macro alignment doc, but the P2 implementation spec should choose one canonical shape (column vs JSON attrs) before tests are written, otherwise acceptance SQL and schema tests may drift.

No blocker from my lane.

… 1 cross-link

per dongdong msg=5256ebed + ziang msg=e702bfb4 NIT (双 lane converge):
- § 5 SQL 示例标 "概念示例" + cite "P2 spec lock 时 typed columns 优先, NOT JSON attrs"
- 防实现方直接照抄 attrs JSON 写法导致 cost/token aggregation 慢查询
- llm_call_event 独立 ledger table (per § 3.1 Weston msg=94df61b3 设计)

per huangheng msg=48b418c9 NIT 1:
- § 9 跨域协作方对齐表加 huangheng row
- 显式 cite Privacy hard gate framework 跟 PR #1951 § 3.1.5 attrs data-flow gate 一致 (Lesson #18 first-application demo)
- 防 future onboarding 漂移

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@earayu earayu closed this Apr 30, 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.

1 participant