aws / aws/aws-xray-sdk-python

ERROR: cannot find the current segment/subsegment when segment is open and uploading file to s3.

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

Descrizione

Currently using python version 3.9, botocore version 1.29.50, aws_xray_sdk version 2.11.0

When I run the code snippet below I get an error saying there's no open segment for the calls the use upload file. The subsequent calls using put_object have no issues and show up in the segment data. Logging the trace_id was also successful.

```python
patch_all()
xray_recorder.configure(context_missing='LOG_ERROR', daemon_address='localhost:2000')
segment = xray_recorder.begin_segment('test segment')

s3_resource = boto3.resource("s3")

# These give the error
s3_resource.Bucket('resultfiles-test' ).upload_file('hello_world.txt', 'hello_world.txt')
logger.info(f'trace_id: {xray_recorder.current_segment().trace_id}')
s3_resource.Object('resultfiles-test', 'hello_world.txt').upload_file(Filename='hello_world.txt')
logger.info(f'trace_id: {xray_recorder.current_segment().trace_id}')

# These work
s3_resource.Bucket('resultfiles-test' ).put_object(Key='hello_world.txt', Body=b'hello world')
s3_resource.Object('resultfiles-test', 'hello_world.txt').put(Body=b'hello_world.txt')
with open('hello_world.txt', 'r') as f:
s3_resource.Object('resultfiles-test', 'hello_world.txt').put(Body=f.read())

xray_recorder.end_segment()
```

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Riproduci lo snippet fornito con Python 3.9, botocore 1.29.50 e aws_xray_sdk 2.11.0. Confronta il contesto del segmento durante le chiamate S3 a upload_file con le chiamate funzionanti a put_object; il lavoro è completato quando i caricamenti non segnalano più l'assenza del segmento corrente e continuano a essere rappresentati nei dati del segmento.

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

Valutazione

Stack tecnologico
aws, python
Ambito
cloud, observability-sre
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 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.