Skip to content

Commit 8aa3502

Browse files
committed
fix: enable Caddy HTTP metrics at server level in init config
Move metrics from per-route handler (which broke the reverse proxy) to server-level config (metrics: {} in srv0), which correctly emits caddy_http_requests_total and caddy_http_request_duration_seconds without intercepting requests.
1 parent e3fe996 commit 8aa3502

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎internal/server/service.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ func (s *Service) InitWorker(id int64) error {
124124
}
125125

126126
caddyRunning, _ := client.Exec("docker ps -q --filter name=^/caddy$")
127-
baseConfig := `{"apps":{"http":{"servers":{"srv0":{"listen":[":80",":443"]}}}}}`
127+
baseConfig := `{"apps":{"http":{"servers":{"srv0":{"listen":[":80",":443"],"metrics":{}}}}}}`
128128
if strings.TrimSpace(caddyRunning) == "" {
129129
log.Printf("Deploying Caddy on %s...", server.Name)
130130
caddyRun := fmt.Sprintf(`docker pull caddy:latest 2>/dev/null

0 commit comments

Comments
 (0)