Feat: Enhance service method retrieval and invocation features#1429
Feat: Enhance service method retrieval and invocation features#1429Similarityoung wants to merge 25 commits intoapache:developfrom
Conversation
…ovider app name in ServiceMethodsReq
There was a problem hiding this comment.
Pull request overview
This PR adds service method introspection endpoints and a metadata-driven generic invocation flow to the Dubbo Admin console, shifting generic invoke parameter type resolution from client input to provider metadata.
Changes:
- Added console APIs for listing service methods, fetching method details (including signature/types closure), and performing generic invoke.
- Implemented provider-metadata-based overload resolution via
methodName + signatureand refactored generic invoke argument decoding using[]json.RawMessage. - Updated ZK node creation flag usage and bumped/adjusted Go module dependencies to support the new generic invoke implementation.
Reviewed changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/governor/zk/governor.go | Adjusts ZK node creation flags for compatibility. |
| pkg/console/service/service_generic_invoke_decode.go | Adds typed argument decoding helpers for generic invoke based on resolved parameter types. |
| pkg/console/service/service_generic_invoke.go | Implements generic invoke flow: metadata lookup, overload resolution, target selection, and RPC invocation. |
| pkg/console/service/service.go | Adds provider-metadata-backed method discovery and method detail/type-closure building. |
| pkg/console/router/router.go | Registers new service routes for methods, method detail, and generic invoke under /api/v1/service. |
| pkg/console/model/service.go | Adds request/response models for method discovery, method detail, and generic invoke (including signature and raw args). |
| pkg/console/handler/service.go | Adds handlers wiring the new endpoints to service layer functions. |
| go.mod | Updates dubbo-go dependency and adds hessian2 + other indirects needed for new invoke path. |
| go.sum | Updates dependency checksums accordingly. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| var invokeGenericServiceRPC = func(callCtx context.Context, invocation genericInvocation) (any, error) { | ||
| ins, err := dubbo.NewInstance(dubbo.WithName(genericInvokeInstanceName)) | ||
| if err != nil { | ||
| return nil, err | ||
| } | ||
|
|
||
| cli, err := ins.NewClient( | ||
| client.WithClientProtocolTriple(), | ||
| client.WithClientSerialization(dubboconstant.Hessian2Serialization), | ||
| ) | ||
| if err != nil { | ||
| return nil, err | ||
| } | ||
|
|
||
| svc, err := cli.NewGenericService( | ||
| invocation.ServiceName, | ||
| client.WithURL(invocation.URL), | ||
| client.WithVersion(invocation.Version), | ||
| client.WithGroup(invocation.Group), | ||
| ) | ||
| if err != nil { | ||
| return nil, err | ||
| } | ||
|
|
||
| return svc.Invoke(callCtx, invocation.MethodName, invocation.ParameterTypes, invocation.Args) | ||
| } |
There was a problem hiding this comment.
invokeGenericServiceRPC creates a new Dubbo instance + client + generic service on every invocation. This is likely expensive and may also accumulate background resources (connections, goroutines) depending on the dubbo-go implementation. Consider initializing and reusing a singleton instance/client (and, if possible, a cached generic service per service/version/group) with proper lifecycle management instead of rebuilding everything per request.
There was a problem hiding this comment.
Optimization can be made in the future
There was a problem hiding this comment.
copilot这里说的有道理,这里可以在代码里记一个todo,加上client的缓存
Code reviewFound 1 issue:
dubbo-admin/pkg/console/service/service_generic_invoke.go Lines 148 to 152 in c04698c 🤖 Generated with Claude Code - If this code review was useful, please react with 👍. Otherwise, react with 👎. |
…rameter count validation
…viceGeneric in ServiceGenericInvoke
robocanic
left a comment
There was a problem hiding this comment.
Great Work! I left some comments and hope you can discuss them with me.
| var invokeGenericServiceRPC = func(callCtx context.Context, invocation genericInvocation) (any, error) { | ||
| ins, err := dubbo.NewInstance(dubbo.WithName(genericInvokeInstanceName)) | ||
| if err != nil { | ||
| return nil, err | ||
| } | ||
|
|
||
| cli, err := ins.NewClient( | ||
| client.WithClientProtocolTriple(), | ||
| client.WithClientSerialization(dubboconstant.Hessian2Serialization), | ||
| ) | ||
| if err != nil { | ||
| return nil, err | ||
| } | ||
|
|
||
| svc, err := cli.NewGenericService( | ||
| invocation.ServiceName, | ||
| client.WithURL(invocation.URL), | ||
| client.WithVersion(invocation.Version), | ||
| client.WithGroup(invocation.Group), | ||
| ) | ||
| if err != nil { | ||
| return nil, err | ||
| } | ||
|
|
||
| return svc.Invoke(callCtx, invocation.MethodName, invocation.ParameterTypes, invocation.Args) | ||
| } |
There was a problem hiding this comment.
copilot这里说的有道理,这里可以在代码里记一个todo,加上client的缓存
…enhance service provider metadata indexing
… request validation
- 添加环境变量 `VITE_MOCK_ENABLED` 用于启用 mock 数据模式 - 更新 `package.json` 脚本以添加 `dev:mock` 用于 mock 数据开发环境 - 新增 `mockLogin.ts` 文件,提供 mock 登录和登出接口 - 修改 `request.ts`,根据环境变量切换请求的 `baseURL` - 优化 `main.ts`,根据 mock 模式自动导入 mock API 并更新认证状态
- 新增 axios 作为 HTTP 客户端依赖 - 优化 mock 数据接口,包括应用指标、流量权重、灰度配置等 - 更新 package.json 文件以添加 axios 依赖 - 修改多个 mock 接口以适应新的架构和数据结构
… into feature/generic
|



Description
This PR adds structured service method introspection, provider instance discovery, and generic invoke capabilities to the Dubbo Admin console. It also tightens the generic invoke contract so that parameter types are resolved from provider metadata instead of being supplied by the client, and makes retry behavior safer for non-idempotent calls.
What changed
Added console APIs for service method and provider discovery:
GET /api/v1/service/provider-instancesGET /api/v1/service/methodsGET /api/v1/service/method/detailPOST /api/v1/service/generic/invokeTo help us figure out who should review this PR, please put an X in all the areas that this PR affects.