-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
fix(admin) support HTTP/2 when requesting /status #8690
fix(admin) support HTTP/2 when requesting /status #8690
Conversation
Approved with minor improvement. |
@outsinre We need some tests inside https://github.com/Kong/kong/tree/master/t/01-pdk/10-nginx as well. |
:8444/status does not support HTTP/2 due to "ngx.location.capture". Now use LuaJIR ffi to retrieve Nginx status data. The "/nginx_status" location block is left in nginx-kong.conf as other components may depend on it.
The "prometheus" plugin now depends 'ngx.location.capture' to retrieve /metrics through Admin API. However, 'ngx.location.capture' does not support http2. 1. Use LuaJIR "ffi" to support http2. 2. Remove the "/nginx_status" location blocks from 'nginx-kong.conf' template. A reminder; the Status API, natively, disallows http2!
We use ffi method to get metrics/status of Kong.
To avoid code duplication. Provide a PDK function reporting Kong connections and requests metrics at Admin API :8444/status, :8444/metrics and Status API :8100/metrics. Update 'prometheus' plugin to invoke the PDK function.
Explain the return values of kong.nginx.get_statistics() function in details. Use local variables as many as possible to avoid function calls.
Append test-nginx unit for "kong.nginx.get_statistics()" and busted unit for plugin "prometheus". The two units test "/metrics" and "/status" http2 support.
Built-in variables like 'ngx.var.connections_active' may be "nil" during the busted tasks. Now exposing connections_active, connections_reading, connections_writing, connections_waiting by 'ffi' directly. Add busted task to test prometheus metrics against status API. Remove '/nginx_status' from prometheus fixtures. Add 'pdk.nginx.get_statistics' to test-nginx 'phase_checks.t'
Seems all checks passed. |
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.
Approving this with minor comments about spacing.
end) | ||
|
||
end) | ||
end |
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.
Spacing: newline at the end of file.
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. Pending Enrique's reviews to be addressed.
:8444/status does not support HTTP/2 due to
"ngx.location.capture". Now use LuaJIT ffi to retrieve Nginx status
data.
The "/nginx_status" location block is left in nginx-kong.conf as other
components may depend on it.