Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

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

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
aws, python

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.

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.

    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()
Lingua principale
Python
Stelle
339
Fork
147
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di aws/aws-xray-sdk-python

Tutte le issue di aws/aws-xray-sdk-python

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.