Warning 'No subsegment to end' written to logs when X-Ray SDK is disabled.
@srprash ya está trabajando en esto.
Desde el 18/4/2022.
Evaluación
Este issue todavía no se ha evaluado.
Descripción
When running locally, I don't want X-Ray to be enabled. Out of the box, the sam local start-lambda logs warnings about the X-Ray SDK, but I'm trying to disable the SDK entirely.
I'm disabling the SDK by checking the environment variable AWS_SAM_LOCAL. If it's present and it's value is 'true', then the global SDK config is disabled. Then when I patch the desired libraries, nothing happens and there are no [INFO] logs. That's good.
from aws_xray_sdk import global_sdk_config as global_xray_sdk_config
from aws_xray_sdk.core import patch, xray_recorder
if environ.get('AWS_SAM_LOCAL', 'false') == 'true':
global_xray_sdk_config.set_sdk_enabled(False)
patch(['boto3', 'requests'])
However, I have a function that adds a subsegment, and this is emitting logs even with the X-Ray SDK disabled.
def add_xray_subsegment(name: str, annotations: dict, e: Exception = None) -> None:
with xray_recorder.capture(name) as subsegment:
a = {k: v for k, v in annotations.items() if v is not None}
for k, v in a.items():
subsegment.put_annotation(k, v)
if e:
limit = xray_recorder._max_trace_back
stack = traceback.extract_stack(limit=limit)
subsegment.add_exception(e, stack)
[WARNING] {date} {request-id} No subsegment to end.
While the function still works locally, it's causing delay because people don't expect to see these warnings in the logs and are wasting their time investigating.
I'm guessing this isn't expected behaviour with the SDK disabled; so is this a bug, or is there some other configuration that I can add to remove the warnings?
Thanks.
- Lenguaje dominante
- Python
- Estrellas
- 339
- Forks
- 147
- Métricas de merge de PR
- Sin PR fusionados en 30 d
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
-
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 release Abierto
Dificultad 5/5 Más de una semana Aptitud para principiantes 20/100
aws/aws-xray-sdk-python#457 · 1 reacción ·
-
Dificultad 3/5 1-2 días Aptitud para principiantes 35/100
aws/aws-xray-sdk-python#453 ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
aws/aws-xray-sdk-python#452 · 1 reacción ·
Todos los issues de aws/aws-xray-sdk-python
Issues similares
-
[Bug] reef-hermes tells me to resume with hermes --resume, which does not work from my shell Abiertoarea: harness bug status: needs-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Human-Agent-Society/reef#625 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 80/100
learningequality/kolibri#15351 · 2 comentarios ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
-
Name consistency Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
eellak/triplestore#65 · 1 comentario ·