Scope._transaction not cleared when span is set to None
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 76/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- python
调研方向
从 Scope.span setter 开始,跟踪 Transaction 和 None 的赋值如何更新 _transaction;然后检查附近的 Scope 测试,了解此处所述的上下文复制和事务退出行为。添加一个回归测试,展示将 span 设置为 None 会清除事务,而分配一个子 span 不会清除事务,并运行相关的 Scope 测试套件。
由索引模型根据 Issue 内容生成。
描述
How do you use Sentry?
Sentry Saas (sentry.io)
Version
2.68.1
Steps to Reproduce
Start a top-level transaction via OpenAIIntegration (or any path that sets scope.span to a Transaction).
Nest work that restores scope.span to None when the transaction finishes (normal with / start_transaction exit).
Later, on the same Scope (same thread, or a worker that got the Scope via copy_context()), capture an unrelated error with no active transaction.
Expected Result
After scope.span = None, scope._transaction is cleared so later errors are not attributed to the finished transaction (culprit / transaction name should not stick).
sentry-sdk 2.68.1 (deps: certifi, urllib3>=1.26.11)
Actual Result
Scope.span’s setter sets _transaction when given a Transaction, but does not clear _transaction when span is None. Stale _transaction remains; unrelated errors inherit the old transaction name (e.g. responses gpt-5.6-luna) as culprit even when the stack has nothing to do with that LLM call.
Clearing on every non-Transaction would be wrong: child spans set scope.span = self while a transaction is still live. The fix clears _transaction only when span is None.
- 主要语言
- Python
- 星标
- 2.2k
- 派生
- 680
- 平均合并
- 1 天 1 小时
- 30 天内合并 PR
- 267
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
getsentry/sentry-python 的其他 Issue
-
Bug Python Waiting for: Product Owner
难度 1/5 1 小时以内 新手友好度 90/100
getsentry/sentry-python#7827 · 3 条评论 ·
维护者通常 1 天内回复
-
Python Task
难度 2/5 1-3 小时 新手友好度 65/100
getsentry/sentry-python#7663 · 1 条评论 ·
维护者通常 1 天内回复
-
Python Task
难度 2/5 1-3 小时 新手友好度 65/100
getsentry/sentry-python#7652 · 1 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
Remove send_default_pii from httpx可能已有人在做 @sentrivana 于 8 天前认领。 未关闭Python
难度 2/5 1-3 小时 新手友好度 65/100
getsentry/sentry-python#7653 · 1 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
Remove send_default_pii from httpx2可能已有人在做 @sentrivana 于 8 天前认领。 未关闭Python
难度 2/5 1-3 小时 新手友好度 65/100
getsentry/sentry-python#7654 · 1 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
查看 getsentry/sentry-python 的全部 Issue
相似的 Issue
-
good first issue hacktoberfest
难度 1/5 1 小时以内 新手友好度 92/100
维护者通常 1 天内回复
-
tool-calling
难度 2/5 1-3 小时 新手友好度 88/100
vllm-project/vllm#59838 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 92/100
raullenchai/Rapid-MLX#4042 ·
维护者通常 1 天内回复
-
documentation
难度 1/5 1 小时以内 新手友好度 92/100
transitmatters/mbta-slow-zone-bot#70 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 66/100
open-webui/open-webui#31871 · 1 条评论 ·
维护者通常 1 天内回复