feat(health): core review fixes (async writer, gRPC cancellation, validation, configurable retry-after)

This commit is contained in:
Joseph Doherty
2026-06-01 07:00:21 -04:00
parent cf277eb7df
commit aa2251b93d
7 changed files with 92 additions and 14 deletions
@@ -73,7 +73,7 @@ public static class ZbHealthEndpointExtensions
Action<ZbHealthEndpointOptions> configure);
}
/// Canonical JSON response writer. Shape: { status, totalDurationMs, entries: { name: { status, description, duration } } }.
/// Canonical JSON response writer. Shape: { status, totalDurationMs, entries: { name: { status, description, durationMs } } }.
public static class ZbHealthWriter
{
public static Task WriteJsonAsync(HttpContext context, HealthReport report);
+3 -3
View File
@@ -121,12 +121,12 @@ All health endpoints share one canonical JSON serializer. The shape is lifted fr
"database": {
"status": "Healthy",
"description": "SQL Server reachable",
"duration": "00:00:00.0120000"
"durationMs": 12
},
"akka-cluster": {
"status": "Healthy",
"description": "Member status: Up",
"duration": "00:00:00.0001000"
"durationMs": 0.1
}
}
}
@@ -141,7 +141,7 @@ All health endpoints share one canonical JSON serializer. The shape is lifted fr
| `entries` | object | Keyed by check registration name |
| `entries.<name>.status` | string | Per-check status |
| `entries.<name>.description` | string? | Human-readable detail (may be null) |
| `entries.<name>.duration` | string | TimeSpan `ToString()` — per-check elapsed time |
| `entries.<name>.durationMs` | number | Per-check elapsed time, milliseconds |
The writer is exposed as a static `Task WriteJsonAsync(HttpContext, HealthReport)` so consumers can
plug it into `MapHealthChecks` options and also call it from custom endpoints.