Skip to content
This repository was archived by the owner on Oct 9, 2026. It is now read-only.

Exclude /healthz from HTTP access logging - #7

Merged
jmnote merged 2 commits into
mainfrom
copilot/exclude-healthz-endpoint-logs
Aug 19, 2026
Merged

jmnote merged 2 commits into
mainfrom
copilot/exclude-healthz-endpoint-logs

Conversation

Copilot AI commented Aug 19, 2026 •

Copy link
Copy Markdown
Contributor

/healthz is a high-frequency probe endpoint and was generating noisy access logs. This PR scopes access logging so health checks are omitted while preserving logs for all other routes.

  • Logging middleware behavior

    • Updated LoggingMiddleware to skip log emission when r.URL.Path == "/healthz".
    • Kept request handling flow unchanged; only log side-effect is filtered.
  • Targeted regression coverage

    • Added middleware tests to lock behavior:
      • /healthz requests do not produce access-log entries.
      • non-health endpoints (e.g. /v1/models) still produce access-log entries.
  • Behavioral delta (code snippet)

func LoggingMiddleware(g *Gateway, next http.Handler) http.Handler {
	return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		if r.URL.Path != "/healthz" {
			logEntry := fmt.Sprintf("%s %s from %s", r.Method, r.URL.Path, r.RemoteAddr)
			g.logInfo("%s", logEntry)
		}
		next.ServeHTTP(w, r)
	})
}

Copilot AI linked an issue Aug 19, 2026 that may be closed by this pull request
Co-authored-by: jmnote <2242405+jmnote@users.noreply.github.com>
Copilot AI changed the title [WIP] Exclude /healthz endpoint from access logs Exclude /healthz from HTTP access logging Aug 19, 2026
Copilot AI requested a review from jmnote August 19, 2026 18:10
@jmnote
jmnote marked this pull request as ready for review August 19, 2026 18:16
@jmnote
jmnote merged commit d1369cd into main Aug 19, 2026
2 checks passed
@jmnote
jmnote deleted the copilot/exclude-healthz-endpoint-logs branch August 19, 2026 18:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Exclude /healthz endpoint from access logs

2 participants