diff options
author | Mohammed Al Sahaf <[email protected]> | 2024-10-18 18:54:21 +0300 |
---|---|---|
committer | GitHub <[email protected]> | 2024-10-18 09:54:21 -0600 |
commit | 388c7e898c6cbcddd2c59e8a902238a0b4f06857 (patch) | |
tree | f305f0639ead5bf8217a4d0ff3b07a384c794c66 /modules/caddyhttp/metrics.go | |
parent | c6f2979986d87d7236b132c687c8887c92248dd8 (diff) | |
download | caddy-388c7e898c6cbcddd2c59e8a902238a0b4f06857.tar.gz caddy-388c7e898c6cbcddd2c59e8a902238a0b4f06857.zip |
metrics: move `metrics` up, outside `servers` (#6606)
* metrics: move `metrics` up, outside `servers`
This change moves the metrics configuration from per-server level to a single config knob within the `http` app. Enabling `metrics` in any of the configured servers inside `http` enables metrics for all servers.
Fix #6604
Signed-off-by: Mohammed Al Sahaf <[email protected]>
* normalize domain name
---------
Signed-off-by: Mohammed Al Sahaf <[email protected]>
Diffstat (limited to 'modules/caddyhttp/metrics.go')
-rw-r--r-- | modules/caddyhttp/metrics.go | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/modules/caddyhttp/metrics.go b/modules/caddyhttp/metrics.go index 947721429..9bb97e0b4 100644 --- a/modules/caddyhttp/metrics.go +++ b/modules/caddyhttp/metrics.go @@ -4,6 +4,7 @@ import ( "context" "errors" "net/http" + "strings" "sync" "time" @@ -133,8 +134,8 @@ func (h *metricsInstrumentedHandler) ServeHTTP(w http.ResponseWriter, r *http.Re statusLabels := prometheus.Labels{"server": server, "handler": h.handler, "method": method, "code": ""} if h.metrics.PerHost { - labels["host"] = r.Host - statusLabels["host"] = r.Host + labels["host"] = strings.ToLower(r.Host) + statusLabels["host"] = strings.ToLower(r.Host) } inFlight := h.metrics.httpMetrics.requestInFlight.With(labels) |