Is Python multiprocessing supported?
- 主要语言
- Python
- 星标
- 339
- 派生
- 147
- PR 合并指标
- 30 天内没有已合并 PR
描述
Hi,
I've been trying to get AWS X-Ray working in my Python application where I spin up separate Python processes via Pool() and apply_async. I'm passing in the segment from .get_trace_entity and setting it in the child process, but I'm still getting exceptions that seem to suggest the segment isn't getting passed properly, e.g.:
```
2020-07-08 15:57:54,703] {{taskinstance.py:1088}} ERROR - 'Segment' object has no attribute 'sampled'
multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
File "/usr/local/lib/python3.7/multiprocessing/pool.py", line 121, in worker
result = (True, func(*args, **kwds))
File "/usr/local/lib/python3.7/site-packages/xxxx-0.1-py3.7.egg/xxxx/elt/extract/kinesis_handler.py", line 52, in push_to_kinesis
xray_recorder.begin_subsegment('push_to_kinesis')
File "/usr/local/lib/python3.7/site-packages/aws_xray_sdk/core/recorder.py", line 297, in begin_subsegment
if not segment.sampled:
AttributeError: 'Segment' object has no attribute 'sampled'
"""
```
Does X-Ray support tracking segments through separate processes, or am I just doing something wrong? I noticed in the documentation it only mentions ThreadPoolExecutor, and I know sharing state with separate processes can be a bit fiddly due to pickling.
Thanks in advance!
贡献指南
调研方向
从提到 ThreadPoolExecutor 以及 recorder 入口 get_trace_entity 和 begin_subsegment 的文档部分开始。复现 issue 中描述的 Pool() 和 apply_async 情况,然后确定是否支持跨独立进程的 tracing,或需要记录哪些行为;对于此用例,得出明确且经过测试的答案即表示完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- aws, python
- 领域
- backend, observability-sre
- Issue 类型
- 功能
- 难度
- 5/5
- 预计耗时
- 一周以上
- 活跃度
- 停滞
- 描述清晰度
- 需要澄清
- 新手友好度
- 25/100