Is Python multiprocessing supported?
- Langage dominant
- Python
- Étoiles
- 338
- Forks
- 147
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
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!
Guide de contribution
Ouvrir le guide de contribution
Piste de recherche
Commencez par la section de la documentation qui mentionne ThreadPoolExecutor ainsi que les points d’entrée du recorder get_trace_entity et begin_subsegment. Reproduisez le cas Pool() et apply_async décrit dans l’issue, puis déterminez si le tracing dans des processus séparés est pris en charge ou quel comportement doit être documenté ; le travail est terminé lorsqu’une réponse claire et testée existe pour ce cas d’utilisation.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- aws, python
- Domaine
- backend, observability-sre
- Type d'issue
- Fonctionnalité
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Activité
- À l'abandon
- Clarté
- À clarifier
- Accessibilité débutants
- 25/100