Caddyfile metrics labelling

I am wondering whether it is possible to somehow label metrics from different directives in a Caddyfile. Say for example I have the following Caddyfile and want to monitor, say, caddy_http_requests_total

:2020 {
    metrics
}

www.mydomain.com {
    reverse_proxy service:port
}

subdomain1.mydomain.com {
    reverse_proxy service:port
}

subdomain2.mydomain.com {
    reverse_proxy service:port
}

My question is whether there is a way to differentiate the metrics for each of the reverse_proxy directives such that I can read metrics for each of them separately. With the Caddyfile config adaptor they are all bunded under the srv0 server, so I can’t differentiate them in that way.

Now I know this would be possible to achieve when writing the config in JSON, because there you can create multiple servers and name them arbitrarily. I would like to know whether there is or will be a way to achieve this in the Caddyfile. Just being curious :slight_smile:

Metrics is a pretty fresh feature, so that isn’t covered yet. But there’s discussion in this github issue about it:

1 Like

Alright, nice it has been logged already, I’ll definitely follow that topic. And for anyone reading this there was already a topic on this here which I missed initially.

1 Like

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