| name | observability |
| description | Unified observability for the .NET 8 WPF widget host app - logging, telemetry, health checks, diagnostics exports, and operational tooling. Use when configuring Serilog, Application Insights, health checks, correlation IDs, or support tools. |
Observability
Overview
Provide unified logging, telemetry, and operational tooling that helps diagnose issues in development and production.
Core Areas
1. Structured Logging
- Serilog with file sink (rolling, 7-day retention)
- Application Insights for cloud telemetry
- ETW for local diagnostics
- Correlation IDs on user-initiated actions
2. Telemetry
- Custom events for key actions (AppStarted, WidgetCreated, SyncCompleted)
- Exception tracking with stack traces
- Performance metrics (startup time, memory, responsiveness)
3. Health Checks
- Database connectivity
- Sync service availability
- Configuration validity
- Widget instance integrity
4. Diagnostics Export
- Logs (last N days, redacted)
- Configuration (sanitized)
- Environment info (OS, .NET version, app version)
- Health check results
Definition of Done (DoD)
Key Components
| Component |
Location |
Purpose |
LogBootstrapper |
3SC/Logging/ |
Serilog initialization |
CorrelationContext |
3SC/Logging/ |
Scoped correlation IDs |
OperationLogger |
3SC/Logging/ |
Operation logging with timing |
TelemetryEventSource |
3SC/Logging/ |
ETW event source |
HealthService |
3SC/Observability/ |
Health check orchestration |
DiagnosticsExportService |
3SC/Services/ |
Export bundle creation |
Workflow
- Use
CorrelationContext.BeginScope() for user-initiated operations
- Log with structured properties:
Log.Information("Widget {WidgetId} created", id)
- Add health checks for new subsystems in
Observability/Checks/
- Include new data in diagnostics export when relevant
- Never log secrets, tokens, or PII
Anti-Patterns
- ❌ String interpolation in logs:
Log.Information($"User {name}")
- ❌ Swallowing exceptions without logging
- ❌ Logging sensitive data
- ❌ Missing correlation IDs on async operations
References
3SC/Logging/ for logging implementation
3SC/Observability/ for health checks
3SC/Services/DiagnosticsExportService.cs for export