Description
Add OTel auto-instrumentation to the didwebvh FastAPI server with centralized OTel init covering both traces and metrics, and SQLAlchemy database tracing.
Requirements
- Add
opentelemetry-instrumentation-fastapi, opentelemetry-instrumentation-logging, opentelemetry-instrumentation-sqlalchemy to server/pyproject.toml
- Create
server/app/otel.py for centralized OTel init — configure both TracerProvider (BatchSpanProcessor + OTLPSpanExporter) and MeterProvider (PeriodicExportingMetricReader + OTLPMetricExporter)
- Call OTel init from
server/main.py before uvicorn.run (must be active before uvicorn imports the app module)
- Apply
FastAPIInstrumentor.instrument_app(app) in server/app/__init__.py where app is defined (uses modern lifespan context manager)
- Apply
SQLAlchemyInstrumentor().instrument(engine=self._engine) in server/app/plugins/storage.py → StorageManager.__init__, immediately after self._engine is first created
Acceptance Criteria
Description
Add OTel auto-instrumentation to the didwebvh FastAPI server with centralized OTel init covering both traces and metrics, and SQLAlchemy database tracing.
Requirements
opentelemetry-instrumentation-fastapi,opentelemetry-instrumentation-logging,opentelemetry-instrumentation-sqlalchemytoserver/pyproject.tomlserver/app/otel.pyfor centralized OTel init — configure bothTracerProvider(BatchSpanProcessor + OTLPSpanExporter) andMeterProvider(PeriodicExportingMetricReader + OTLPMetricExporter)server/main.pybeforeuvicorn.run(must be active before uvicorn imports the app module)FastAPIInstrumentor.instrument_app(app)inserver/app/__init__.pywhereappis defined (uses modernlifespancontext manager)SQLAlchemyInstrumentor().instrument(engine=self._engine)inserver/app/plugins/storage.py→StorageManager.__init__, immediately afterself._engineis first createdAcceptance Criteria
trace_idpresent in stdout log records)