Skip to content

Improve how healthchecks are done - #257

Open
doanac wants to merge 3 commits into
mainfrom
gw-healthz
Open

Improve how healthchecks are done#257
doanac wants to merge 3 commits into
mainfrom
gw-healthz

Conversation

@doanac

@doanac doanac commented Sep 2, 2026

Copy link
Copy Markdown
Member

When you start to run our server in AWS and GCP, you'll quickly get swamped with TLS handshake error messages and /favicon page hits. This PR introduces a /healthz endpoint that logs 1 out of every 10 checks to help prevent being swamped by noise.

Andy Doan added 3 commits September 2, 2026 15:09
This also only logs a sampling of healthz checks to prevent swamping our
logs in things like GCP with load-balancer health checks

Signed-off-by: Andy Doan <doanac@qti.qualcomm.com>
Build on the /healthz logic of the previous commit to make logs cleaner
for our UI code as well.

Signed-off-by: Andy Doan <doanac@qti.qualcomm.com>
Signed-off-by: Andy Doan <doanac@qti.qualcomm.com>
@doanac
doanac requested a review from vkhoroz September 2, 2026 20:40

@vkhoroz vkhoroz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment thread server/echo.go
if c.Path() != "/healthz" {
return false
}
// log once every 10 hits to now swamp our logs

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// log once every 10 hits to now swamp our logs
// log once every 10 hits to not swamp our logs

Comment thread server/echo.go
Comment on lines +65 to +69
if c.Path() != "/healthz" {
return false
}
// log once every 10 hits to now swamp our logs
return healthzHits.Add(1)%10 != 1

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might add other logic for other endpoints into this skipper later. So, I'd change the order of checks to more verbose:

Suggested change
if c.Path() != "/healthz" {
return false
}
// log once every 10 hits to now swamp our logs
return healthzHits.Add(1)%10 != 1
if c.Path() == "/healthz" {
// log once every 10 hits to not swamp our logs
return healthzHits.Add(1)%10 != 1
}
return false

Or, even use a more verbose switch:

Suggested change
if c.Path() != "/healthz" {
return false
}
// log once every 10 hits to now swamp our logs
return healthzHits.Add(1)%10 != 1
switch c.Path() {
case "/healthz":
// log once every 10 hits to not swamp our logs
return healthzHits.Add(1)%10 != 1
}
return false

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants