Consider using warnings over logging.warning for important messages
@NathanielRN ya está trabajando en esto.
Desde el 5/7/2022.
Evaluación
Este issue todavía no se ha evaluado.
Descripción
Hello X-Ray team!
I've recently discovered that tracing annotations with - or spaces in the name are silently dropped at the SDK level. When looking for a possible cause, I've found out X-Ray documentation calls this out in the API Segment Document schema page.
It would've been quicker to spot this issue if X-Ray SDK were to use the standard library Warnings package. This allows library maintainers to warn their users and give them a chance to suppress certain filters at will.
What's the difference between logging.warning vs warnings.warn?
For Logging, it's a good practice for library owners to use a NullHandler. This means any logging message produced by a library will be silently dropped, unless the consumer explicitly enables the library logging in question (or sets a Root logger).
In contrast, warnings.warn will notify consumers that something it's worth investigating. They also support categories of warnings to allow complex libraries to have multiple warnings, so their consumers can explicitly disable a subset of warnings without having to know every possible message to filter out.
Here's an example in Lambda Powertools for Python where we warn customers if they have no metrics to be flushed. This will happen regardless of how they configure their loggers. If they're intentional about having no user-defined metrics, they suppress this warning altogether with warnings.filterwarnings("ignore", "No metrics to publish*").
Hopefully this will help strike a balance between not interrupting customers at runtime while warning them they might be losing important tracing information.
Thank you!
- 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 18 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 17 días. Abierto
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
-
SSM GetParameter throttling during concurrent workflow launchesPosiblemente ocupada @alexiswl la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 80/100
-
[Bug] Dev image build fails: `npm install` in the root Dockerfile runs out of memory (exit 134)Posiblemente ocupada @andest01 la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Los mantenedores suelen responder en 1 día
-
Rename FunctionalRole BOT_DEV to DEV_STAFFPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abiertoenhancement good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 79/100
pesu-dev/discord_bot#97 ·
-
Dificultad 1/5 1-3 horas Aptitud para principiantes 88/100
gradio-app/gradio#13964 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 93/100
BSData/horus-heresy-3rd-edition#3232 · 1 comentario ·
Los mantenedores suelen responder en 1 día