aws / aws/aws-xray-sdk-python

Support boto3 S3 transfer manager

Aperta
#52 14 commenti 15 reazioni 0 assegnatari Vedi su GitHub
enhancement
Lingua principale
Python
Stelle
338
Fork
147
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

[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.

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia con le API S3 di boto3 indicate nell’issue, in particolare upload_file e download_file, quindi leggi s3transfer/futures.py intorno all’implementazione di ThreadPoolExecutor a cui si fa riferimento. Usa l’issue collegata di aws-xray-sdk-python per l’approfondimento tecnico. Il lavoro è completo quando le chiamate HTTP dei worker threads vengono acquisite e associate al segmento o sottosegmento padre senza richiedere modifiche al codice dell’utente.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
aws, python
Ambito
backend-api-design, cloud
Tipo di issue
Funzionalità
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.