This is an automated email from the ASF dual-hosted git repository. membphis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-apisix.git
The following commit(s) were added to refs/heads/master by this push: new 6cc3654 Using internal request instead of external request in node-status plugin. (#1109) 6cc3654 is described below commit 6cc36546ec7724ee26fd0ab01920b12a0210e515 Author: agile6v <agil...@agile6v.com> AuthorDate: Fri Feb 7 20:00:49 2020 +0800 Using internal request instead of external request in node-status plugin. (#1109) --- lua/apisix/admin/plugins.lua | 4 ++-- lua/apisix/plugins/node-status.lua | 9 ++------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/lua/apisix/admin/plugins.lua b/lua/apisix/admin/plugins.lua index ba4bdcc..1ae7dfe 100644 --- a/lua/apisix/admin/plugins.lua +++ b/lua/apisix/admin/plugins.lua @@ -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 @@ -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 diff --git a/lua/apisix/plugins/node-status.lua b/lua/apisix/plugins/node-status.lua index d34d271..112813a 100644 --- a/lua/apisix/plugins/node-status.lua +++ b/lua/apisix/plugins/node-status.lua @@ -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 @@ -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