Is it possible to make the Caddy metrics persistent?

Is it possible to make the Caddy prometheus metrics persistent? When I reboot Caddy, some metrics like the total HTTP requests get reset.

My configs are located at containers/caddy at main · stingalleman/containers · GitHub.

Not really. I don’t think the Prometheus library allows us to do that.

But you shouldn’t be rebooting Caddy completely when you change configs, you should just do graceful reloads with the caddy reload command. That will avoid the stats resetting.

I use caddy reload (containers/reload at main · stingalleman/containers · GitHub) but sometimes I have to restart Caddy - think about rebooting the server, changing my docker-compose.yml, etc. Maybe a nice feature request would be to save the Prometheus stats somewhere on closing, or every set interval, and then loading that on server start.

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