Commits
Tarun Sukhani authored 55f8a89979d
feat: Micrometer metrics with Prometheus exposition at /@metrics (PF-13) Adds Micrometer-based metrics with a Prometheus scrape endpoint: - play.libs.Metrics — static facade for application code (counter, timer, gauge). Default registry is a SimpleMeterRegistry so call sites work even when MetricsPlugin is disabled; the plugin swaps in a PrometheusMeterRegistry on onApplicationStart and restores SimpleMeterRegistry on onApplicationStop. install() is public so plugins outside play.libs can swap the registry. - play.plugins.MetricsPlugin (slot 30 in play.plugins) — reads metrics.enabled (default true) and metrics.basePath (default /@metrics). Auto-registers Micrometer's bundled JVM binders (memory, GC, threads, classloader). rawInvocation short-circuits the configured base path with Content-Type: text/plain; version=0.0.4; charset=utf-8 (Prometheus text format) and registry.scrape() body. - HTTP request metrics: ActionInvoker.invoke stamps a start nanotime and, in the existing finally block adjacent to the PF-9 MDC clear, records duration into the Timer http_server_requests tagged with method, status, route. Tagging falls back to request.path when request.action is unset (unrouted requests). Metric recording is wrapped in a try/throwable so a misbehaving registry can never break request handling. - Dependencies: micrometer-core, micrometer-commons, micrometer-observation, micrometer-registry-prometheus 1.13.6 plus the io.prometheus prometheus-metrics-* family at 1.2.1 (the new client_java v1, NOT the legacy simpleclient line — Micrometer 1.13.x switched). HdrHistogram and LatencyUtils are micrometer-core runtime transitives. The fork's resolver pre-pins declared modules so jars were pre-seeded into framework/lib/ before ant resolve. - application-skel/conf/application.conf documents both keys (commented out so defaults apply). OTLP push exporter is intentionally deferred — Prometheus scrape is the baseline; OTLP can be layered as a follow-up ticket without affecting the Metrics facade or the plugin lifecycle. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>