Built-in tracing: no gen_ai.response.finish_reasons, and status OK on success
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- python
调研方向
Start with lib/_tracing/_work.py and inspect the Anthropic message span attributes and success status behavior described in the issue. Check the tracing tests for expected GenAI response attributes and span status, then verify the suggested finish reason and success status changes there; the issue notes Bedrock and Vertex clients are untested. Done means the finish reason follows the GenAI convention and successful spans leave status unset. A linked open pull request already addresses this issue.
由索引模型根据 Issue 内容生成。
描述
In anthropic 2.4.0 the anthropic.messages.create span records the stop reason as anthropic.message.stop_reason and sets no gen_ai.response.finish_reasons. Every other response attribute follows the GenAI conventions, so a backend that reads them finds everything except the finish reason.
The span also ends with status OK on success (lib/_tracing/_work.py line 68). Recording Errors says: "Span Status Code MUST be left unset if the instrumented operation has ended without any errors" (v1.44.0).
Tokens, cache counts, error.type and early-exit spans all matched the wire: https://plexito-de.github.io/spantruth/#anthropic-sdk--anthropic--basic--finish_reasons. Not tested: the Bedrock and Vertex clients.
Suggested fix: set gen_ai.response.finish_reasons to [stop_reason] beside the Anthropic attribute, and leave the status unset on success.
Since 1.14.0 the SDK traces whenever a tracer provider is registered, so an app with an instrumentation library (OpenLLMetry, OpenInference) reports each call on two spans with usage. Is ANTHROPIC_OPEN_TELEMETRY=false the intended answer there?
- 主要语言
- Python
- 星标
- 4.1k
- 派生
- 915
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
anthropics/anthropic-sdk-python 的其他 Issue
-
beta_tool validation errors reach the model as "Invalid arguments for function X" with no detail可能已有人在做 @mangeshraut712 于 32 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 72/100
anthropics/anthropic-sdk-python#2033 · 3 条评论 ·
-
`AnthropicBedrock` 2.x sends `anthropic_version: 2026-10-21`, which Bedrock rejects for Claude Sonnet 4.5, Opus 4.5 and Opus 4.6可能已有人在做 @charan-rathore 于 36 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 70/100
anthropics/anthropic-sdk-python#2031 · 1 条评论 ·
-
Three symlink tests in test_agent_toolset.py are missing the needs_symlinks marker可能已有人在做 @okxint 于 82 天前认领。 未关闭
难度 1/5 1 小时以内 新手友好度 92/100
anthropics/anthropic-sdk-python#1915 · 3 条评论 ·
-
Messages.parse (and AsyncMessages.parse) don't take cache_control?可能已有人在做 @AlphaFDE 于 86 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 72/100
anthropics/anthropic-sdk-python#1907 · 2 条评论 ·
-
Windows: os.fchmod in credential write-back bricks the OAuth refresh token可能已有人在做 @OllieinCanada 于 98 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
anthropics/anthropic-sdk-python#1868 · 1 条评论 ·
查看 anthropics/anthropic-sdk-python 的全部 Issue
相似的 Issue
-
bug harness
难度 2/5 1-3 小时 新手友好度 72/100
mruangutai/harness#2687 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
modal-labs/modal-client#4158 ·
-
good first issue
难度 1/5 1 小时以内 新手友好度 72/100
维护者通常 1 天内回复
-
难度 2/5 半天 新手友好度 72/100
The-Swarm-Corporation/swarms-rs#168 ·
维护者通常 1 天内回复
-
[BUG] SMTP listener now binds to EMAIL_PORT instead of 2525 since the gunicorn switch 5.0.3-ls373未关闭
难度 2/5 1-3 小时 新手友好度 72/100
linuxserver/docker-healthchecks#137 · 1 条评论 ·