Caddy
Prometheus Metrics
Caddy is a powerful, extensible web server with automatic HTTPS.
Prometheus Metrics
Section titled “Prometheus Metrics”Service Configuration
Section titled “Service Configuration”Caddy 2 includes native Prometheus support, but metrics must be explicitly enabled.
Option 1: Using the Caddyfile
Add the metrics directive inside your servers block:
{ servers { metrics }}Option 2: Using the command-line flag
Start Caddy with the --metrics flag:
caddy run --metricsOnce enabled, metrics are available at http://localhost:2019/metrics.
Glouton Configuration
Section titled “Glouton Configuration”sudo tee /etc/glouton/conf.d/99-caddy.conf > /dev/null << 'EOF'metric: prometheus: targets: - url: "http://localhost:2019/metrics" name: "caddy" allow_metrics: - "caddy_http_requests_total" - "caddy_http_request_duration_seconds*" - "caddy_http_response_size_bytes*" - "caddy_reverse_proxy_upstreams_healthy"EOFCreate or edit C:\ProgramData\glouton\conf.d\99-caddy.conf:
metric: prometheus: targets: - url: "http://localhost:2019/metrics" name: "caddy" allow_metrics: - "caddy_http_requests_total" - "caddy_http_request_duration_seconds*" - "caddy_http_response_size_bytes*" - "caddy_reverse_proxy_upstreams_healthy"Glouton automatically detects configuration changes.
| Metric | Description |
|---|---|
caddy_http_requests_total | Total number of HTTP requests handled by Caddy |
caddy_http_request_duration_seconds | Histogram of HTTP request durations in seconds |
caddy_http_response_size_bytes | Histogram of HTTP response body sizes in bytes |
caddy_reverse_proxy_upstreams_healthy | Number of healthy upstream backends for the reverse proxy |