Skip to content

Commit 91804d4

Browse files
committed
chore: demote health/ready/metrics logs from INFO to DEBUG
Health check endpoints are called frequently (every few seconds by k8s) and cluttered the INFO logs, making it hard to read important messages. Now /health, /ready, and /metrics requests are logged at DEBUG level only.
1 parent 509666e commit 91804d4

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

control-plane/internal/middleware/logging.go

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,23 @@ func Logging(logger *slog.Logger) func(next http.Handler) http.Handler {
4242

4343
duration := time.Since(start)
4444

45-
// Log the request
45+
// Skip logging for health/ready/metrics endpoints to reduce noise
46+
path := r.URL.Path
47+
if path == "/health" || path == "/ready" || path == "/metrics" {
48+
// Log at debug level only for observability endpoints
49+
logger.Debug("request",
50+
slog.String("method", r.Method),
51+
slog.String("path", path),
52+
slog.Int("status", wrapped.status),
53+
slog.Duration("duration", duration),
54+
)
55+
return
56+
}
57+
58+
// Log the request at info level
4659
logger.Info("request",
4760
slog.String("method", r.Method),
48-
slog.String("path", r.URL.Path),
61+
slog.String("path", path),
4962
slog.Int("status", wrapped.status),
5063
slog.Duration("duration", duration),
5164
slog.String("request_id", reqID),

0 commit comments

Comments
 (0)