Coverage for app/main.py: 100%

18 statements  

« prev     ^ index     » next       coverage.py v7.14.1, created at 2026-06-16 20:06 +0000

1from prometheus_fastapi_instrumentator import Instrumentator 

2from opentelemetry.instrumentation.fastapi import FastAPIInstrumentor 

3from opentelemetry.instrumentation.sqlalchemy import SQLAlchemyInstrumentor 

4 

5from app.core.logging import logging_config 

6from fastapi import FastAPI 

7from app.api.v1.router import api_router 

8from app.core.middleware import RequestLoggingMiddleware, CorrelationIDMiddleware 

9from app.core.tracing import tracing_config 

10from app.core.database import engine 

11 

12logging_config() 

13tracing_config() 

14 

15app = FastAPI( 

16 title="Mars Probe Simulator", 

17 description=( 

18 "A production-style backend API for simulating Mars probes, built with FastAPI. " 

19 "It demonstrates a clean layered architecture, async-first design, PostgreSQL-ready " 

20 "persistence, and endpoints for probe setup, movement, and status checks." 

21 ), 

22) 

23 

24Instrumentator().instrument(app).expose(app) 

25FastAPIInstrumentor.instrument_app(app, excluded_urls="^/metrics$") 

26SQLAlchemyInstrumentor().instrument(engine=engine.sync_engine) 

27 

28 

29app.include_router(api_router, prefix="/api/v1") 

30app.add_middleware(RequestLoggingMiddleware) 

31app.add_middleware(CorrelationIDMiddleware)