lili
958f78f523
contract-gates / contract-gates (push) Has been cancelled
docs-gate / docs-gate (push) Has been cancelled
feat(obs): 阶段四观测面二 Python 侧 token metric——llm_tokens{kind} + llm_cache_hit_rate
补面五(game-cloud GenMetrics)拿不到的两个纯 Python 侧 token 维度 metric:
llm_tokens(Counter,kind=input/output/cached)与 llm_cache_hit_rate(Histogram,
每 run 命中率 [0,1])。复用波③ 既有 OTLP 基础设施(开关 CHEAP_OTLP_ENDPOINT、
端点解析、代理旁路、service.name=cheap-gen-worker、best-effort 铁律),换 OTLP
metrics 通道;默认关字节不变、绝不咬生成、与面五 5 个 metric 零重叠不双计。
关键约束(主控亲验坐实):生产 Service 路拿不到 cached——trace.py 组 cost.tokens
只填 in/out,agentscope ModelCallEndEvent 只有 input_tokens/output_tokens 无
cached 字段。故 Service 路(on_reply 只读嗅探 in/out、_metric_emitted 幂等)传
cached=None 如实降级:只发 input/output 计数,不发 cached 计数与 cache_hit_rate,
绝不塞 0 伪造命中率。CLI/批跑路(RecordingOpenAIChatModel.records[2])cached 可得、
两 metric 全发。生产 Service 路发 cached 需 per-POST RecordingModel 或 tier2
breaker 存 cached token,均超本次最小改动边界,列 follow-up。
主控终审:亲跑 tests/test_cheap_otlp_sink.py + test_cheap_service_app.py 29 passed、
全量回归 392 passed/1 skipped;逐条读承重 diff(默认关守卫/best-effort/不双计/
cached 诚实降级/MeterProvider 进程单例防线程泄漏/cached 截 [0,input]/除零守卫)。
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-05 23:57:40 -07:00
..
2026-06-29 01:04:55 -07:00
2026-06-29 01:04:55 -07:00
2026-07-03 21:11:31 -07:00
2026-07-03 21:11:31 -07:00
2026-06-29 02:34:06 -07:00
2026-06-27 08:47:13 -07:00
2026-07-04 00:41:56 -07:00
2026-06-26 02:42:14 -07:00
2026-06-27 02:01:20 -07:00
2026-07-03 14:15:59 -07:00
2026-07-02 13:34:57 -07:00
2026-07-05 23:57:40 -07:00
2026-07-05 23:57:40 -07:00
2026-07-02 21:09:44 -07:00
2026-06-30 01:39:06 -07:00
2026-07-03 14:51:36 -07:00
2026-06-26 11:00:00 -07:00
2026-06-26 02:42:14 -07:00
2026-07-03 14:21:34 -07:00
2026-06-28 02:17:41 -07:00
2026-06-27 10:41:16 -07:00
2026-07-03 14:51:36 -07:00
2026-07-03 14:17:54 -07:00
2026-07-02 23:48:41 -07:00
2026-07-05 22:50:10 -07:00
2026-07-02 21:09:44 -07:00
2026-07-04 00:46:09 -07:00
2026-07-03 14:02:53 -07:00
2026-07-01 05:22:49 -07:00
2026-06-28 02:17:41 -07:00
2026-06-30 01:39:06 -07:00
2026-06-26 02:42:14 -07:00
2026-07-03 14:21:34 -07:00
2026-06-26 02:42:14 -07:00
2026-06-30 01:39:05 -07:00
2026-07-05 20:30:04 -07:00
2026-06-28 02:17:41 -07:00
2026-07-05 20:30:04 -07:00
2026-07-03 19:12:35 -07:00