Skip to content
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

enhancement: using internal request instead of external request in node-status plugin #1109

Merged
merged 1 commit into from
Feb 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lua/apisix/admin/plugins.lua
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function _M.check_schema(plugins_conf)
core.json.delay_encode(plugin_conf, true))
local plugin_obj = local_plugins[name]
if not plugin_obj then
return false, "unknow plugin [" .. name .. "]"
return false, "unknown plugin [" .. name .. "]"
end

if plugin_obj.check_schema then
Expand All @@ -67,7 +67,7 @@ function _M.stream_check_schema(plugins_conf)
": ", core.json.delay_encode(plugin_conf, true))
local plugin_obj = stream_local_plugins[name]
if not plugin_obj then
return false, "unknow plugin [" .. name .. "]"
return false, "unknown plugin [" .. name .. "]"
end

if plugin_obj.check_schema then
Expand Down
9 changes: 2 additions & 7 deletions lua/apisix/plugins/node-status.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
local core = require("apisix.core")
local ngx = ngx
local re_gmatch = ngx.re.gmatch
local ngx_capture = ngx.location.capture
local plugin_name = "node-status"
local apisix_id = core.id.get()
local ipairs = ipairs
Expand All @@ -37,13 +38,7 @@ local ngx_statu_items = {


local function collect()
local res, err = core.http.request_self("/apisix/nginx_status", {
keepalive = false,
})
if not res then
return 500, "failed to fetch nginx status: " .. err
end

local res = ngx_capture("/apisix/nginx_status")
if res.status ~= 200 then
return res.status
end
Expand Down