Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

OTLP 属性补 v4 原生映射键——sessionId/cost 只落 metadata(Sessions 分组与成本列不填充)

未关闭
#138 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
66/100
Issue 类型
功能
描述清晰度
描述清楚
活跃度
活跃
技术栈
rust
领域
observability

调研方向

Start by reading src/observability/collector.rs and trace how the existing session and cost attributes are added to root and step records. Keep the current attributes for compatibility while adding the v4 native mapping keys described in the issue. Done means a real run fills events_full.session_id and cost_details.total with the session ID and CLI cost, and Sessions can group by session.

由索引模型根据 Issue 内容生成。

描述

场景 gap 单(okguitar 提报)· 优先级 P3 · 依赖:无

基线 HEAD = bba862ab(#124 落地点)。

Summary

#124 的 OTLP 导出器(src/observability/collector.rs)按本单约定的 langfuse.trace.* 家族上报:session 关联 = langfuse.trace.sessionId(ATTR_TRACE_SESSION_ID),成本 = observation metadata cost_usd。实测(Langfuse v4.50.0 events_only,真实 run)两条记录已落库,但 v4 的原生映射键不同,导致原生列不填充:

  • session:v4 映射表要求 session.id 或 langfuse.session.id → 当前只进 metadata map,events_full.session_id 列为空、Sessions 视图不分组;
  • 成本:v4 映射表要求 langfuse.observation.cost_details(JSON)或 gen_ai.usage.cost → 当前 cost_details 为空,UI 成本列/聚合为 0(数值本身在 metadata.values 可见且与 CLI 一致)。

影响

Langfuse 上「session 维度浏览」与「run 成本视图」不可用(数据在但不聚合/不分组);#110-#123 验收里凡需要按 session/成本筛选的条目会看到空。不影响 trace 本体与 usage/耗时/finish_reason 可见性。

证据(实测)

  • 真实 run(bba862ab 构建,prompt "Reply with exactly the single word: PONG"):root recursive.run metadata_values 含 attributes.langfuse.trace.sessionId=2026-10-05T16-07-47Z-tmp-lf-e2e、cost_usd=0.0009409288,而同行 session_id 列空、cost_details {};trace_id=61060ecb07728484fd5b73d22c8112a3。
  • 映射表(官方):https://langfuse.com/integrations/native/opentelemetry —— session:langfuse.session.id / session.id;cost:langfuse.observation.cost_details / gen_ai.usage.cost(=total)。

建议

在 collector 增补(不替换,保持 plaita 兼容)v4 原生键:root/step 记录并行上报 session.id(值同现有 sessionId)与 langfuse.observation.cost_details({"total": usd},或等价 gen_ai.usage.cost);现有 langfuse.trace.*/cost_usd 保留。

验收

真实 run 后:events_full.session_id 填充为该 run 的 session id;对应 record 的 cost_details.total == CLI 输出 cost;Sessions 视图可按 session 分组。

主要语言
Rust
星标
4
派生
0
平均合并
5 小时 32 分钟
30 天内合并 PR
7

环境准备

  • 提供 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 没有贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

jeffkit/recursive 的其他 Issue

查看 jeffkit/recursive 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。