ambiguous-pointer opened a new pull request, #1414: URL: https://github.com/apache/dubbo-admin/pull/1414
**Please provide a description of this PR:** This PR implements the service and application dependency graph visualization as discussed in #1398. It provides the backend logic to trace upstream and downstream dependencies for both specific services and entire applications within a mesh. **Key Implementation Details:** * **Data Source:** Leverages `ServiceProviderMetadataResource` and `ServiceConsumerMetadataResource` to establish the caller-callee relationships. * **Logic:** * Builds a directed graph where `Source (Consumer) -> Target (Provider)`. * Supports filtering by `ServiceName` to show localized dependency trees. * Aggregates service-level dependencies into application-level nodes. * Includes instance information within the graph nodes for better observability. * Implemented efficient edge merging using an auxiliary map to avoid redundant visual links between the same applications. * **Standards:** Aligned with `dubbo-java-3.x` metadata standards. --- **To help us figure out who should review this PR, please put an X in all the areas that this PR affects.** * [ ] Docs * [ ] Installation * [X] User Experience * [ ] Dubboctl * [X] Console * [ ] Core Component **Please check any characteristics that apply to this pull request.** * [X] Feature * [ ] Bug Fix * [ ] Optimization * [ ] Refactoring --- ### **API Usage Example** You can retrieve the graph data using the following `curl` command: ```bash curl --location --request GET 'http://localhost:8888/api/v1/service/graph?mesh=zk3.6' ``` **Example Response:** ```json { "code": "Success", "message": "success", "data": { "nodes": [ { "id": "order-service", "label": "order-service", "data": [ { "appName": "order-service", "ip": "10.12.1.166", "rpcPort": 20881, "protocol": "dubbo" } ] } ], "edges": [ { "source": "order-service", "target": "inventory-service", "data": { "type": "dependency", "consumerApp": "order-service", "providerApp": "inventory-service" } } ] } } ``` --- ### **Data Structure Explanation** #### **1. GraphNode (`nodes`)** Represents an **Application** in the Dubbo mesh. * `id` & `label`: The Application Name. * `data`: An array of `Instance` objects belonging to this application, providing real-time runtime info (IP, Port, Protocol). #### **2. GraphEdge (`edges`)** Represents the **Dependency** between two applications. * `source`: The name of the Consumer application. * `target`: The name of the Provider application. * `data`: * `type`: Hardcoded as `"dependency"`. * `serviceName`: The specific Dubbo service interface causing this dependency (empty if it's an aggregated application graph). * `consumerApp`/`providerApp`: Redundant identifiers for easy processing on the frontend. --- **Please check any characteristics that apply to this pull request.** -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
