Caddy Prometheus metrics and PHP-FPM

1. The problem I’m having:

I have Prometheus metrics configured for my Caddyfile, and they are working great. Unfortunately, Caddy does not seem to aggregate http_* metrics for anything, even though there are multiple requests per second coming in. All the go_* and process_* metrics are correct.

2. Error messages and/or full log output:

No specific errors.

3. Caddy version:

2.8.4

4. How I installed and ran Caddy:

Binaries.

a. System environment:

Debian 12.

b. Command:

No specific command.

c. Service/unit/compose file:

No specific service config.

d. My complete Caddy config:

{
  auto_https off
}

:9200 {
  metrics
}

http://mydomain.com {
  root * /apps/web/public
  encode gzip

  php_fastcgi unix//var/run/php/php-fpm.sock {
    index index.php
    capture_stderr
  }
}

5. Links to relevant resources:

Output of the metrics endpoint. Note the lack of http_* metrics:

caddy@web-prod01:/home/cloud# curl localhost:2019/metrics
# HELP caddy_admin_http_requests_total Counter of requests made to the Admin API's HTTP endpoints.
# TYPE caddy_admin_http_requests_total counter
caddy_admin_http_requests_total{code="200",handler="load",method="POST",path="/load"} 2
# HELP caddy_reverse_proxy_upstreams_healthy Health status of reverse proxy upstreams.
# TYPE caddy_reverse_proxy_upstreams_healthy gauge
caddy_reverse_proxy_upstreams_healthy{upstream="unix//var/run/php/php-fpm.sock"} 1
# HELP go_build_info Build information about the main Go module.
# TYPE go_build_info gauge
go_build_info{checksum="",path="caddy",version="(devel)"} 1
# HELP go_gc_duration_seconds A summary of the pause duration of garbage collection cycles.
# TYPE go_gc_duration_seconds summary
go_gc_duration_seconds{quantile="0"} 8.3176e-05

Ideally what I want is to be able to gather requests per second, as well as average time of every request.

You need to read this page of the documentation

1 Like

I did. And specifically this part:

My Caddy metrics endpoint has no caddy_http_request.

It also says:

So, where are the buckets for my handlers?

You missed this part

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.