-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(balancer): expose balancer_health even when healthchecks are off #5885
Conversation
36c99ff
to
157b6c7
Compare
157b6c7
to
daa40e6
Compare
aa426b0
to
eb2a473
Compare
Thanks @hutchic for giving me a ping about this! It's been a while! I've just rebased it against the latest |
eb2a473
to
c1326b5
Compare
c1326b5
to
da4485f
Compare
Closing because of lack of activity. We would like to accept this contribution if anyone wishes to pick this back up. |
lack of activity? I rebased it like 3 hours ago 😆 |
Oops, apologies. Could you please re-open this one? |
I can't, the reopen button is grayed out. |
da4485f
to
c5b401a
Compare
c5b401a
to
54c4651
Compare
54c4651
to
cc89730
Compare
The Kong load balancer has concepts of upstream health, which is managed by the healthchecker, and balancer health, which is affected by the healthchecker but also affected by the balancer "health threshold" setting. This means a _balancer_ can be unhealthy (and return HTTP 503) even when healthchecks for the upstream are disabled. The endpoint `/upstreams/<upstream>/health?balancer_health=1` is an "advanced mode" for viewing health, which shows the _balancer health_ as opposed to upstream health. (It is hidden behind a query argument to avoid confusion, as for most cases the upstream health is sufficient and the "balancer" terminology referring to a mostly internal Kong object may also be unclear to end-users.) This endpoint, however, only returns the balancer health, when healthchecks for upstream health are enabled. This commit changes this behavior so that using `?balancer_health=1` we can always see the balancer health, through a new attribute `balancer_health`, which always returns `HEALTHY` or `UNHEALTHY` (reporting the true state of the balancer), even if the overall upstream health status is `HEALTHCHECKS_OFF`. This is useful for debugging. The original attribute `health` is preserved with the existing semantics for backward compatibility, returning `HEALTHY`, `UNHEALTHY` or `HEALTHCHECKS_OFF`. Signed-off-by: Aapo Talvensaari <[email protected]>
cc89730
to
cfdb261
Compare
@bungle thank you! ❤️ |
@bungle @hishamhm just want to understand how this query param work "health?balancer_health=1". In my case even the target exist in upstream im not getting data key and its value, Sometime is show some time it didn't show up. x.x.x.x - - [30/Mar/2023:16:45:37 +0530] "GET /upstreams/908a59ea-1ff1-47eb-89a1-xxxxxxxxx/health?balancer_health=1 HTTP/1.1" 200 62 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:109.0) Gecko/20100101 Firefox/111.0" x.x.x.x - - [30/Mar/2023:16:18:23 +0530] "GET /upstreams/908a59ea-1ff1-47eb-89a1-xxxxxxxxx/health?balancer_health=1 HTTP/1.1" 200 621 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:109.0) Gecko/20100101 Firefox/111.0" Kong version:- 2.4.0 Do let me know how can I debug this. |
The Kong load balancer has concepts of upstream health, which is managed by the healthchecker, and balancer health, which is affected by the healthchecker but also affected by the balancer "health threshold" setting. This means a balancer can be unhealthy (and return HTTP 503) even when healthchecks for the upstream are disabled.
The endpoint
/upstreams/<upstream>/health?balancer_health=1
is an "advanced mode" for viewing health, which shows the balancer health as opposed to upstream health. (It is hidden behind a query argument to avoid confusion, as for most cases the upstream health is sufficient and the "balancer" terminology referring to a mostly internal Kong object may also be unclear to end-users.) This endpoint, however, only returns the balancer health, when healthchecks for upstream health are enabled.This PR changes this behavior so that using
?balancer_health=1
we can always see the balancer health, through a new attributebalancer_health
, which always returnsHEALTHY
orUNHEALTHY
(reporting the true state of the balancer), even if the overall upstream health status isHEALTHCHECKS_OFF
. This is useful for debugging.The original attribute
health
is preserved with the existing semantics for backward compatibility, returningHEALTHY
,UNHEALTHY
orHEALTHCHECKS_OFF
.