-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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: add control api for plugin server-info #3088
Conversation
@@ -99,6 +99,17 @@ local function get() | |||
end | |||
|
|||
|
|||
local function get_server_info() | |||
local info, err = get() |
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.
Look like we need to way to store the boot_time
in shdict when etcd
is not used. Otherwise the boot_time
will change when plugin reloads.
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.
That's really, i will change it.
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.
Fixed.
doc/control-api.md
Outdated
@@ -49,3 +49,9 @@ Here is the supported API: | |||
Introduced since `v2.2`. | |||
|
|||
Return the jsonschema used by this APISIX instance. | |||
|
|||
### GET /v1/server_info |
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.
I think it would be better to put this to plugin's own section. So that the API in this page is builtin and will be provided whether you use the plugin or not.
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.
Fixed.
t/plugin/server-info.t
Outdated
--- yaml_config | ||
apisix: | ||
id: 123456 | ||
enable_control: true |
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 configuration may confuses beginner, because the control server in the test is hardcoded in APISIX.pm, instead of generating from config.yaml.
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.
Fixed.
--- config | ||
location /t { | ||
content_by_lua_block { | ||
local json_decode = require("apisix.core").json.decode |
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.
https://github.com/api7/test-toolkit
we can use this json
to print the sorted data. we can do this in a new PR
What this PR does / why we need it:
Previously we added plugin server-info without exposing API since the same port problem of admin api and proxy. Now we have Control API support so we expose server-info API through Control API. People now can insight the server info about APISIX instance easily.
Pre-submission checklist: