1.7 KiB
1.7 KiB
type, node_id, title, date
| type | node_id | title | date |
|---|---|---|---|
| metric | metric:ocr-call-success | OCR 治理调用成功率与错误分类分布 | 2026-07-21 |
OCR 治理调用成功率与错误分类分布
- 数据源:
llm_calls表(复用,无新表;M3 设计 §7)。OCR 行特征:provider="monkey"、tokens=0、cost=NULL、ttft/inter=NULL、cache_hit=0;messages为<ocr:text|layout|document image_bytes=N>占位(图像 bytes 绝不入库),response为 text 截断 200 字 /<elements n=X pages=Y>摘要。 - 埋点位置(唯一路径,禁止旁路):
src/polygateway/ocr.pyOcrClient 治理循环内经TelemetryEmitter.emit_attempt(单 helper 铁律),每次尝试(成功/失败/取消)必录;写失败 warning 降级不冒泡。 - 指标口径:
- 调用成功率 =
error IS NULL行数 / 总行数(按 provider="monkey" 过滤,窗口按 run/日); - 错误分类分布 =
error非空行按异常类名前缀(Transient/SourceDead/RequestRejected/ResultInvalid/CircuitOpen/AllSourcesExhausted)归组计数; - 端点维度经
messages占位前缀(ocr:text/ocr:layout/ocr:document)区分,或直接用operation列(recognize_text/parse_layout/parse_document);文档行的response摘要为<document elements=N pages=M md_chars=K>,不含正文; - 延迟 =
latency_ms分位数(text、layout、document 分列——后两者含两段 HTTP,显著更慢;document 随页数增长,约 1.5 s/页[2026-10-21 实测,n=3、无争用,非 SLA],不要与 layout 混算分位数)。
- 调用成功率 =
- 评估基线: 待 P7 OCR soak 首跑后建立(健康双真源池预期成功率 ≥98%,故障池口径阈值在 P7 计划冻结);单调用延迟基线以 integration 实测为初值(2026-07-21 手测: /ocr/text 约 3-5s,/parse 约 5-15s)。