Service/Application Dependency Graph Implement#1460
Open
ambiguous-pointer wants to merge 11 commits intoapache:developfrom
Open
Service/Application Dependency Graph Implement#1460ambiguous-pointer wants to merge 11 commits intoapache:developfrom
ambiguous-pointer wants to merge 11 commits intoapache:developfrom
Conversation
…cessary blank lines
…sion apache#1398 * feat(api): add GraphServices endpoint for service-level topology Based on discussion apache#1398, use ServiceProviderMetadata and ServiceConsumerMetadata to return provider/consumer application relations as graph nodes and edges for AntV G6. * feat(api): add GraphApplications endpoint for application-level topology Traverse provider/consumer service relations to build application-level graph. Also add idx_service_consumer_service_key index to support efficient serviceKey queries. * feat(api): add graph models (GraphNode, GraphEdge, GraphData) in pkg/console/model/graph.go * feat(api): add ApplicationGraphReq, ServiceGraphReq and GetApplicationGraph, GetServiceGraph handlers * feat(router): register /application/graph and /service/graph routes * feat(api): fix error handling to use direct err pass-through instead of MeshNotFoundError
…he#1430](apache#1430)) * feat(api): replace Service.{providers,consumers,features} with {methods} field Simplify Service proto by removing providers, consumers, and features map, keeping only the aggregated methods list derived from provider metadata. * feat(api): derive Service resource from ServiceProviderMetadata on add/update/delete ServiceProviderMetadataEventSubscriber now maintains Service resources by aggregating methods from all provider instances sharing the same serviceKey. Handles add, update, and delete events to keep Service spec in sync. * feat(api): add language detection from provider metadata parameters Detect provider language (golang/java) from metadata parameters and method type signatures when explicit language field is absent. * feat(api): add GetServiceDetail endpoint returning language and methods Add GET /service/detail returning ServiceDetailResp with language and aggregated method names from the derived Service resource. * feat(api): add BuildServiceIdentityKey helper for {service}:{version}:{group} * feat(api): add ByServiceName index for ServiceKind * feat(api): refactor SearchServices to query ServiceResource directly SearchServices and SearchServicesByKeywords now use ServiceResource instead of ServiceProviderMetadataResource for service listing. * feat(api): remove providerAppName from ServiceSearchResp and ServiceTabDistributionReq * feat(api): add ServiceDetailReq and ServiceDetailResp models * feat(router): register /service/detail and /service/interfaces routes * feat(ui-vue3): remove providerAppName from grafana types and tab components
robocanic
reviewed
Apr 19, 2026
Contributor
robocanic
left a comment
There was a problem hiding this comment.
Greatwork! I left some comments and hope you can improve based on the comments
| // SearchServicesByKeywords search services by keywords with prefix matching | ||
| func SearchServicesByKeywords(ctx consolectx.Context, req *model.ServiceSearchReq) (*model.SearchPaginationResult, error) { | ||
| pageData, err := manager.PageListByIndexes[*meshresource.ServiceProviderMetadataResource]( | ||
| pageData, err := manager.PageListByIndexes[*meshresource.ServiceResource]( |
Contributor
There was a problem hiding this comment.
Correction: 泛型里面用的是ServiceResource, 下面resourceKind传的却是ServiceProviderMetadataKind
| return err | ||
| } | ||
|
|
||
| if oldRes != nil && oldRes.Spec != nil { |
Contributor
There was a problem hiding this comment.
Correction:这里oldResource和newResource的key肯定是一样的,这个判断是多余的,processUpdate和processUpsert逻辑应该是一样的,需要去掉
| serviceKey := meshresource.BuildServiceIdentityKey(serviceName, version, group) | ||
| resources, err := s.providerStore.ListByIndexes( | ||
| []index.IndexCondition{{IndexName: index.ByMeshIndex, Value: mesh, Operator: index.Equals}, | ||
| {IndexName: index.ByServiceProviderServiceName, Value: serviceName, Operator: index.Equals}, |
Contributor
There was a problem hiding this comment.
Suggestion: 这里可以直接用ServiceKey的索引,可以去掉后面的version和group的判断
| "github.com/duke-git/lancet/v2/strutil" | ||
| "k8s.io/client-go/tools/cache" | ||
|
|
||
| meshproto "github.com/apache/dubbo-admin/api/mesh/v1alpha1" |
Contributor
There was a problem hiding this comment.
…parameters and improve the code comments
* chore: translate Chinese comment to English in GraphApplications error handling * chore: reorder imports in service_provider_metadata.go
…a sync
1. pkg/console/service/service.go:132
- fix generic type mismatch with resourceKind
- generic ServiceResource should use ServiceKind, was incorrectly passing ServiceProviderMetadataKind
- index changed from ByServiceProviderServiceName to ByServiceName (aligned with ServiceKind)
2. pkg/core/discovery/subscriber/service_provider_metadata.go
- processUpdate: remove redundant oldRes key check (oldKey always equals newKey in same resource update,
else branch is unreachable dead code)
- syncService: use ByServiceProviderServiceKey index instead of ByServiceProviderServiceName
+ manual version/group filtering, reduces data returned from DB and improves performance
Ref: [1460](apache#1460 (comment))
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



This change introduces a complete service and application topology visualization feature based on
discussion #1398 and
issue #1430.
It adds both backend graph APIs and frontend AntV G6 visualization for tracing upstream/downstream
relationships via
ServiceProviderMetadataResourceandServiceConsumerMetadataResource.📌 What’s New
Application-level topology graph
GET /application/graphreturns provider/consumer application relations as typed nodesand edges. Each node declares its
type(application) andrule(provider/consumer/empty).Service-level topology graph
GET /service/graphreturns provider/consumer applications for a given service as a graph.A central
servicenode is connected to provider and consumer app nodes.Service detail API
GET /service/detailreturns aggregated service metadata (language, method names) derivedfrom all provider instances sharing the same
serviceKey.Service resource derivation
ServiceProviderMetadataEventSubscribernow maintainsServiceresources by aggregatingmethods from all provider instances. Language is auto-detected from provider metadata
parameters and method type signatures (golang/java).
Graph payload structure
{ "code": "Success", "message": "success", "data": { "nodes": [ { "id": "order-service", "label": "order-service", "type": "application", "rule": "provider" }, { "id": "com.ecommerce.api.service.OrderService::", "label": "com.ecommerce.api.service.OrderService::", "type": "service", "rule": "" }, { "id": "payment-service", "label": "payment-service", "type": "application", "rule": "consumer" } ], "edges": [ { "source": "com.ecommerce.api.service.OrderService::", "target": "order-service", "data": { "type": "provides" } }, { "source": "payment-service", "target": "com.ecommerce.api.service.OrderService::", "data": { "type": "consumes" } } ] } }New Topology tab components for both Applications and Services pages, rendered using AntV G6
with Vue-node integration. Clicking a node opens a detail drawer.
Service.{providers,consumers,features} replaced with a single methods []string field,
derived by aggregating method names from all provider instances.
📁 Affected Areas / Review Checklist