fix(metrics): serve lightweight /healthz on metrics port - #12
Open
azgms wants to merge 1 commit into
Open
Conversation
promhttp was mounted as the root handler, so kubelet probes to /healthz on :4001 received the full Prometheus exposition (10-26MB on hot pods). Concurrent Gather with scrapes exceeded probe timeouts and restarted pods. Route /healthz|/health to a cheap 200 OK; keep /metrics (and /) as the exposition. Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
/healthzand/healthreturn a cheap200 OKwithout calling PrometheusGather./metrics(and/for back-compat) aspromhttp.Handler().Why
Prod DaemonSet probes hit
:4001/healthz. That port usedpromhttp.Handler()as the root handler, so every path returned the full exposition. On hot pods (PreferSameNodeskew) that payload is 14–26MB / 80–137k series. Concurrent Gather with Prometheus scrapes pushed scrape duration to 5–10s, exceeding kubelettimeoutSeconds: 5and causing liveness kills (internal-erpc-zczc4, probe failures onfrd5n).Real
:4000/healthcheckstays healthy at ~4–13ms during the same windows — the process was fine; the probe target was wrong/expensive.Test plan
go test ./erpc/ -run TestNewMetricsHandler:4001/healthzreturnsOKin <10ms and is not a Prometheus dump:4001/metricsstill scrapes normally:4000(defense in depth either way)Made with Cursor