# Service visibility

This article describes how to use Service Visibility Plugin (opens new window)

# Terminology

Term Description
Contract information External interface information provided by the service, including the class of the interface, request path, method name, parameter list, and return type
Blood relationship information Call relationship information between services, including IP and port information of service providers and service consumers

# Function introduction

The service visibility plug-in can collect the contract information and blood relationship of Spring Cloud and Dubbo applications. Without modifying the code, you can view the interface information provided by all services and the call relationship information between services through backend.

This plug-in completes the collection of interface information of service registration and provider information during service subscription based on the service registration, service subscription and other functions of Spring Cloud and Dubbo applications, so as to facilitate the unified management of users.

# Parameter configuration

# Sermant-agent configuration

The service visibility plug-in needs to configure (agent.service.visibility.enable=true), configure the service metadata (service.meta.*) in the Sermant-agent. For details, refer to the Sermant-agent User Manual

  • agent.service.visibility.enable: Choose the enable status for visibility service.
  • service.meta.*: Service metadata information. For example: group name, version number, region, etc. The service visibility plug-in collects metadata information for page display.

# Plug-in configuration

The service visibility plug-in needs to enable the collection switch. The configuration file of the plug-in can be found in the ${path}/sermant-agent-x.x.x/agent/pluginPackage/service-visibility/config/config.yaml. The configuration is as follows:

visibility.config:
  startFlag: true         # Service visibility collection switch. Control whether to collect and report indicators. If it is true, the plug-in will report data collection. If it is false, the plug-in will not report data collection.
Parameter key Description Default value Required
visibility.config.startFlag Service visibility collection switch false Yes

# Supported versions and restrictions

Framework support:

  • SpringBoot 1.5.10. Release and above
  • Dubbo 2.6.x-2.7.x

# Operation and result verification

The following will demonstrate how to use the service visibility plug-in.

# Preparations

# Step 1: Modify the configuration

  • Modify the Sermant-agent configuration

Find the configuration file in the ${path}/sermant-agent-x.x.x/agent/config/config.properties. The modified configuration items are as follows:

agent.service.visibility.enable=true # Enable status for visibility service.
  • Modify service visibility plug-in configuration

Find the configuration file of the plugin in the ${path}/sermant-agent-x.x.x/agent/pluginPackage/service-visibility/config/config. yaml. The modified configuration items are as follows:

visibility.config:
  startFlag: true           # Service visibility collection switch. If it is true, data collection and reporting will be performed.

# Step 2: compile and package the dubbo-test application

Execute the following command to package the subprojects dubbo-2-6-integration-consumer and dubbo-2-6-integration-provider in the dubbo-test project:

mvn clean package

You can get the dubbo-integration-consumer.jar package in the target folder in the dubbo-2-6-integration-consumer project and the dubbo-integration-provider.jar package in the dubbo-2-6-integration-provider project .

# Step 3: Start the application

  • Refer to the following command to start the backend application.
# Run under Linux
java -jar ${path}/sermant-agent-x.x.x/server/sermant/sermant-backend-x.x.x.jar
# Run under Windows
java -jar ${path}\sermant-agent-x.x.x\server\sermant\sermant-backend-x.x.x.jar
  • Refer to the following command to start the dubbo-2-6-integration-consumer application.
# Run under Linux
java -javaagent:${path}/sermant-agent-x.x.x/agent/sermant-agent.jar=appName=consumer -jar  dubbo-integration-consumer.jar
# Run under Windows
java -javaagent:${path}\sermant-agent-x.x.x\agent\sermant-agent.jar=appName=consumer -jar  dubbo-integration-consumer.jar
  • Refer to the following command to start the dubbo-2-6-integration-provider application.
# Run under Linux
java -javaagent:${path}/sermant-agent-x.x.x/agent/sermant-agent.jar=appName=provider -jar dubbo-integration-provider.jar
# Run under Windows
java -javaagent:${path}\sermant-agent-x.x.x\agent\sermant-agent.jar=appName=provider -jar dubbo-integration-provider.jar

illustrate: Where path needs to be replaced with the actual installation path of Sermant. x.x.x represents a Sermant version number.

# Verification

Visit the blood relationship information display page http://127.0.0.1:8900/#/consanguinity Or contract information display page http://127.0.0.1:8900/#/contract, if the page successfully displays the collection information, the plug-in will take effect.

The display effect is shown below:

  • Rendering of contract information display
FAILED
  • Rendering of blood relationship information display
FAILED
Last Updated: 4/1/2024, 3:31:01 AM