Updated JWT authentication to use configuration values instead of hardcoded secrets, improving security and flexibility. Enhanced CORS policy to conditionally allow origins based on configuration settings, with logging for permissive defaults. Updated README to reflect project renaming and clarify service context.
4.6 KiB
Observability
Honest assessment: observability in this service is minimal today. This document records what exists, what does not, and what the natural next steps are. It is intentionally short — there is not much to describe.
What exists
Logging
-
Provider: ASP.NET Core defaults (Console + Debug providers via
Microsoft.Extensions.Logging). No Serilog, no NLog, no structured logging. -
Format: plain text to stdout (Console provider). Docker collects via the standard container log stream;
docker logs missionsreveals everything. -
Application-emitted logs (only):
Source Level When Message 06_http_conventions/ErrorHandlingMiddlewareERRORUnhandled exception caught by the catch-all branch "Unhandled exception"(with stack trace viaLogError(ex, ...))No
INFO,DEBUG,WARNlogs are emitted by application code. -
Framework logs:
JwtBearerHandlerand ASP.NET Core's request pipeline log token-validation outcomes and request lifecycle atInformation/Debuglevels (05_identity§ Logging). LinqToDB does NOT log SQL by default —04_persistenceCaveats #7.
Metrics
- None. No
Microsoft.Extensions.Diagnostics.Metricsconsumption, no Prometheus / OpenTelemetry exporters, no application-level counters.
Tracing
- None. No
Activity/OpenTelemetryinstrumentation. No correlation IDs, no W3Ctraceparentpropagation.
Health endpoint
GET /health→{ "status": "healthy" }(Flow F7). Confirms process liveness + HTTP pipeline serving. Does NOT verify DB connectivity today.
Build-time metadata
AZAION_REVISIONenv var baked fromCI_COMMIT_SHAat build time (Dockerfile). Visible viadocker inspectorenvinside the running container, but not surfaced via any HTTP endpoint today.
What does not exist (carry-forward)
Correlation / request tracing
- No request ID generation (would be a 5-line middleware: emit
X-Request-Idif absent, propagate to logs). - No client-supplied correlation ID propagation.
- No way to grep logs by anything other than timestamp.
Structured logging
- Console-only plaintext means log aggregation (Loki / ELK / Splunk) has to parse free-text. A switch to
Microsoft.Extensions.Logging.Console.JsonFormatter(or Serilog with JSON sink) would emit{ "Timestamp": ..., "Level": ..., "Message": ..., "Properties": {...} }and make downstream querying viable.
Audit logging
- No per-request audit trail (which user / token did what). The JWT's
sub/user_idclaim is not consumed today —05_identityCaveats #2. Adding it would unlock per-user attribution for vehicle changes and mission deletions.
Application metrics
- No counters for: requests served, error rate, mission-delete cascade duration,
vehicles.is_defaultrace occurrences, JWT validation failure rate. - No DB metrics: connection pool utilization, query latency p50 / p95 / p99, slow-query log.
- No SLO tracking —
architecture.md§ NFRs notes that no explicit latency budget is set.
Distributed tracing
- The cross-service cascade (
missions→media/annotations/detectionrows in shared PG) would benefit from a single trace ID per cascade walk. Today it is one trace span (the HTTP request) that opaquely runs many SQL statements.
DB liveness on /health
- Flow F7 § Future improvement notes the natural extension:
await db.ExecuteAsync("SELECT 1")inside the/healthhandler. Today the migrator-at-startup is the only DB-availability gate.
Natural next steps (in rough priority order)
- Request ID middleware + emit it from
ErrorHandlingMiddlewarelog + Response header. ~10 lines, immediately useful for production support. - DB ping in
/health— flips/healthfrom "process liveness" to "service readiness". Costs <1ms per probe. - Switch console logger to JSON formatter — flat-rate change; downstream log aggregation becomes feasible.
- Surface
AZAION_REVISIONvia a/versionendpoint (one line on top of the existingMapGet) so support knows which build is on the device withoutdocker inspect. - OpenTelemetry instrumentation — once #1–4 are in, a minimal OTel exporter (HTTP server + LinqToDB SqlClient activity) would give tracing for free.
These are deferred to post-rename work (out of this Epic). The rename refactor (B5–B10) does not change observability, and the autodev BUILD pipeline (Steps 3–7 of existing-code flow) will exercise the existing code as-is. Adding observability is a separate pass that should land alongside the testing work in autodev cycle 2 or later.