OpenAI integration does not record cache-write tokens
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 76/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- python
调研方向
从 integrations/openai.py 第 283-289 行附近开始,检查 responses 和 chat-completions 的使用详情如何转换为 span 属性。为两种使用数据结构中的缓存写入 token 添加测试覆盖,然后运行 OpenAI 集成测试,并确认记录了 gen_ai.usage.input_tokens.cache_write。
由索引模型根据 Issue 内容生成。
描述
Version
2.71.0 (master @ 6a4eb20)
Steps to Reproduce
Call client.responses.create(...) or client.chat.completions.create(...) and get a response whose usage has input_tokens_details.cache_write_tokens (or prompt_tokens_details.cache_write_tokens) set, e.g. 96.
Expected Result
The span has gen_ai.usage.input_tokens.cache_write = 96, like the Anthropic integration.
Actual Result
No cache-write attribute. _calculate_responses_token_usage and _calculate_completions_token_usage only read cached_tokens (openai.py#L283-L289).
I have a small fix with a test: https://github.com/4ktLuffy/sentry-python/tree/fix/openai-cache-write-tokens. Happy to open a PR if that works for you.
- 主要语言
- Python
- 星标
- 2.2k
- 派生
- 682
- 平均合并
- 1 天 5 小时
- 30 天内合并 PR
- 269
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
getsentry/sentry-python 的其他 Issue
-
Improvement Python Spans
难度 2/5 1-3 小时 新手友好度 78/100
getsentry/sentry-python#7876 · 2 条评论 ·
维护者通常 1 天内回复
-
Python
难度 2/5 1-3 小时 新手友好度 68/100
getsentry/sentry-python#6992 · 1 条评论 ·
维护者通常 1 天内回复
-
Improvement Python
难度 2/5 1-3 小时 新手友好度 65/100
getsentry/sentry-python#6970 · 1 条评论 ·
维护者通常 1 天内回复
-
match_regex_list raises IndexError when a pattern list contains an empty string可能已有人在做 @wahajahmed010 于 103 天前认领。 未关闭Bug Python
难度 2/5 1-3 小时 新手友好度 74/100
getsentry/sentry-python#6504 · 1 条评论 ·
维护者通常 1 天内回复
-
Improvement Python Spans
难度 2/5 1-3 小时 新手友好度 85/100
getsentry/sentry-python#5833 · 1 条评论 ·
维护者通常 1 天内回复
查看 getsentry/sentry-python 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 85/100
维护者通常 1 天内回复
-
SR_SECURITY_DESCRIPTOR.fromString drops the SACL when no DACL is present可能已有人在做 @paul7436 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 88/100
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 85/100
equinor/fmu-sumo-uploader#302 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 75/100
modelscope/evalscope#1821 ·
维护者通常 1 天内回复
-
Sanity on ansible-core devel fails: ignore-2.23.txt references the removed import-3.9 test可能已有人在做 @yurnov 今天认领。 未关闭needs_triage
难度 1/5 1 小时以内 新手友好度 91/100
ansible-collections/kubernetes.core#1275 ·
维护者通常 1 天内回复