Observability
What this page covers
Every choice of --Persistence, --Auth, --IncludeTests and --Aspire: a label says which options a part is for. The copy in your app's docs/ folder has only the parts for yours. ApiHost stands for your app's name.
Health checks
/health/live: the process is running./health/ready: it can also reach PostgreSQL.
Point your host's or load balancer's health checks at them.
Traces, metrics and logs
Marten
The app records traces, metrics and logs with OpenTelemetry: HTTP requests, SQL commands, Wolverine messages and handlers, Marten, and .NET runtime metrics (src/ApiHost/Observability/OpenTelemetrySetup.cs). Nothing is sent anywhere until you set OTEL_EXPORTER_OTLP_ENDPOINT.
EF Core
The app records traces, metrics and logs with OpenTelemetry: HTTP requests, SQL commands, Wolverine messages and handlers, and .NET runtime metrics (src/ApiHost/Observability/OpenTelemetrySetup.cs). Nothing is sent anywhere until you set OTEL_EXPORTER_OTLP_ENDPOINT.
With Aspire
The Aspire AppHost shows all of this without any set-up (how). Without it, to see it locally in the standalone Aspire dashboard:
Without Aspire
To see it locally in the Aspire dashboard:
docker compose --profile observability up -d # dashboard on http://localhost:18888
OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317 dotnet run --project src/ApiHost(dotnet run itself also reports to the dashboard, as dotnet-cli; the app is ApiHost.)
In production, point OTEL_EXPORTER_OTLP_ENDPOINT (and, if needed, OTEL_EXPORTER_OTLP_HEADERS) at any OpenTelemetry backend, such as Grafana, Honeycomb or a self-hosted Jaeger. Sending the logs off the server also keeps them safe if the server isn't. Security lists the security events worth alerting on.
With accounts
Failed emails
Account emails are sent by a Wolverine handler and retried with growing delays if the mail server fails. Emails that still fail end up in Wolverine's wolverine_dead_letters table, and the failures are in the logs. Admins can replay them from the back office's Failed messages once the cause is fixed.