ERROR:aws_xray_sdk.core.context:cannot find the current segment/subsegment, please make sure you have a segment open
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 35/100
- Tipo de issue
- Error
- Claridad
- Necesita aclaración
- Estado de actividad
- Estancado
- Stack tecnológico
- aws, python
- Área
- cloud, observability-sre
Línea de trabajo
Comienza con la reproducción generate_and_upload proporcionada, especialmente con xray_recorder.configure y el contexto in_segment alrededor de s3_client.upload_file. Ejecútala con Python 3.11.1 y aws-xray-sdk 2.14.0 y, a continuación, inspecciona cómo se comporta el segmento durante la carga y la limpieza. Se considera terminado cuando la carga sigue siendo exitosa, el error de contexto ha desaparecido y el segmento es visible en la consola de AWS X-Ray.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
``Hi,
I am experiencing an issue with the AWS X-Ray SDK for Python where segments are not being properly created or propagated, resulting in the following exception:
ERROR:aws_xray_sdk.core.context:cannot find the current segment/subsegment, please make sure you have a segment open
The file is being successfully being uploaded in my s3 bucket but the segment is not being traced.
Steps to Reproduce:
import json
import os
import boto3
from aws_xray_sdk.core import xray_recorder
from aws_xray_sdk.core import patch_all
import logging
from botocore.exceptions import NoCredentialsError, PartialCredentialsError
from aws_xray_sdk import global_sdk_config
from boto3.s3.transfer import TransferConfig
patch_all()
logging.basicConfig(level='ERROR')
logging.getLogger('aws_xray_sdk.core').setLevel(logging.ERROR)
.
.
.
.
def generate_and_upload(init, count):
session = boto3.Session(profile_name=aws_profile_name)
s3_client = session.client("s3")
# Create file path
file_path = os.path.join("generated", "data.json")
# Write data to the file
with open(file_path, "w") as file:
json.dump(
generate_json_document(init, count),
file,
separators=(",", ":"),
ensure_ascii=False,
)
xray_recorder.configure(service='data-generator')
with xray_recorder.in_segment('generate_and_upload') as segment:
trace_header = segment.trace_id
print(f"Trace Header: {trace_header}")
try:
trnasver_config = TransferConfig(max_concurrency=1)
s3_client.upload_file(
file_path,
f"{bucket}",
f"{path}",
ExtraArgs={"Metadata": {"X-Amzn-Trace-Id": trace_header}},
Config=trnasver_config,
)
print(
f"Uploaded"
)
finally:
xray_recorder.end_segment()
I tried to set os.environ['AWS_XRAY_SDK_ENABLED'] = 'false' and a dummy segment was created, but I am not able to see it in the AWS X-ray console.
I am using Python 3.11.1 and aws-xray-sdk is Version: 2.14.0
I have also tried to set off threading and also have 1 thread. The issue still exist,
@chanchiem
@luzfcb
@heitorlessa
- Lenguaje dominante
- Python
- Estrellas
- 339
- Forks
- 148
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de aws/aws-xray-sdk-python
-
psycopg connection context manager drops X-Ray tracing wrapper, so cursor execute calls are not tracedPosiblemente ocupada @reginaldalfret la tomó hace 14 días. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 68/100
aws/aws-xray-sdk-python#490 · 1 comentario ·
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 1/100
aws/aws-xray-sdk-python#460 ·
-
Next releaseAbierto
Dificultad 5/5 Más de una semana Aptitud para principiantes 20/100
aws/aws-xray-sdk-python#457 · 1 reacción ·
-
mysql-connector 9.2.0 - TypeError: 'MySQLConnection' object is not iterablePosiblemente ocupada @reginaldalfret la tomó hace 14 días. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 35/100
aws/aws-xray-sdk-python#453 ·
-
Bug: XRay SDK doesn't support pg8000 native driverQuizá libre de nuevo @leandrodamascena la tomó hace 627 días y no hay ningún pull request abierto. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 45/100
aws/aws-xray-sdk-python#451 · 2 comentarios · 1 reacción ·
Todos los issues de aws/aws-xray-sdk-python
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
Los mantenedores suelen responder en 1 día
-
enhancement good first issue Stellar Wave trivial
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
StellarCanary/ProtocolCanary-Fixtures#258 ·
Los mantenedores suelen responder en 1 día
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
IBM/ai-atlas-nexus#295 ·
Los mantenedores suelen responder en 6 días
-
github_actions
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
Hochfrequenz/aibap.mcp#578 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
mishraprafful/multihull#150 ·
Los mantenedores suelen responder en 1 día