-
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(log) add balancer tries and failure information #2429
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but could improve on code style. Not a blocker for sure.
kong/kong.lua
Outdated
@@ -217,7 +217,12 @@ function Kong.balancer() | |||
-- record failure data | |||
addr.failures = addr.failures or {} | |||
local state, code = get_last_failure() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move local state, code = get_last_failure()
above addr.failures = addr.failures or {}
it makes code more pleasing to read, :-).
kong/kong.lua
Outdated
state = state, | ||
code = code, | ||
ip = addr.ip, | ||
port = addr.port, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we start aligning equal =
signs?
it("serializes the tries and failure information", function() | ||
ngx.ctx.balancer_address.tries = 3 | ||
ngx.ctx.balancer_address.failures = { | ||
{ state = "next", code = 502, ip = "127.0.0.1", port = 1234 }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some alignment could make it easier to read here as well.
The number of tries will be logged in the basic serializer. If any retries occurred, then failure information will be added as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nicely done.
@@ -31,6 +31,8 @@ | |||
configured log target-url includes credentials. Thanks to | |||
[Amir M. Saeid](https://github.com/amir) for the contribution. | |||
[#2430](https://github.com/Mashape/kong/pull/2430) | |||
- Logging retries and failure information. | |||
[#2429](https://github.com/Mashape/kong/pull/2429). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should have went into the below section already having a "logging plugins" mention
The number of tries will be logged in the basic serializer. If any retries occurred, then failure information will be added as well.