Metrics and Monitoring
Caddy exposes Prometheus metrics for monitoring server health, performance, and operational statistics. Metrics are available through both the admin API and a configurable handler.Admin Metrics Endpoint
By default, metrics are available on the admin endpoint:The admin metrics endpoint is enabled by default and requires no configuration.
Metrics Handler
Expose metrics on a public endpoint:Disable OpenMetrics
If your monitoring system doesn’t support OpenMetrics format:Available Metrics
HTTP Metrics
Request CountReverse Proxy Metrics
Upstream Request CountTLS Metrics
Handshakes TotalAdmin API Metrics
Request CountPrometheus Configuration
Configure Prometheus to scrape Caddy metrics:prometheus.yml
Grafana Dashboard
Example Grafana queries:Request Rate
Error Rate
Response Time (95th percentile)
Upstream Health
Securing Metrics
Protect your metrics endpoint:Alert Rules
Example Prometheus alert rules:Custom Metrics
Register custom metrics in Caddy modules:Complete Example
Monitoring Stack
Typical monitoring setup:Performance Impact
Metrics collection has minimal performance overhead. Caddy uses efficient Prometheus client libraries with lock-free operations where possible.