# Observability 001: Preprod Foundation ## Goal Add the first preproduction observability foundation for Socialize so the operator can tell whether the app is healthy and whether core workflows are being used. ## Feature Spec - `docs/FEATURES/observability.md` ## Scope - Add backend OpenTelemetry registration for traces and metrics. - Add structured JSON console logging with request correlation context. - Add aggregate custom counters for core usage events. - Expand health endpoints with liveness and readiness checks. - Add an optional Docker Compose observability overlay for Grafana, Prometheus, Loki, Tempo, and Alloy. - Add basic Grafana datasource/dashboard provisioning. ## Likely Files - `backend/src/Socialize.Api/Program.cs` - `backend/src/Socialize.Api/ApplicationRegistration.cs` - `backend/src/Socialize.Api/Infrastructure/Observability/*` - selected backend handlers for usage counters - `backend/src/Socialize.Api/Socialize.Api.csproj` - `deploy/observability/*` - `README.md` ## Out Of Scope - Client-facing analytics or status page. - Frontend behavioral analytics. - Cloud telemetry providers. - Long-term telemetry retention policy. - Full product analytics warehouse. ## Validation ```bash dotnet build backend/Socialize.slnx dotnet test backend/Socialize.slnx docker compose -f deploy/compose.yml -f deploy/observability/compose.observability.yml config ```