Hi,
The service discovery module’s control api path should like:
/v1/discovery/<discovery_type>/<service_name>
First, we only need people just define the api name short, as /dump:
function _M.control_api()
return {
{
methods = {"GET"},
uris = {"/dump"},
handler = dump_info
}
}
end
Then, the control/route.lua should add the prefix
/v1/discovery/<discovery_type> for the api’s uris attr automatic.
eg: /dump -> /v1/discovery/consul_kv/dump
What do you think ?
2021年1月29日 16:55,微光 <[email protected]<mailto:[email protected]>> 写道:
`/apisix/discovery/<discovery_type>/<service_name>` is nice
Zexuan Luo <[email protected]<mailto:[email protected]>>
于2021年1月29日周五 下午4:46写道:
Do you mean an API `/<discovery_type>/<service_name>` like the current
`/healthcheck/<healthcheck_name>`?
I think it is a bright idea.
Zhiyuan Ju <[email protected]<mailto:[email protected]>> 于2021年1月28日周四
下午5:42写道:
Hi,
It’s useful to debug when running, and looking forward to this feature.
as for the API design, we could wait for more replies from community:)
聂永 <[email protected]<mailto:[email protected]>>于2021年1月28日
周四下午5:33写道:
Hi,
I’m using the custom discovery module consuk_kv.lua online now.
And I often need the module to export some data snapshot in memory when
running for debugging, below is the consuk_kv.lua export one api
output.
# curl -s http://127.0.0.1:9090/v1/discovery/consul_kv/dump | jq
{
"http://172.19.5.30:8500/v1/kv/upstreams/10000/webpages/": [
{
"host": "172.19.5.12",
"port": 8000,
"weight": 120
},
{
"host": "172.19.5.13",
"port": 8000,
"weight": 120
}
],
"http://172.19.5.30:8500/v1/kv/upstreams/1614480/webpages/": [
{
"host": "172.19.5.12",
"port": 8000,
"weight": 120
},
{
"host": "172.19.5.13",
"port": 8000,
"weight": 120
}
],
"http://172.19.5.31:8500/v1/kv/upstreams/1614480/webpages/": [
{
"host": "172.19.5.12",
"port": 8000,
"weight": 120
},
{
"host": "172.19.5.13",
"port": 8000,
"weight": 120
}
],
"http://172.19.5.30:8500/v1/kv/upstreams/1614480/grpc_upstreams/": [
{
"host": "172.19.5.51",
"port": 50051,
"weight": 1
}
]
}
What do you think?
If We need, I will submit a PR later :))
--
来自 琚致远