Skip to content

Observability

Valerio edited this page Apr 28, 2026 · 2 revisions

Observability

UncannyPrompt instruments logs, traces, metrics, health checks, and audit events. The MVP favors simple console output and built-in OpenTelemetry instrumentation, while keeping the wiring ready for external exporters.

Serilog

Serilog is configured through builder.ConfigureUncannyPromptHost() and reads the Serilog:* section from configuration.

Default behavior:

  • console sink enabled;
  • application logs at Information;
  • ASP.NET Core and EF Core framework noise reduced through overrides.

Use structured logging for new code:

logger.LogInformation("Prompt copied {PromptId} by {UserId}", promptId, userId);

OpenTelemetry

Configured in src/UncannyPrompt.WebApp/Program.cs.

Current instrumentation:

Source Purpose
ASP.NET Core incoming HTTP request traces and metrics
HttpClient outbound HTTP traces and metrics
Runtime GC, thread pool, exception, and process-level metrics
Console exporter optional local visibility when enabled

Console exporters are disabled by default to keep development and container logs readable. Enable them only when investigating telemetry locally:

OpenTelemetry__ConsoleExporter__Enabled=true

Production can replace or supplement console exporters with OTLP exporters when an observability backend is introduced.

Health checks

The WebApp exposes:

GET /health

The current health endpoint is a process-level liveness check. For production, readiness checks should be added for SQL Server and any future backing services.

Audit events

Audit events are part of observability because they answer security and product-operation questions that logs should not be relied on to reconstruct.

Audit data is stored in SQL Server and exposed through:

What to watch in production

Symptom First place to look
slow prompt listing SQL query duration, prompt indexes, page size
public links failing PublicShareLink lifecycle fields and access audit
auth provider missing provider configuration keys and login page provider availability
API 429 responses rate limiter configuration and caller behavior
CSRF failures missing X-CSRF-TOKEN header on cookie-authenticated requests
cross-scope access concerns AccessControlQueries, TenantScopeService, and audit records

Future improvements

  • Add SQL Server readiness checks.
  • Add OTLP exporter configuration.
  • Add custom meters for prompt copies, public link access, and access denied events.
  • Add structured audit dashboards for tenant owners/admins.

Clone this wiki locally