aws / aws/aws-xray-sdk-python

Support boto3 S3 transfer manager

Abierto
#52 14 comentarios 15 reacciones 0 asignados Ver en GitHub
enhancement
Lenguaje dominante
Python
Estrellas
338
Forks
147
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

[boto3](https://github.com/boto/boto3) has a few high-level S3 API calls like `upload_file`, `download_file` which depends on [s3transfer](https://github.com/boto/s3transfer) to perform multi-threaded object puts/gets to increase through put. This will result in a `SegmentNotFoundException` as the X-Ray recorder tries to capture the "real" S3 API call but it loses the context because the actual http call is in a worker thread from the thread pool.

The S3 transfer manager under the hood uses `futures.ThreadPoolExecutor` per https://github.com/boto/s3transfer/blob/develop/s3transfer/futures.py#L370 but there is no proper API on `boto3` client level to propagate context from user code. And requiring user code changes is not a good customer experience.

The SDK should somehow monkey-patch S3 transfer manager so that it automatically propagate context to all worker threads so each http outbound call is captured and attached to its parent segment or subsegment properly.

Library `django-storages` or any storage library that supports S3 as back-end and uses `boto3` certain APIs might face the same issue.

More detailed technical deep dive could be found here: https://github.com/aws/aws-xray-sdk-python/issues/4.

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Comienza con las APIs de boto3 S3 mencionadas en el issue, especialmente upload_file y download_file, y luego lee s3transfer/futures.py alrededor de la implementación de ThreadPoolExecutor referenciada. Usa el issue enlazado de aws-xray-sdk-python para la investigación técnica detallada. El trabajo estará terminado cuando las llamadas HTTP de los worker threads se capturen y se asocien a su segmento o subsegmento padre sin requerir cambios en el código del usuario.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
aws, python
Área
backend-api-design, cloud
Tipo de issue
Nueva funcionalidad
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.