Commits
Tarun Sukhani authored 00c52fe656b
feat: add /@health/live and /@health/ready endpoints with HealthCheck SPI (PF-11)
Adds Kubernetes-style health endpoints intercepted before action dispatch via
PlayPlugin.rawInvocation, the same pattern PlayStatusPlugin uses for /@status.
- /@health/live always returns 200 with {"status":"UP"} when the JVM is
running. Probes the process, not the application.
- /@health/ready aggregates registered HealthCheck implementations and returns
200 when all UP, 503 when any DOWN. JSON shape:
{"status":"UP|DOWN","checks":[{"name":"...","status":"UP|DOWN"},...]}
The HealthCheck interface (name + check + Status enum) is the SPI for apps
and other plugins to wire up readiness probes for db, cache, etc.
HealthCheckPlugin owns a CopyOnWriteArrayList registry exposed via static
register/unregister so registration is thread-safe and timing-agnostic
(callers may register from onApplicationStart or later).
Configuration (read in onConfigurationRead):
health.basePath - default /@health; change to /healthz for k8s convention
health.authToken - if non-empty, requests must carry
Authorization: Bearer <token>; empty disables auth
JSON serialization uses com.google.gson directly, matching PlayStatusPlugin's
existing usage — no new dependency. Gson is already on the framework classpath.
Registered at slot 20 in framework/src/play.plugins (between CorsPlugin at
15 and TempFilePlugin at 100). Slot was assigned by the PF-11 brief.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>