decentralized-identity / decentralized-identity/didwebvh-server-py
Observability: Initial instrumentation
- Dominant language
- Python
- Stars
- 4
- Forks
- 6
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 2
Description
## 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
- [ ] FastAPI request spans visible in Tempo
- [ ] SQLAlchemy/psycopg2 query spans appear as children
- [ ] HTTP RED metrics appear in Mimir
- [ ] Log correlation enabled (`trace_id` present in stdout log records)
- [ ] No regression in existing test suite
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.