Segment context not propagated when `asyncio.run_in_executor` is used
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 35/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- aws, python
调研方向
从 README 中关于线程池 trace 传播的指导以及与 loop.run_in_executor 一起使用的 AsyncContext 入口点开始。复现最小化示例,然后跟踪 run_task 如何获取当前 segment,并验证在传播为自动进行时,示例能够完成且不会出现 segment 缺失或 subsegment 缺失的消息。
由索引模型根据 Issue 内容生成。
描述
(Minimised) Example code:
import asyncio
from aws_xray_sdk.core import xray_recorder
from aws_xray_sdk.core import patch_all
from aws_xray_sdk.core.async_context import AsyncContext
import boto3
xray_recorder.configure(service="Test app", sampling=False, context=AsyncContext())
patch_all()
def run_task():
s3_client = boto3.client("s3")
s3_client.list_buckets()
async def main():
loop = asyncio.get_running_loop()
xray_recorder.begin_segment("test")
await loop.run_in_executor(None, run_task)
xray_recorder.end_segment()
asyncio.run(main())
Output:
cannot find the current segment/subsegment, please make sure you have a segment open
No segment found, cannot begin subsegment s3.
cannot find the current segment/subsegment, please make sure you have a segment open
cannot find the current segment/subsegment, please make sure you have a segment open
No segment to end
cannot find the current segment/subsegment, please make sure you have a segment open
I understand from the README that when using a thread pool (which is the default executor), the trace entity needs to be manually propagated. Could it be propagated automatically?
I'm asking because in the use case I have, a 3rd party library I'm using is making the call so I couldn't patch the call sites easily.
- 主要语言
- Python
- 星标
- 340
- 派生
- 148
- 平均合并
- 7 天 8 小时
- 30 天内合并 PR
- 2
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
aws/aws-xray-sdk-python 的其他 Issue
-
psycopg connection context manager drops X-Ray tracing wrapper, so cursor execute calls are not traced可能已有人在做 @reginaldalfret 于 23 天前认领。 未关闭
难度 3/5 1-2 天 新手友好度 68/100
aws/aws-xray-sdk-python#490 · 1 条评论 ·
-
难度 5/5 一周以上 新手友好度 1/100
aws/aws-xray-sdk-python#460 ·
-
Next release未关闭
难度 5/5 一周以上 新手友好度 20/100
aws/aws-xray-sdk-python#457 · 1 个 reaction ·
-
mysql-connector 9.2.0 - TypeError: 'MySQLConnection' object is not iterable可能已有人在做 @reginaldalfret 于 23 天前认领。 未关闭
难度 3/5 1-2 天 新手友好度 35/100
aws/aws-xray-sdk-python#453 ·
-
难度 4/5 3-5 天 新手友好度 35/100
aws/aws-xray-sdk-python#452 · 1 个 reaction ·
查看 aws/aws-xray-sdk-python 的全部 Issue
相似的 Issue
-
难度 1/5 1-3 小时 新手友好度 68/100
FavioVazquez/showtime#101 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 83/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 65/100
rossant/awesome-math#199 ·
-
难度 2/5 1-3 小时 新手友好度 68/100
nautechsystems/nautilus_trader#5365 ·
维护者通常 1 天内回复
-
Examples say cnx未关闭documentation embedded
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复