services/introspection: support to show introspection grpc service

Signed-off-by: Iceber Gu <wei.cai-nat@daocloud.io>
This commit is contained in:
Iceber Gu
2021-05-04 14:40:20 +08:00
committed by Derek McGowan
parent bce18cb04f
commit ce3871966e
4 changed files with 47 additions and 19 deletions

View File

@@ -31,11 +31,8 @@ func init() {
plugin.Register(&plugin.Registration{
Type: plugin.GRPCPlugin,
ID: "introspection",
Requires: []plugin.Type{"*"},
Requires: []plugin.Type{plugin.ServicePlugin},
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
// this service works by using the plugin context up till the point
// this service is initialized. Since we require this service last,
// it should provide the full set of plugins.
plugins, err := ic.GetByType(plugin.ServicePlugin)
if err != nil {
return nil, err
@@ -50,13 +47,11 @@ func init() {
return nil, err
}
allPluginsPB := pluginsToPB(ic.GetAll())
localClient, ok := i.(*Local)
if !ok {
return nil, errors.New("Could not create a local client for introspection service")
}
localClient.UpdateLocal(ic.Root, allPluginsPB)
localClient.UpdateLocal(ic.Root)
return &server{
local: localClient,