tas
(Michal Maciejewski)
November 30, 2022, 8:33pm
1
caddy 2.6.2
Is it possible to name servers, so I can identify them easier in metrics?
I have two sites in Caddyfile, they get named srv0
and srv1
, but it’s hard to tell which one is which, and not even sure if the name assignment is persistent.
# metrics on localhost
localhost:80 caddy:80 {
handle /metrics {
metrics
}
}
# main domains
website.com {
handle {
reverse_proxy http://nuxt:3000
}
}
metrics
caddy_http_request_duration_seconds_sum{code="200", handler="subroute", instance="caddy:80", job="caddy", method="GET", server="srv0"}
1.7661053550000003
caddy_http_request_duration_seconds_sum{code="200", handler="subroute", instance="caddy:80", job="caddy", method="GET", server="srv1"}
0.06964131200000001
1 Like
This has been requested on GitHub, see this issue:
opened 03:03PM - 08 Oct 20 UTC
feature
discussion
Initiated through [this](https://caddy.community/t/per-host-prometheus-metrics/1… 0035) forum post – involving @hairyhenderson –, I'd like to open the discussion about extending the `metrics` directive to support metrics (request count, etc.) on a per-host basis.
I'd like to have metrics exposed for every single site block (speaking in Caddyfile terminology), i.e. metrics about different sites / vhosts result in different Prometheus metrics labels.
Since determining the labels automatically based on the incoming requests' host headers is problematic (see discussion above), a solution would be to manually assign a tag to the `metrics` directive. For instance:
```
example.org {
root /var/www/html
file_server
metrics /metrics {
host "example.org"
}
}
```
I'm not really involved with Caddy's code base or development process, so this is rather supposed to be a starter for further discussion.
The problem is, we don’t have the expertise or maintainers to help us with fixing problems with metrics right now. The most active maintainers don’t use metrics for themselves and don’t have a good enough understanding of it to maintain it.
2 Likes
tas
(Michal Maciejewski)
December 1, 2022, 5:18pm
3
got it!
thanks for the link, will keep an eye on it.
system
(system)
Closed
December 30, 2022, 8:34pm
4
This topic was automatically closed after 30 days. New replies are no longer allowed.