Implement frontend and backend observability alignment
Align frontend and backend error observability with correlation IDs and structured telemetry for distributed tracing across systems. Backend changes: - Add CorrelationIdMiddleware to generate/extract correlation IDs - Include correlation_id in all ErrorResponse objects - Store correlation ID in structlog contextvars for automatic inclusion in logs - Add correlation ID to response headers (X-Correlation-ID) Frontend changes: - API client automatically generates session-scoped UUID4 and includes X-Correlation-ID header in all requests - Extract correlation ID from API error responses - Update error handlers to use telemetry with correlation IDs - Add telemetry logging to ErrorBoundary, PageErrorBoundary, SectionErrorBoundary - Implement redaction utilities for privacy-safe logging of sensitive data Documentation: - Add observability guidelines to Web-Development.md * Correlation ID usage patterns * Privacy & security best practices * Telemetry event structure * Redaction utilities for sensitive data - Add distributed tracing architecture section to Architecture.md * Correlation ID flow across frontend/backend * Example troubleshooting scenario * Implementation details for future enhancements Testing: - Add comprehensive tests for correlation middleware - Update error boundary tests to verify telemetry integration - Verify TypeScript and ESLint pass with no warnings Fixes: Issue #40 - Frontend and backend observability are not aligned Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -1,43 +1,3 @@
|
||||
## 38) History archive query paths may need explicit indexing plan
|
||||
- Where found:
|
||||
- [backend/app/db.py](backend/app/db.py)
|
||||
- [backend/app/repositories/history_archive_repo.py](backend/app/repositories/history_archive_repo.py)
|
||||
- Why this is needed:
|
||||
- Large archive datasets can degrade filter/sort performance.
|
||||
- Goal:
|
||||
- Add indexes aligned with real query patterns.
|
||||
- What to do:
|
||||
- Benchmark common history queries.
|
||||
- Add migration with targeted indexes.
|
||||
- Possible traps and issues:
|
||||
- Extra indexes increase write cost and DB size.
|
||||
- Docs changes needed:
|
||||
- Add DB performance/indexing section for history.
|
||||
- Doc references:
|
||||
- [Docs/Backend-Development.md](Docs/Backend-Development.md)
|
||||
- https://www.sqlite.org/queryplanner.html
|
||||
|
||||
---
|
||||
|
||||
## 39) No explicit DI container strategy for backend service graph
|
||||
- Where found:
|
||||
- [backend/app/dependencies.py](backend/app/dependencies.py)
|
||||
- [backend/app/services](backend/app/services)
|
||||
- Why this is needed:
|
||||
- Dependency construction and lifecycle are partly implicit.
|
||||
- Goal:
|
||||
- Define a clear dependency wiring pattern for services and repositories.
|
||||
- What to do:
|
||||
- Create service composition root pattern and document usage.
|
||||
- Possible traps and issues:
|
||||
- Over-engineering if container abstraction is too heavy for current size.
|
||||
- Docs changes needed:
|
||||
- Add dependency wiring chapter.
|
||||
- Doc references:
|
||||
- [Docs/Architekture.md](Docs/Architekture.md)
|
||||
|
||||
---
|
||||
|
||||
## 40) Frontend and backend observability are not aligned
|
||||
- Where found:
|
||||
- [backend/app/main.py](backend/app/main.py)
|
||||
|
||||
Reference in New Issue
Block a user