Caddy v2 middleware metrics not exposed

1. The problem I’m having:

Somehow I am able to see admin metrics, runtime metics, reverse proxy metrics but not the middleware metrics. Until a few days ago the metrics were displayed just fine. I don´t know, what could have changed, except maybe for restarting caddy. I am calling the endpoint via http://localhost:2020/metrics. Any idea?

3. Caddy version:


4. How I installed and ran Caddy:

a. System environment:

Debian 11 5.10.0-21-amd64

c. Service/unit/compose file:

; Ansible managed
; source:
; version: 6be0386
; changes: Set variables via Ansible

Description=Caddy HTTP/2 web server
Documentation= systemd-networkd-wait-online.service


; User and group the process will run as.

; Letsencrypt-issued certificates will be written to this directory.

ExecStart="/usr/local/bin/caddy" run --environ --config "/etc/caddy/config.json"
ExecReload="/usr/local/bin/caddy" reload --config "/etc/caddy/config.json"

; Limit the number of file descriptors; see `man systemd.exec` for more limit settings.

; Use private /tmp and /var/tmp, which are discarded after caddy stops.
; Use a minimal /dev
; Hide /home, /root, and /run/user. Nobody will steal your SSH-keys.
; Make /usr, /boot, /etc and possibly some more folders read-only.
; … except /etc/ssl/caddy, because we want Letsencrypt-certificates there.
;   This merely retains r/w access rights, it does not add any new. Must still be writable on the host!
ReadWriteDirectories=/etc/ssl/caddy /var/log/caddy

; The following additional security directives only work with systemd v229 or later.
; They further retrict privileges that can be gained by caddy.
; Note that you may have to add capabilities required by any plugins in use.


d. My complete Caddy config:

  "apps": {
    "http": {
      "servers": {
        "metrics": {
        "apps": {...}

You need to enable metrics on the HTTP server as well. See apps/http/servers/metrics. You just need to set it to an empty object.

In an earlier version, Caddy always had metrics enabled, but we realized it caused some significant performance problems due to problems with the implementation so we just shifted it to being opt-in for the HTTP app, since we don’t have the expertise to maintain the metrics code right now, unfortunately.

1 Like

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