The API starts without logging, metrics or request IDs if their imports fail, and records no reason

Aperta
#1,041 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

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

Direzione di ricerca

Start with backend/app/main.py around lines 30-48, where the monitoring imports and exception handling are defined, and inspect the /health/ready endpoint. First determine which logging, metrics, and request-ID components are required outside development and test, then preserve the failed exception for optional components and expose degraded readiness. Add a test that makes each import fail and verifies whether startup stops or readiness reports degraded.

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

Descrizione

bug post-launch

backend/app/main.py (lines ~30-48) imports the logging setup, the Prometheus middleware and the request-ID middleware inside try: ... except Exception: _monitoring_imports_ok = False (marked # pragma: no cover). If any of those imports fails, the API starts without structured logging, metrics or request IDs, and nothing records why: the exception is discarded.

Expected: decide which of these are optional. A failure to import a required one stops startup outside development/test (as a broken module install already does); an optional one logs the exception and shows up in /health/ready as degraded. A test imports main with one of them made to fail and checks the result. Found in a code review (2026-10-06).

Lingua principale
Python
Stelle
0
Fork
4
Merge medio
5h 36m
PR unite (30g)
509

Preparare l'ambiente

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 Controlvar/controlvar

Tutte le issue di Controlvar/controlvar

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.