Micro-service debugging method and device

By deploying instances of abnormal microservices in the local environment and using the target joint debugging request routing mechanism, the problem of excessive resource consumption during the joint debugging of microservices is solved, and efficient microservice debugging is achieved.

CN120179533APending Publication Date: 2025-06-20BEIJING BAIRONG RUIBO TECH CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202510161110.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-13
Publication Date
2025-06-20

AI Technical Summary

Technical Problem

During the microservice joint debugging process, the prior art requires the deployment of all involved microservice instances in the local environment, resulting in excessive resource consumption and difficulty in effectively debugging abnormal microservices.

Method used

A microservice debugging method is proposed. By deploying an exception target microservice instance in the local environment, and generating a target joint debugging request to debug the target microservice, the joint debugging request is routed to the target instance in the local environment using identification information, reducing the consumption of local environment resources.

Benefits of technology

This implements the deployment of only the target microservice instances in the local environment during the microservice joint debugging process, while other microservices that do not experience exceptions continue to use the instances in the joint debugging environment, thereby reducing the resource consumption of microservice debugging on the local environment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120179533A_ABST
    Figure CN120179533A_ABST
Patent Text Reader

Abstract

The invention discloses a micro-service debugging method and device, and the main technical scheme comprises the steps: determining an abnormal target micro-service in a micro-service joint debugging process in a joint debugging environment, and deploying a target instance corresponding to the target micro-service in a local environment; generating a target joint debugging request for debugging the target micro-service, the target joint debugging request comprising identification information for indicating that the target micro-service is converted from an instance in a joint debugging environment to a target instance in a local environment, the target joint debugging request is used for indicating an instance of a micro-service located above the target micro-service in the joint debugging sequence to route the target joint debugging request to a target instance of the target micro-service in the local environment based on the identification information; performing joint debugging on each micro-service participating in the micro-service joint debugging process based on the target joint debugging request; and debugging the target micro-service in a local environment based on a log generated by the target joint debugging request processed and routed by the target instance.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of microservice debugging, and in particular, to a microservice debugging method and device. Background Art

[0002] With the development of computer technology, microservice architectures are increasingly being applied. Under a microservice architecture, a business function involves multiple microservices. Before a business function is launched, it is usually necessary to deploy corresponding instances of each microservice in the joint debugging environment, and use the instances of each microservice to perform joint debugging on the microservices involved in the business function in the joint debugging environment to verify whether multiple microservices can correctly implement the business function.

[0003] If an abnormal microservice appears during the microservice joint debugging process, then it is necessary to debug the abnormal microservice. Currently, the common way to debug an abnormal microservice is to deploy corresponding instances of all microservices involved in the business function in the local environment used for microservice debugging, and debug the abnormal microservice based on the deployed instances. This method will excessively consume resources in the local environment because it is necessary to deploy instances of all microservices involved in the business function in the local environment. It can be seen that how to reduce the resource consumption of microservice debugging on the local environment has become an urgent problem to be solved currently. Summary of the Invention

[0004] This application proposes a microservice debugging method and device, and the main purpose is to reduce the resource consumption of microservice debugging on the local environment.

[0005] To achieve the above object, this application mainly provides the following technical solutions:

[0006] In a first aspect, this application provides a microservice debugging method, and the microservice debugging method includes: determining a target microservice that appears abnormal during the microservice joint debugging process in the joint debugging environment, and deploying a target instance corresponding to the target microservice in the local environment; generating a target joint debugging request for debugging the target microservice, where the target joint debugging request includes identification information for indicating that the target microservice is converted from an instance in the joint debugging environment to the target instance in the local environment, and the target joint debugging request is used to instruct an instance of a microservice that is one position above the target microservice in the joint debugging order to route the target joint debugging request to the target instance of the target microservice in the local environment based on the identification information; performing joint debugging on each microservice participating in the microservice joint debugging process based on the target joint debugging request; and debugging the target microservice in the local environment based on the log generated by the target instance processing the routed target joint debugging request.

[0007] In a second aspect, this application provides a microservice debugging device, and the microservice debugging device includes:

[0008] A deployment module, configured to determine a target microservice with an exception during the joint debugging process of microservices in a joint debugging environment, and deploy a target instance corresponding to the target microservice in a local environment;

[0009] A generation module, configured to generate a target joint debugging request for debugging the target microservice, where the target joint debugging request includes identification information for indicating that the target microservice is converted from an instance in the joint debugging environment to the target instance in the local environment, and the target joint debugging request is used to instruct an instance of a microservice preceding the target microservice in the joint debugging order to route the target joint debugging request to the target instance of the target microservice in the local environment based on the identification information;

[0010] A joint debugging module, configured to perform joint debugging on each microservice participating in the microservice joint debugging process based on the target joint debugging request;

[0011] A debugging module, configured to debug the target microservice in the local environment based on logs generated by processing the routed target joint debugging request by the target instance.

[0012] In a third aspect, the present application provides a computer-readable storage medium, where the storage medium includes a stored program, and when the program runs, it controls a device where the storage medium is located to execute the microservice debugging method described in the first aspect.

[0013] In a fourth aspect, the present application provides an electronic device, where the electronic device includes: a memory, configured to store a program; a processor, coupled to the memory, configured to run the program to execute the microservice debugging method described in the first aspect.

[0014] The microservice debugging method and device provided by this application, when an abnormal target microservice appears during the joint debugging of microservices, deploy a target instance corresponding to the target microservice in the local environment, and generate a target joint debugging request for debugging the target microservice. The target joint debugging request includes identification information for indicating the conversion of the target microservice from an instance in the joint debugging environment to the target instance in the local environment, and the target joint debugging request is used to instruct the instance of the microservice one position above the target microservice in the joint debugging order to route the target joint debugging request to the target instance of the target microservice in the local environment based on the identification information. Then, perform joint debugging on each microservice participating in the microservice joint debugging process based on the target joint debugging request, so as to realize the use of the target instance of the target microservice in the local environment through the target joint debugging request, and realize the continued use of the instances of other microservices in the joint debugging environment. Finally, debug the target microservice in the local environment based on the logs generated by processing the routed target joint debugging request by the target instance. It can be seen that the solution provided in this embodiment, when debugging an abnormal target microservice during the microservice joint debugging process, only deploys an instance of the target microservice in the local environment, while other microservices involved in the microservice joint debugging process that do not have abnormalities continue to use the instances deployed in the joint debugging environment. Therefore, it can reduce the resource consumption of the local environment for debugging the target microservice. In addition, because the target joint debugging request for debugging the target microservice includes identification information for indicating the conversion of the target microservice from an instance in the joint debugging environment to the target instance in the local environment, and the target joint debugging request instructs the instance of the microservice one position above the target microservice in the joint debugging order to route the target joint debugging request to the target instance of the target microservice in the local environment based on the identification information, during joint debugging, the target joint debugging request can be accurately routed to the target instance in the local environment, so that the logs generated by the target instance can be obtained smoothly, and further, the debugging of the target microservice can be realized based on the logs.

[0015] The above description is only an overview of the technical solution of this application. In order to be able to understand the technical means of this application more clearly, it can be implemented according to the content of the specification. And in order to make the above and other purposes, features, and advantages of this application more obvious and understandable, the following specifically describes the specific embodiments of this application. Brief Description of the Drawings

[0016] In order to more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the drawings in the following description are some embodiments of this application. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.

[0017] Figure 1 Shows a flowchart of a microservice debugging method provided by an embodiment of this application;

[0018] Figure 2 Shows a schematic diagram of the process of microservice debugging provided by an embodiment of the present application;

[0019] Figure 3 Shows a schematic diagram of the structure of a microservice debugging device provided by an embodiment of the present application;

[0020] Figure 4 Shows a schematic diagram of the structure of a microservice debugging device provided by another embodiment of the present application. Detailed implementation manners

[0021] The exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided so that the present disclosure can be more thoroughly understood and the scope of the present disclosure can be fully conveyed to those skilled in the art.

[0022] For a target microservice that has an exception during the microservice joint debugging process, debugging is required to eliminate the exception existing in the target microservice. Currently, when debugging a target microservice with an exception, it is necessary to deploy instances of all microservices involved in the microservice joint debugging process in the local environment, perform microservice joint debugging based on the instances of all microservices in the local environment, and then debug the target microservice based on the logs generated by the instances of the target microservice during the microservice joint debugging process. It can be seen that in the existing method, since it is necessary to deploy instances of all microservices involved in the microservice joint debugging process in the local environment, it will occupy too many resources in the local environment.

[0023] Through research, it is found that if only instances of the target microservice with an exception during the microservice joint debugging process are deployed in the local environment, and other microservices that do not have exceptions involved in the microservice joint debugging process continue to use the instances deployed in the joint debugging environment, then the occupation of local resources by microservice debugging can be reduced.

[0024] Based on the above findings, this embodiment provides a technical solution for microservice debugging, specifically: Determine the target microservice that has an exception during the microservice joint debugging process in the joint debugging environment, and deploy the target instance corresponding to the target microservice in the local environment. Generate a target joint debugging request for debugging the target microservice. The target joint debugging request includes identification information for indicating the conversion of the target microservice from the instance in the joint debugging environment to the target instance in the local environment, and the target joint debugging request is used to instruct the instance of the microservice that is one position above the target microservice in the joint debugging order to route the target joint debugging request to the target instance of the target microservice in the local environment based on the identification information. Perform joint debugging on each microservice participating in the microservice joint debugging process based on the target joint debugging request, and process the logs generated by the routed target joint debugging request based on the target instance to debug the target microservice in the local environment. It can be seen that the solution provided in this embodiment, when debugging the target microservice with an exception during the microservice joint debugging process, only deploys the instance of the target microservice in the local environment, while the other microservices without exceptions involved in the microservice joint debugging process continue to use the instances deployed in the joint debugging environment. Therefore, it can reduce the resource consumption of the local environment for debugging the target microservice. In addition, since the target joint debugging request for debugging the target microservice includes identification information for indicating the conversion of the target microservice from the instance in the joint debugging environment to the target instance in the local environment, and the target joint debugging request instructs the instance of the microservice that is one position above the target microservice in the joint debugging order to route the target joint debugging request to the target instance of the target microservice in the local environment based on the identification information, during joint debugging, the target joint debugging request can be accurately routed to the target instance in the local environment, so that the logs generated by the target instance can be obtained smoothly, and further, the debugging of the target microservice can be realized based on the logs.

[0025] The technical solution for microservice debugging provided in this embodiment can debug the microservice with an exception during the joint debugging process of any microservice, and this embodiment does not limit the type of microservice.

[0026] Based on the above technical solution for microservice debugging, this embodiment specifically provides a microservice debugging method and apparatus. The following specifically describes the microservice calling method and apparatus provided in this embodiment.

[0027] As Figure 1 shown, an embodiment of the present application provides a microservice debugging method. This microservice debugging method is used to debug the microservice with an exception during the microservice joint debugging process, and can be applied to a debugging system or platform or an electronic device equipped with a debugging system. Figure 1 The microservice debugging method shown can at least include the following steps 101 to 104.

[0028] 101. Determine the target microservice with an exception during the joint debugging of microservices in the joint debugging environment, and deploy the target instance corresponding to the target microservice in the local environment.

[0029] For any business function that requires multiple microservices to implement, before it goes live, it is necessary to conduct joint debugging on the microservices involved to verify whether the calls between multiple microservices can accurately and stably implement the business function. The joint debugging of microservices is achieved by routing the joint debugging requests to the corresponding instances of each microservice in the joint debugging environment in sequence based on the joint debugging order of each microservice participating in the joint debugging.

[0030] Exemplarily, business function 1 requires microservice A, microservice B, microservice C, and microservice D to implement. Therefore, these four microservices are determined as the microservices participating in the joint debugging, and the order of these four microservices in the joint debugging sequence is: microservice A → microservice B → microservice C → microservice D. During the joint debugging of microservices, first determine the joint debugging requests required for the joint debugging, and then, based on the joint debugging order, route the joint debugging requests to the corresponding instances of microservice A, microservice B, microservice C, and microservice D in the joint debugging environment in sequence, so as to verify whether the calls between each microservice can accurately and stably implement business function 1 by processing the joint debugging requests through the instances of each microservice in sequence. The specific process of routing the joint debugging requests to the corresponding instances of microservice A, microservice B, microservice C, and microservice D in the joint debugging environment in sequence is as follows: first, route the joint debugging request to the corresponding instance of microservice A. The corresponding instance of microservice A processes the routed joint debugging request and obtains intermediate data 1. Add the intermediate data 1 that requires microservice B to process to the joint debugging request, and then route the joint debugging request with added data to the corresponding instance of microservice B. The corresponding instance of microservice B processes the routed joint debugging request and obtains intermediate data 2. Add the intermediate data 2 that requires microservice B to process to the joint debugging request, and then route the joint debugging request with added data to the corresponding instance of microservice C. The corresponding instance of microservice C processes the routed joint debugging request and obtains intermediate data 3. Add the intermediate data 3 that requires microservice D to process to the joint debugging request, and then route the joint debugging request with added data to the corresponding instance of microservice D. The corresponding instance of microservice D processes the routed joint debugging request, thereby realizing the processing of the joint debugging request by business function 1 and realizing the joint debugging of the microservices involved in business function 1.

[0031] If an exception occurs in a microservice during the joint debugging of microservices, then it is necessary to debug it to exclude the exception in a timely manner. In order to be able to determine the target microservice with an exception during the joint debugging of microservices, the microservice debugging method provided in this embodiment may further include the step of determining the target microservice with an exception during the joint debugging of microservices. The specific implementation method of this step may include the following two types:

[0032] First, during the microservice joint debugging process, for each instance of a microservice that the joint debugging request routes to in the joint debugging environment, obtain the logs generated by the instance of the microservice in the joint debugging environment to process the joint debugging request. If there is hint data indicating an exception in the obtained logs for the microservice, then determine the microservice as the target microservice that has an exception during the microservice joint debugging process.

[0033] The logs are used to record all data related to the instance of the microservice processing the joint debugging request. Therefore, once there is an exception in the microservice, it is very likely that there will be hint data indicating the exception in the logs. Based on this, it is possible to determine whether a microservice has an exception by detecting whether there is hint data indicating an exception in the logs for the microservice.

[0034] For any microservice, if it is detected that there is hint data indicating an exception in the logs corresponding to the instance of the microservice, it means that the microservice probably has an exception. Therefore, in order to be able to promptly eliminate the exception in the microservice, determine the microservice with the hint data as the target microservice that has an exception during the microservice joint debugging process. If it is detected that there is no indication data indicating an exception in the logs for the microservice, it means that the microservice probably has no exception. Therefore, determine that the microservice has no exception.

[0035] Second, detect whether a microservice debugging instruction is received. The microservice debugging instruction is used to indicate the microservice that needs to be debugged in the local environment among the microservices participating in the microservice joint debugging. If a microservice debugging instruction is received, then determine the microservice indicated by the microservice debugging instruction as the target microservice that has an exception during the microservice joint debugging process.

[0036] In this embodiment, in order to enable developers to flexibly specify the microservices that need to be debugged, a mechanism for issuing microservice debugging instructions is set up. Developers can flexibly control the microservices that need to be debugged in the local environment among the microservices participating in the microservice joint debugging as indicated by the microservice debugging instructions based on business needs.

[0037] When a microservice debugging instruction is received, it means that the developer needs to debug the microservice indicated by the debugging instruction. Therefore, determine the microservice indicated by the microservice debugging instruction as the target microservice that has an exception during the microservice joint debugging process.

[0038] The above two methods for determining the target microservice that has an exception during the microservice joint debugging process can be used alone or in combination, and this embodiment does not make any limitations in this regard.

[0039] After determining the target microservice with an exception during the joint debugging of microservices, it is necessary to deploy the target instance corresponding to the target microservice in the local environment to debug the target microservice through the target instance in the local environment. The methods for deploying the target instance corresponding to the target microservice in the local environment can include the following two types:

[0040] One type is that the specific process of deploying the target instance corresponding to the target microservice in the local environment includes the following steps: obtaining the code used to deploy the instance of the target microservice in the joint debugging environment; deploying the target instance corresponding to the target microservice in the local environment based on the code.

[0041] Considering that the exception of the microservice is probably caused by the code of the microservice, therefore, in order to better exclude the exception, obtain the code used to deploy the instance of the target microservice in the joint debugging environment, and then deploy the target instance corresponding to the target microservice in the local environment based on the code. That is, the code used to deploy the target instance of the target microservice in the local environment is exactly the same as the code used to deploy the instance of the target microservice in the joint debugging environment, which is more conducive to restoring the exception that occurred during the joint debugging of the target microservice and debugging the target microservice targeted based on the exception.

[0042] The other type is that during the microservice development process, the code corresponding to the microservice is continuously developed incrementally. Based on this, the specific process of deploying the target instance corresponding to the target microservice in the local environment includes the following steps: obtaining the updated code corresponding to the target microservice, where the updated code includes the code used to deploy the instance of the target microservice in the joint debugging environment and the new code developed based on these codes; deploying the target instance corresponding to the target microservice in the local environment based on the updated code.

[0043] During the microservice development process, new code will be incrementally added to the code corresponding to the microservice as the development progresses. Considering that if the code used to deploy the instance of the target microservice in the joint debugging environment is used to deploy the target instance of the target microservice in the local environment, then when deploying the instance of the target microservice in the joint debugging environment, the developer needs to submit the code used for deployment, and when deploying the instance of the target microservice in the local environment, the code developer needs to restore the working scene based on the previously submitted code to restore the code used when deploying the instance of the target microservice in the joint debugging environment, which will interrupt the coding work that the developer is currently doing.

[0044] In view of this, in this embodiment, the updated code corresponding to the target microservice is used to deploy the target instance corresponding to the target microservice in the local environment. Since the updated code includes the code used to deploy the instance of the target microservice in the joint debugging environment and the new code developed based on these codes, the updated code has the same business logic as the code used to deploy the instance corresponding to the target microservice in the joint debugging environment. Therefore, the target instance deployed based on the updated code can support the debugging of the target microservice. In this way, during the microservice code development process, the updated code corresponding to the microservice can be directly used to deploy the target instance corresponding to the target microservice in the local environment, without the need to restore the code used when deploying the instance of the target microservice in the joint debugging environment, which is conducive to the rapid deployment of the target instance.

[0045] For the above two methods of deploying the target instance corresponding to the target microservice in the local environment, either can be flexibly selected, and this embodiment does not make any limitations in this regard.

[0046] 102. Generate a target joint debugging request for debugging the target microservice. The target joint debugging request includes identification information for indicating the conversion of the target microservice from the instance in the joint debugging environment to the target instance in the local environment, and the target joint debugging request is used to instruct the instance of the microservice preceding the target microservice in the joint debugging order to route the target joint debugging request to the target instance of the target microservice in the local environment based on the identification information.

[0047] The target joint debugging request is a key factor for realizing the debugging of the target microservice through the target instance of the target microservice in the local environment. Therefore, it is necessary to generate a target joint debugging request for calling the target microservice. The methods for generating the target joint debugging request for debugging the target microservice can include the following three:

[0048] The first one is that the specific process of generating the target joint debugging request for debugging the target microservice can include the following steps: obtain the local routing information of the target instance in the local environment and the joint debugging request when the target microservice has an exception; generate identification information for indicating the conversion of the target microservice from the instance in the joint debugging environment to the target instance in the local environment based on the local routing information; add the identification information to the request header of the joint debugging request to form the target joint debugging request for debugging the target microservice.

[0049] Considering that if the joint debugging request when the target microservice has an exception is used, it is more conducive to reproducing the exception that occurs in the target microservice, which is more conducive to quickly eliminating the exception that occurs in the target microservice during the debugging of the target microservice. Based on this, this embodiment obtains the joint debugging request when the target microservice has an exception, so as to be able to generate a target joint debugging request that is more conducive to reproducing the exception of the target microservice based on the obtained joint debugging request.

[0050] To debug the target microservice in the local environment, this embodiment also obtains the local routing information of the target instance in the local environment, and generates identification information based on the local routing information to indicate the conversion of the target microservice from the instance in the joint debugging environment to the target instance in the local environment. The local routing information includes the environment identifier of the local environment and the routing address of the target instance in the local environment, where the routing address may include, but is not limited to, at least one of the following: the IP address of the target instance in the local environment, the domain name of the target instance in the local environment. Exemplarily, the identification information generated based on the local routing information consists of the service name of the target microservice and the local routing information of the target instance in the local environment, and the format may be in the form of key-value pairs. Specifically, the key is the service name of the target microservice, and the value is the local routing information.

[0051] After generating the identification information, it is necessary to add the identification information to the joint debugging request when the target microservice encounters an exception, so that the generated target joint debugging request can instruct the instance of the microservice one position above the target microservice in the joint debugging order to route the target joint debugging request to the target instance of the target microservice in the local environment based on the identification information. Considering that when each instance of the microservices participating in the joint debugging processes the joint debugging request, it is very likely to modify the request parameters in the joint debugging request, while the content in the request header is less likely to be modified. Therefore, the identification information is added to the request header of the joint debugging request when the target microservice encounters an exception, and then the joint debugging request with the added identification information is obtained as the target joint debugging request for debugging the target microservice. In this way, when debugging the target microservice based on the target joint debugging request, the instance of the microservice one position above the target microservice can obtain the identification information from the request header of the target joint debugging request and route the target joint debugging request to the target instance of the target microservice in the local environment based on the identification information.

[0052] Second, the specific process of generating the target joint debugging request for debugging the target microservice may include the following steps: obtaining the local routing information of the target instance in the local environment, and capturing the joint debugging request parameters when the target microservice encounters an exception; simulating the joint debugging request when the target microservice encounters an exception through a request generator based on the request parameters; generating identification information based on the local routing information to indicate the conversion of the target microservice from the instance in the joint debugging environment to the target instance in the local environment; adding the identification information to the request header of the joint debugging request to form the target joint debugging request for debugging the target microservice.

[0053] Considering the joint debugging requests when exceptions occur in the target microservice, it is more conducive to reproducing the exceptions that occur in the target microservice. However, in actual applications, due to restrictions such as permissions, it is not convenient to directly obtain the joint debugging requests when exceptions occur in the target microservice. Based on this, through research, it is found that the logs generated when exceptions occur in the target microservice include the joint debugging request parameters corresponding to the joint debugging requests used at that time, and these joint debugging request parameters are the key data that can simulate the joint debugging requests when exceptions occur in the target microservice. Therefore, in this embodiment, the logs generated when exceptions occur in the target microservice are obtained, and the joint debugging request parameters when exceptions occur in the target microservice are captured from the logs. After capturing the joint debugging request parameters when exceptions occur in the target microservice, in this embodiment, a request generator is used to simulate the joint debugging requests when exceptions occur in the target microservice based on the request parameters, so as to restore the joint debugging requests when exceptions occur in the target microservice. The request generator here can be flexibly selected based on business needs, and this embodiment does not make any limitations in this regard. An exemplary request generator is the Postman component.

[0054] In this method, the specific process of generating identification information based on local routing information and adding the identification information to the request header of the joint debugging request to form a target joint debugging request for debugging the target microservice is basically the same as the first method above, so it will not be elaborated here.

[0055] The third method is to obtain the local routing information of the target instance in the local environment, analyze the logs when exceptions occur in the target microservice, and estimate the types of exceptions that occur in the target microservice; generate identification information based on the local routing information to indicate the conversion of the target microservice from an instance in the joint debugging environment to the target instance in the local environment; add the identification information to the request header of a preset joint debugging request corresponding to the estimated type of exception to form a target joint debugging request for debugging the target microservice.

[0056] Considering the preset joint debugging requests corresponding to the types of exceptions that occur in the target microservice, it is more conducive to inducing the target microservice to have an exception of the corresponding type of exception again, and is more conducive to quickly and specifically excluding exceptions during the debugging of the target microservice. Based on this, through research, it is found that the types of exceptions that occur in the target microservice can be indicated in the logs generated when the target microservice has an exception. For example, the logs include hint data for indicating the types of exceptions. Therefore, analyze the logs when the target microservice has an exception, estimate the types of exceptions that occur in the target microservice, and select the preset joint debugging requests corresponding to the estimated types of exceptions. After selecting the preset joint debugging requests corresponding to the estimated types of exceptions, add the identification information to the request header of the preset joint debugging requests corresponding to the estimated types of exceptions to form the target joint debugging requests for debugging the target microservice. The specific processes of generating the identification information based on the local routing information and adding the identification information to the request header of the predicted joint debugging requests to form the target joint debugging requests for debugging the target microservice in this method are basically the same as those of the first method above, so they will not be elaborated here.

[0057] In some embodiments, the types of exceptions can be summarized based on the exceptions that occurred during the past microservice joint debugging process, and corresponding preset joint debugging requests are preset for each type of exception. In this way, after estimating the type of exception that occurs in the target microservice, the preset joint debugging requests corresponding to the type of exception of the target microservice can be quickly selected based on the correspondence between the type of exception and the preset joint debugging requests.

[0058] The types of exceptions can be set based on specific requirements, and this embodiment does not limit this. Exemplarily, the types of exceptions can include but are not limited to at least one of the following: network exception, response timeout, request timeout, path access permission error, exception throwing, restart mechanism exception, etc.

[0059] The preset joint debugging requests are used to control the microservice to generate operation data corresponding to the type of exception during the joint debugging process, and record these operation data in the corresponding logs for use in excluding the exceptions corresponding to the type of exception that occurs in the microservice. Exemplarily, if the type of exception is a network exception, the corresponding preset joint debugging request is used to control the microservice to generate operation data corresponding to the network exception during the joint debugging process. The operation data can include but are not limited to: network configuration data such as IP address, port number, and routing, network latency data, network packet loss data, network response duration, etc. The above three methods for determining the target joint debugging requests for debugging the target microservice can be flexibly selected and used at least one based on business needs, and this embodiment does not limit this.

[0060] 103. Perform joint debugging on each microservice participating in the microservice joint debugging process based on the target joint debugging requests.

[0061] After generating the target joint debugging request, perform joint debugging on each microservice participating in the microservice joint debugging process based on the target joint debugging request.

[0062] Performing joint debugging on microservices also needs to be implemented based on the service registry. Specifically, the joint debugging environment and the local environment share the same service registry. The service registry is used to record the joint debugging order of each microservice participating in the joint debugging, the routing information of the corresponding instance of each microservice in the joint debugging environment, and the routing information of the target instance of the target microservice in the local environment. Then, to ensure the smooth progress of the joint debugging process, the microservice debugging method provided in this embodiment may further include the following steps: Set a corresponding load balancing mechanism for each microservice participating in the joint debugging, so that the instances of each microservice route the joint debugging request to the instance of the next adjacent microservice in the joint debugging order based on the load balancing mechanism.

[0063] The load balancing mechanism is used to route the joint debugging request to the instance of the next microservice in the joint debugging environment based on the joint debugging order and routing information recorded in the service registry when the joint debugging request routed to the instance of the microservice does not include identification information. The load balancing mechanism is also used to, if the joint debugging request routed to the instance of the microservice includes identification information, based on the joint debugging order recorded in the service registry, when determining that the next microservice is the target microservice indicated by the identification information, route the joint debugging request to the instance of the target microservice in the local environment based on the routing information recorded in the service registry, and, when determining that the next microservice is not the target microservice, route the joint debugging request to the instance of the next microservice in the joint debugging environment based on the routing information recorded in the service registry.

[0064] The following combines the joint debugging order of each microservice participating in the joint debugging recorded in the service registry, the routing information of the corresponding instance of each microservice in the joint debugging environment, and the corresponding load balancing mechanism set for each microservice to illustrate the specific process of performing joint debugging on each microservice participating in the microservice joint debugging process based on the target joint debugging request. The specific process is as follows:

[0065] Determine the joint debugging order of each microservice participating in the microservice joint debugging process, and determine whether the microservice at the head of the joint debugging order is the target microservice. If it is the target microservice, route the target joint debugging request to the instance of the first microservice in the local environment based on the routing information recorded in the service registry. If it is not the target microservice, route the target joint debugging request to the instance of the first microservice in the joint debugging environment based on the routing information recorded in the service registry.

[0066] Then, each instance of each microservice receiving the target joint debugging request during the microservice joint debugging process executes the following process:

[0067] The instance of the microservice, based on the load balancing mechanism of the corresponding microservice, determines whether the routed target joint debugging request includes identification information;

[0068] If the identification information is not included, based on the joint debugging order and routing information recorded in the registry, route the target joint debugging request to the instance of the next microservice in the joint debugging environment;

[0069] If the identification information is included, further determine whether the next microservice is the target microservice indicated by the identification information based on the joint debugging order recorded in the registry; when it is determined that the next microservice is the target microservice indicated by the identification information, route the joint debugging request to the instance of the target microservice in the local environment based on the routing information recorded in the registry; when it is determined that the next microservice is not the target microservice, route the joint debugging request to the instance of the next microservice in the joint debugging environment based on the routing information recorded in the registry.

[0070] According to the joint debugging order, the instance of each microservice that receives the target joint debugging request repeats the above process until the instance of the microservice in the joint debugging order completes the corresponding operation based on the target joint debugging request, and then determines that the joint debugging process ends.

[0071] In summary, by combining the joint debugging order of each microservice participating in the joint debugging recorded in the registry, the routing information of the corresponding instance of each microservice in the joint debugging environment, and setting the corresponding load balancing mechanism for each microservice, when performing joint debugging on each microservice participating in the microservice joint debugging process based on the target joint debugging request, it can be ensured that the target instance in the local environment is used for the target microservice, and the instance in the joint debugging environment is continued to be used for other microservices.

[0072] 104. Process the log generated by the routed target joint debugging request based on the target instance, and debug the target microservice in the local environment.

[0073] After the target instance of the target microservice in the local environment receives the target joint debugging request routed by the instance of the previous microservice in the joint debugging order, the target instance will perform relevant business processing based on the routed target joint debugging request, and the relevant data generated by the target instance during business processing based on the target joint debugging request will be stored in the corresponding log. The log is one of the important bases for debugging the target microservice. Therefore, process the log generated by the target instance processing the routed target joint debugging request, and debug the target microservice in the local environment.

[0074] The methods for debugging the target microservice in the local environment based on the log generated by the target instance processing the routed target joint debugging request can include the following two:

[0075] Method 1: For debugging the target microservice in the local environment based on the logs generated by the target instance processing the target joint debugging request, the specific process may include the following steps: Submit the logs generated by the target instance processing the target joint debugging request to a preset location, and based on the content recorded in the logs at the preset location, analyze the anomalies existing in the target microservice, and based on the analyzed anomalies, debug the target microservice in the local environment.

[0076] Furthermore, considering that the target joint debugging request of the target instance comes from the instance of the microservice that is one position above the target microservice in the joint debugging order, and after the target instance of the target microservice processes the target joint debugging request, it will continue to route the target joint debugging request to the instance of the microservice in the next position in the joint debugging order. Therefore, the logs generated by the instances of the microservice that is one position above and one position below the target microservice processing the target joint debugging request can both be used as references for debugging the target microservice. Based on this, the logs generated by the target instance processing the target joint debugging request routed, the logs generated by the instances of the microservice that is one position above and one position below the target microservice processing the joint debugging request can be submitted to the preset location together, so that developers can have richer reference data to debug the target microservice and eliminate the anomalies existing in the target microservice.

[0077] Method 2: For debugging the target microservice in the local environment based on the logs generated by the target instance processing the target joint debugging request, the specific process may include the following steps: If it is detected that there is target data in the logs generated by the target instance processing the target joint debugging request routed, then determine the target anomaly that occurs in the target microservice based on the target data, where the target data is used to indicate the anomaly of the target microservice. Adopt the debugging operation for anomaly elimination corresponding to the target anomaly to debug the target microservice in the local environment.

[0078] In this embodiment, if an anomaly occurs when the target instance of the target microservice performs relevant business processing based on the target joint debugging request, then the target data related to the anomaly will be recorded in the logs. Therefore, it is necessary to detect whether there is target data in the logs generated by the target instance processing the target joint debugging request routed.

[0079] If there is target data in the log generated by the target instance processing the routed target joint debugging request, it indicates that there is an exception related to the target data in the target microservice. Therefore, based on the target data, determine the target exception that occurred in the target microservice. The target data can describe the exception, and based on the target data, the target exception that occurred in the target microservice can be determined. The process of determining the target exception can be to input the target data into a preset model for identifying exceptions, and the preset model determines the target exception that occurred in the target microservice based on the target data. The preset model is trained based on multiple sets of data, and each set of data includes the target data and the corresponding exception. In this way, after the preset model is trained, when it receives the input target data, it can identify and output the corresponding exception.

[0080] In this embodiment, in order to improve the microservice debugging efficiency, at least one debugging operation corresponding to an exception can be preset in advance based on prior knowledge. The debugging operation is used to eliminate the corresponding exception in the microservice, and specifically, it is an operation to eliminate the exception. For example, perform corresponding modification, deletion, and addition operations on the code of the microservice. Therefore, after determining the target exception, use the debugging operation corresponding to the target exception to debug the target microservice in the local environment.

[0081] Furthermore, if no debugging operation corresponding to the target exception is found, it means that the target microservice cannot be debugged based on the existing debugging operations. A prompt indicating that no debugging operation is available can be issued, so that the developer can be aware of the fact that the existing debugging operations cannot be used to debug the target microservice based on the prompt. At this time, the first method of debugging the target microservice in the local environment by using the log generated by the target instance processing the routed target joint debugging request can be used to debug the target microservice.

[0082] Furthermore, after successfully debugging the target microservice by using the first method of debugging the target microservice in the local environment by using the log generated by the target instance processing the routed target joint debugging request, the debugging operations used to solve the exception that occurred in the target microservice can be summarized based on the empirical data used for successful debugging, and the corresponding relationship between the exception and the debugging operation can be recorded, so that after encountering the same exception again, the corresponding debugging operation can be directly used to debug the microservice.

[0083] The above two methods of debugging the target microservice in the local environment by using the log generated by the target instance processing the routed joint debugging request can be used alone or in combination based on business requirements, and this embodiment does not make any limitations in this regard.

[0084] The microservice debugging method provided by the embodiments of the present application, when an abnormal target microservice appears during the joint debugging of microservices, deploys a target instance corresponding to the target microservice in the local environment, and generates a target joint debugging request for debugging the target microservice. The target joint debugging request includes identification information for indicating that the target microservice is converted from an instance in the joint debugging environment to the target instance in the local environment, and the target joint debugging request is used to instruct the instance of the microservice located in the previous position of the target microservice in the joint debugging order to route the target joint debugging request to the target instance of the target microservice in the local environment based on the identification information. Then, perform joint debugging on each microservice participating in the microservice joint debugging process based on the target joint debugging request, so as to implement using the target instance of the target microservice in the local environment through the target joint debugging request, and to continue using the instances of other microservices in the joint debugging environment. Finally, debug the target microservice in the local environment based on the logs generated by processing the routed target joint debugging request by the target instance. It can be seen that the solution provided by this embodiment, when debugging an abnormal target microservice during the microservice joint debugging process, only deploys an instance of the target microservice in the local environment, while other microservices involved in the microservice joint debugging process that do not have abnormalities continue to use the instances deployed in the joint debugging environment. Therefore, it can reduce the resource consumption of the local environment for debugging the target microservice. In addition, since the target joint debugging request for debugging the target microservice includes identification information for indicating that the target microservice is converted from an instance in the joint debugging environment to the target instance in the local environment, and the target joint debugging request instructs the instance of the microservice located in the previous position of the target microservice in the joint debugging order to route the target joint debugging request to the target instance of the target microservice in the local environment based on the identification information, during joint debugging, the target joint debugging request can be accurately routed to the target instance in the local environment, so that the logs generated by the target instance can be obtained smoothly, and further, the target microservice can be debugged based on the logs.

[0085] In some embodiments of the present application, when the target microservice is not at the first position in the joint debugging order, the joint debugging request it receives is provided by the instance of the microservice located in the previous position in the joint debugging order. Considering that the abnormality of the target microservice may be caused by an incorrect joint debugging request provided by the previous microservice, in order to more comprehensively eliminate the abnormality, the microservice debugging method provided by this embodiment may further include the following steps: detecting whether there is an adjacent previous microservice of the target microservice in the joint debugging order; if there is an adjacent previous microservice of the target microservice in the joint debugging order, then add and determine the previous microservice as the target microservice with an abnormality during the microservice joint debugging process.

[0086] When it is detected that there is an adjacent previous microservice for the target microservice in the joint debugging order, the previous microservice is added to the target microservice where an exception occurs during the microservice joint debugging process. In this way, the logs of the target instances of the previous and subsequent target microservices in the local environment can be comprehensively integrated to comprehensively eliminate the exceptions existing in the target microservice.

[0087] Exemplarily, microservices A, B, C, and D involved in business function 1 participate in the microservice joint debugging. Microservice C has an exception during the microservice joint debugging process, and microservice C is determined as the target microservice. After detection, it is found that there is a previous microservice "microservice B" for microservice C in the joint debugging order. Therefore, microservice B is also determined as the target microservice, and the target microservice includes microservice B and microservice C. In this way, when debugging the target microservice, it can be analyzed whether the exception of microservice C is caused by an abnormal joint debugging request provided by microservice B, so that the exception of microservice C can be more comprehensively eliminated.

[0088] It should be noted that when there is more than one target microservice, the identification information included in the generated target joint debugging request for calling the target microservice indicates that each target microservice is respectively converted into a target instance in the local environment by an instance in the joint debugging environment. Specifically, the identification information indicates the local routing information of the target instance of each target microservice in the local environment.

[0089] Exemplarily, if the target microservice includes microservice 1 and microservice 2, the identification information includes: information 1 composed of the service name of microservice 1 and the local routing information 1 of the target instance 1 of microservice 1 in the local environment, and information 2 composed of the service name of microservice 2 and the local routing information 2 of the target instance 2 of microservice 2 in the local environment. In this way, when conducting joint debugging on the target joint debugging request, by combining the identification information included in the target joint debugging request, the joint debugging order of each microservice participating in the joint debugging recorded in the registration center, the routing information of the corresponding instance of each microservice in the joint debugging environment, and the corresponding load balancing mechanism set for each microservice, the target joint debugging request can be accurately routed to the corresponding target instance of each target microservice in the local environment.

[0090] In some embodiments of the present application, after debugging the target microservice, in order to verify the debugging effect of the target microservice, it is also necessary to conduct joint debugging on the target microservice to detect whether an exception will still occur during the joint debugging of the debugged target microservice. Therefore, for the logs generated by processing the routed target joint debugging request based on the target instance in step 104 above, after debugging the target microservice in the local environment, the microservice debugging method provided in this embodiment may further include the following steps: If the target microservice is successfully debugged, deploy an instance corresponding to the successfully debugged target microservice in the joint debugging environment, and use the deployed instance to replace the original instance of the target microservice in the joint debugging environment.

[0091] After replacing the original instance of the target microservice in the joint debugging environment with the newly deployed instance, it is possible to check whether the target microservice after debugging will still encounter anomalies during the microservice joint debugging process based on the newly deployed instance of the target microservice.

[0092] Exemplarily, microservices A, B, C, and D involved in business function 1 participate in the microservice joint debugging. Microservice C encounters an anomaly during the microservice joint debugging process, and microservice C is determined as the target microservice. After debugging the target instance corresponding to microservice C in the local environment, it is determined that microservice C has been successfully debugged. Then, the instance corresponding to microservice C after successful debugging is newly deployed in the joint debugging environment, and then the original instance of microservice C in the joint debugging environment is replaced with the newly deployed instance. In this way, it is possible to re-perform the microservice joint debugging on microservices A, B, C, and D based on the instances of microservices A, B, and D in the joint debugging environment and the newly deployed instance of microservice C in the joint debugging environment to check whether the debugged microservice C will still encounter anomalies during the microservice joint debugging process.

[0093] In some embodiments of the present application, considering that multiple people debugging the microservice with anomalies can improve the debugging efficiency of the microservice, based on this, the microservice debugging method provided in this embodiment may further include the following steps: obtaining at least one debugging plan for the target microservice, where the debugging plan includes a local environment identifier and target anomaly information, and the local environment identifiers included in different debugging plans are different; respectively determining the local environment corresponding to the local environment identifier included in each debugging plan as the local environment for deploying the target instance corresponding to the target microservice, and triggering the execution of step 101 above to deploy the target instance corresponding to the target microservice in the local environment.

[0094] In order to enable multiple people to debug the microservice with anomalies, it is possible to obtain at least one debugging plan for the target microservice with anomalies. The local environment identifiers included in different debugging plans are different, and each local environment identifier corresponds to a local environment that can be used by a person. In this way, after obtaining at least one debugging plan for the target microservice, the local environment corresponding to the local environment identifier included in each debugging plan is respectively determined as the local environment for deploying the target instance corresponding to the target microservice, and triggering the execution of step 101 above to deploy the target instance corresponding to the target microservice in the local environment. In this way, it is possible to deploy the target instances corresponding to the target microservice in multiple different local environments respectively, creating conditions for multiple people to debug the target microservice.

[0095] Further, in order to be able to debug the target microservice in a targeted manner, each debugging solution further includes target exception information, which is used to indicate the corresponding exception, and the exceptions indicated by different target exception information are different. Based on this, when generating a target joint debugging request for debugging the target microservice, the following steps are respectively executed for each debugging solution: Based on the local environment identifier included in the current debugging solution, generate identification information for indicating that the target microservice is converted from an instance in the joint debugging environment to a target instance in the local environment corresponding to the local environment identifier. Based on the identification information and the target exception information included in the current debugging solution, generate a target joint debugging request for debugging the target microservice. The generated target joint debugging request is used to debug the exception indicated by the target exception information included in the current debugging solution.

[0096] After this step, each debugging solution has its own corresponding target joint debugging request, and then the following steps can be respectively executed for the target joint debugging request corresponding to each debugging solution: Jointly debug each microservice participating in the microservice joint debugging process based on the target joint debugging request corresponding to the current debugging solution; Based on the logs generated by the target instance processing the routed target joint debugging request, debug the target microservice in the local environment based on the exception indicated by the target exception information included in the current debugging solution.

[0097] It should be noted that the target exception information included in the debugging solution may have the following characteristics: First, the target exception information included in each debugging solution is the same, and the local environment corresponding to the local environment identifier included in each debugging solution debugs the target microservice for the same exception, so as to comprehensively integrate the debugging results of the target microservice in each local environment to improve the debugging effect of the target microservice. Second, the target exception information included in each debugging solution is different, and the local environment corresponding to the local environment identifier included in each debugging solution debugs the target microservice for different exceptions, so as to improve the debugging efficiency of the target microservice. Third, the target exception information included in some debugging solutions is the same, and the local environment corresponding to the local environment identifier included in some debugging solutions debugs the target microservice for the same exception, and the local environment corresponding to the local environment identifier included in each debugging solution debugs the target microservice for different exceptions. In this way, the debugging effect of the target microservice can be improved while the debugging efficiency is improved.

[0098] Exemplarily, the following uses Figure 2 the schematic diagram of the microservice debugging process shown to illustrate the technical solution for multiple people to debug the microservice with exceptions in this embodiment. From Figure 2It can be seen that microservices A, B, and C involved in business function 1 participate in microservice joint debugging, and the order of these three microservices in the joint debugging sequence is: microservice A → microservice B → microservice C. In the joint debugging environment, instances corresponding to microservices A, B, and C are deployed, and microservice joint debugging is performed based on these instances. During the microservice joint debugging process, an exception occurs in microservice B. Therefore, microservice B is determined as the target microservice with an exception. In order to improve the debugging efficiency of microservice B, in this embodiment, two debugging schemes are used to debug microservice B to enable two people to debug microservice B and improve the debugging efficiency of microservice B.

[0099] The exception that occurs in microservice B is a network exception. Based on this, first, debugging scheme 1 and debugging scheme 2 for microservice B are obtained. Debugging scheme 1 includes local environment identifier 001 and target exception information 1. Among them, local environment identifier 001 is used to indicate local environment 1, and target exception information 1 is used to indicate the network delay included in the network exception of the microservice. Debugging scheme 2 includes local environment identifier 002 and target exception information 2. Among them, local environment identifier 002 is used to indicate local environment 2, and target exception information 2 is used to indicate the packet loss included in the network exception of the microservice. The local environment 1 corresponding to the local environment identifier 001 included in debugging scheme 1 is determined as the local environment for deploying the target instance corresponding to microservice B, and the local environment 2 corresponding to the local environment identifier 002 included in debugging scheme 2 is determined as the local environment for deploying the target instance corresponding to microservice B. As Figure 2 shown, the target instance corresponding to microservice B is deployed in local environment 1, and the target instance corresponding to microservice B is deployed in local environment 2.

[0100] After the target instances corresponding to microservice B are distributed and deployed in local environment 1 and local environment 2, based on the local environment identifier 001 included in debugging scheme 1, identification information is generated to indicate the conversion of microservice B from the instance in the joint debugging environment to the target instance in local environment 1 corresponding to the local environment identifier 001. Based on the identification information and the target exception information 1 included in debugging scheme 1, a target joint debugging request 1 for debugging microservice B is generated. Similarly, based on the local environment identifier 002 included in debugging scheme 2, identification information is generated to indicate the conversion of microservice B from the instance in the joint debugging environment to the target instance in local environment 2 corresponding to the local environment identifier 002. Based on the identification information and the target exception information 2 included in debugging scheme 2, a target joint debugging request 2 for debugging microservice B is generated.

[0101] After generating the target joint debugging request 1 and the target joint debugging request 2, each microservice participating in the microservice joint debugging process is jointly debugged based on the target joint debugging request 1 corresponding to the debugging solution 1. The logs generated by processing the routed target joint debugging request 1 by the target instance in the local environment 1 are processed, and in the local environment 1, the microservice B is debugged based on the exception indicated by the target exception information 1 included in the debugging solution 1. Similarly, each microservice participating in the microservice joint debugging process is jointly debugged based on the target joint debugging request 2 corresponding to the debugging solution 2. The logs generated by processing the routed target joint debugging request 2 by the target instance in the local environment 2 are processed, and in the local environment 2, the microservice B is debugged based on the exception indicated by the target exception information 2 included in the debugging solution 2. This can enable multiple people to debug the microservice B with exceptions, and can improve the debugging efficiency of the microservice B.

[0102] In some embodiments of the present application, the following uses Figure 2 The schematic diagram of the microservice debugging process shown to illustrate the microservice debugging method provided in this embodiment. From Figure 2 It can be seen that the microservices A, B, and C involved in the business function 1 participate in the microservice joint debugging, and the order of these three microservices in the joint debugging is: microservice A → microservice B → microservice C. In the joint debugging environment, instances corresponding to the microservices A, B, and C are deployed, and microservice joint debugging is performed based on these instances. During the microservice joint debugging process, an exception occurs in the microservice B, so the microservice B is determined as the target microservice with an exception.

[0103] In this embodiment, the target instance of the microservice B deployed in the local environment 1 is used to illustrate the microservice debugging method provided in this embodiment. Based on this, after determining that the microservice B is the target microservice, the target instance corresponding to the microservice B is deployed in the local environment 1. Then, the joint debugging request 1 when the microservice B has an exception is obtained, and the local routing information of the target instance in the local environment 1 is obtained. The local routing information includes the environment identifier 1 of the local environment 1 and the routing address 1 of the target instance in the local environment 1. Then, based on the local routing information, identification information for indicating the conversion of the microservice B from the instance in the joint debugging environment to the target instance in the local environment 1 is generated. The identification information exists in the form of a key-value pair as "environment identifier 1: routing address 1", and the identification information indicates the conversion of the microservice B from the instance in the joint debugging environment to the target instance in the local environment 1. The identification information is added to the request header of the joint debugging request 1 to form the target joint debugging request for debugging the microservice B. The target joint debugging request is used to instruct the instance of the microservice located one position above the microservice B in the joint debugging order to route the target joint debugging request to the target instance of the microservice B in the local environment 1 based on the identification information.

[0104] Then, based on the target joint debugging request, microservices A, B, and C participating in the microservice joint debugging process are jointly debugged. The joint debugging process is carried out in combination with the joint debugging order of each microservice recorded in the service registry, the routing information of the corresponding instances of each microservice in the joint debugging environment, and the corresponding load balancing mechanism set for each microservice, and the joint debugging process is as follows:

[0105] Determine the joint debugging order of each microservice participating in the microservice joint debugging process. First, judge whether microservice A at the top of the joint debugging order is the target microservice. After judgment, microservice A is not the target microservice, so the target joint debugging request is routed to the instance of microservice A in the joint debugging environment based on the routing information recorded in the service registry.

[0106] After the instance of microservice A in the joint debugging environment processes the target joint debugging request, based on the load balancing mechanism of the corresponding microservice, it is determined that the routed target joint debugging request includes identification information. Further, based on the joint debugging order recorded in the service registry, judge whether the next microservice B is the target microservice indicated by the identification information. After determination, when it is determined that the next microservice B is the target microservice "microservice B" indicated by the identification information, the joint debugging request is routed to the instance of microservice B in the local environment based on the routing information recorded in the service registry.

[0107] After the target instance of microservice B in local environment 1 processes the target joint debugging request, based on the load balancing mechanism of the corresponding microservice, it is determined that the routed target joint debugging request includes identification information. Further, based on the joint debugging order recorded in the service registry, judge whether the next microservice C is the target microservice indicated by the identification information. After determination, when it is determined that the next microservice C is not the target microservice "microservice B" indicated by the identification information, the target joint debugging request is routed to the instance of microservice C in the joint debugging environment based on the routing information recorded in the service registry. After the instance of microservice C executes the corresponding operation based on the target joint debugging request, it is determined that the joint debugging process ends.

[0108] After the joint debugging ends, obtain the log generated by the target instance of microservice B in local environment 1 processing the routed target joint debugging request, and then debug microservice B in local environment 1 based on the obtained log, thus completing the entire microservice debugging process.

[0109] From Figure 2As can be seen from the process of microservice debugging shown, the microservice debugging method provided in this embodiment has the following effects: First, when debugging a target microservice that has an exception during the joint debugging of microservices, only an instance of the target microservice is deployed in the local environment, while other microservices that do not have exceptions involved in the microservice joint debugging process continue to use the instances deployed in the joint debugging environment. Therefore, it can reduce the resource consumption of the local environment for debugging the target microservice, thus saving local resources. Second, the joint debugging requests processed by the target microservice are directly routed and provided by the instance of the microservice in the previous position. Therefore, there is no need to manually create joint debugging requests for the target microservice, which reduces the complexity of microservice debugging and saves a lot of time.

[0110] Furthermore, an embodiment of the present application also provides a microservice debugging device, as Figure 3 shown. The microservice debugging device includes:

[0111] A deployment module 21, configured to determine a target microservice that has an exception during the microservice joint debugging process in the joint debugging environment, and deploy a target instance corresponding to the target microservice in the local environment;

[0112] A generation module 22, configured to generate a target joint debugging request for debugging the target microservice. The target joint debugging request includes identification information for indicating that the target microservice is converted from an instance in the joint debugging environment to the target instance in the local environment, and the target joint debugging request is used to instruct an instance of the microservice in the previous position in the joint debugging order to route the target joint debugging request to the target instance of the target microservice in the local environment based on the identification information;

[0113] A joint debugging module 23, configured to perform joint debugging on each microservice participating in the microservice joint debugging process based on the target joint debugging request;

[0114] A debugging module 24, configured to debug the target microservice in the local environment based on the log generated by the target instance processing the routed target joint debugging request.

[0115] The microservice debugging device provided by the embodiment of the present application, when an abnormal target microservice appears during the joint debugging of microservices, deploys a target instance corresponding to the target microservice in the local environment, and generates a target joint debugging request for debugging the target microservice. The target joint debugging request includes identification information for indicating the conversion of the target microservice from an instance in the joint debugging environment to the target instance in the local environment, and the target joint debugging request is used to instruct the instance of the microservice located one position above the target microservice in the joint debugging order to route the target joint debugging request to the target instance of the target microservice in the local environment based on the identification information. Then, based on the target joint debugging request, each microservice participating in the microservice joint debugging process is jointly debugged, so as to realize the use of the target instance of the target microservice in the local environment through the target joint debugging request, and to realize the continued use of the instances of other microservices in the joint debugging environment. Finally, based on the logs generated by processing the routed target joint debugging request by the target instance, the target microservice is debugged in the local environment. It can be seen that the solution provided by this embodiment, when debugging an abnormal target microservice during the microservice joint debugging process, only deploys an instance of the target microservice in the local environment, while other microservices involved in the microservice joint debugging process that do not have abnormalities continue to use the instances deployed in the joint debugging environment. Therefore, it can reduce the resource consumption of the local environment for debugging the target microservice. In addition, since the target joint debugging request for debugging the target microservice includes identification information for indicating the conversion of the target microservice from an instance in the joint debugging environment to the target instance in the local environment, and the target joint debugging request instructs the instance of the microservice located one position above the target microservice in the joint debugging order to route the target joint debugging request to the target instance of the target microservice in the local environment based on the identification information, during joint debugging, the target joint debugging request can be accurately routed to the target instance in the local environment, so that the logs generated by the target instance can be successfully obtained, and further, the debugging of the target microservice can be realized based on the logs.

[0116] In some embodiments of the present application, as Figure 4 shown, the debugging module 24 is specifically configured to, if it detects that there is target data in the log generated by the target instance processing the routed target joint debugging request, determine the target exception that occurred in the target microservice based on the target data, where the target data is used to indicate the target microservice exception; and perform a debugging operation for exception elimination corresponding to the target exception to debug the target microservice in the local environment.

[0117] In some embodiments of the present application, as Figure 4 shown, the deployment module 21 includes:

[0118] The first deployment unit 211 is configured to obtain the code used to deploy the instance of the target microservice in the joint debugging environment; and deploy the target instance corresponding to the target microservice in the local environment based on the code.

[0119] In some embodiments of the present application, as Figure 4 shown, the deployment module 21 includes:

[0120] A second deployment unit 212, configured to obtain the update code corresponding to the target microservice, where the update code includes the code for deploying the instance of the target microservice in the joint debugging environment and the new code developed based on the code; and deploy the target instance corresponding to the target microservice in the local environment based on the update code.

[0121] In some embodiments of the present application, as Figure 4 shown, the joint debugging environment and the local environment share the same registry, and the registry is used to record the joint debugging order of each microservice participating in the joint debugging, the routing information of the corresponding instance of each microservice in the joint debugging environment, and the routing information of the corresponding target instance of the target microservice in the local environment. Then, the microservice debugging device provided in this embodiment further includes:

[0122] A setting module 25, configured to set a corresponding load balancing mechanism for each microservice participating in the joint debugging, so that the instances of each microservice route the joint debugging request to the instance of the next adjacent microservice in the joint debugging order based on the load balancing mechanism;

[0123] wherein, the load balancing mechanism is used to route the joint debugging request to the instance of the next microservice in the joint debugging environment based on the joint debugging order and routing information recorded in the registry when the joint debugging request routed to the instance of the microservice does not include identification information;

[0124] The load balancing mechanism is further used for: if the joint debugging request routed to the instance of the microservice includes identification information, then when it is determined that the next microservice is the target microservice indicated by the identification information based on the joint debugging order recorded in the registry, route the joint debugging request to the instance of the target microservice in the local environment based on the routing information recorded in the registry; and when it is determined that the next microservice is not the target microservice, route the joint debugging request to the instance of the next microservice in the joint debugging environment based on the routing information recorded in the registry.

[0125] In some embodiments of the present application, as Figure 4 shown, the microservice debugging device provided in this embodiment further includes:

[0126] A first determination module 26, configured to, during the joint debugging of microservices, each time the joint debugging request is routed to an instance of a microservice in the joint debugging environment, obtain the log generated by the instance of the microservice processing the joint debugging request from the joint debugging environment, and if there is prompt data indicating that the microservice has an exception in the obtained log, determine the microservice as the target microservice that has an exception during the joint debugging of microservices.

[0127] In some embodiments of the present application, as Figure 4 shown, the microservice debugging device provided in this embodiment further includes:

[0128] A second determination module 27, configured to, if a microservice debugging instruction is received, determine the microservice indicated by the microservice debugging instruction as a target microservice that has an exception during microservice joint debugging, where the microservice debugging instruction is used to indicate a microservice that needs to be debugged in a local environment among the microservices participating in microservice joint debugging.

[0129] In some embodiments of the present application, as Figure 4 shown, the microservice debugging device provided in this embodiment further includes:

[0130] A third determination module 28, configured to, if there is an adjacent previous microservice of the target microservice in the joint debugging order, add and determine the previous microservice as a target microservice that has an exception during microservice joint debugging.

[0131] In some embodiments of the present application, as Figure 4 shown, the generation module 22 includes:

[0132] A first generation unit 221, configured to obtain the local routing information of the target instance in the local environment, and the joint debugging request when the target microservice has an exception; generate identification information for instructing the conversion of the target microservice from an instance in the joint debugging environment to the target instance in the local environment based on the local routing information; add the identification information to the request header of the joint debugging request to form a target joint debugging request for debugging the target microservice.

[0133] In some embodiments of the present application, as Figure 4 shown, the generation module 22 includes:

[0134] A second generation unit 222, configured to obtain the local routing information of the target instance in the local environment, and capture the joint debugging request parameters when the target microservice has an exception; simulate the joint debugging request when the target microservice has an exception based on the request parameters through a request generator; generate identification information for instructing the conversion of the target microservice from an instance in the joint debugging environment to the target instance in the local environment based on the local routing information; add the identification information to the request header of the joint debugging request to form a target joint debugging request for debugging the target microservice.

[0135] In some embodiments of the present application, as Figure 4 shown, the generation module 22 includes:

[0136] A third generation unit 223, configured to obtain the local routing information of the target instance in the local environment, analyze the logs when the target microservice has an exception, and estimate the type of exception that the target microservice has; generate identification information for instructing the conversion of the target microservice from an instance in the joint debugging environment to the target instance in the local environment based on the local routing information; add the identification information to the request header of a preset joint debugging request corresponding to the estimated exception type to form a target joint debugging request for debugging the target microservice.

[0137] In some embodiments of the present application, as Figure 4 shown, the microservice debugging device may further include:

[0138] A replacement module 29, configured to, after the debugging module 24 debugs the target microservice in the local environment based on the logs generated by processing the routed target joint debugging request by the target instance, if the target microservice is successfully debugged, deploy an instance corresponding to the successfully debugged target microservice in the joint debugging environment, and use the deployed instance to replace the original instance of the target microservice in the joint debugging environment.

[0139] In some embodiments of the present application, as Figure 4 shown, the microservice debugging device may further include:

[0140] An acquisition module 30, configured to acquire at least one debugging solution for the target microservice, where the debugging solution includes a local environment identifier and target exception information, and different debugging solutions include different local environment identifiers; respectively determine the local environment corresponding to the local environment identifier included in each debugging solution as the local environment for deploying the target instance corresponding to the target microservice, and trigger the deployment module 21 to execute the step of deploying the target instance corresponding to the target microservice in the local environment;

[0141] Then, the generation module 22 may further be configured to respectively execute for each of the debugging solutions: generate identification information for instructing the conversion of the target microservice from an instance in the joint debugging environment to the target instance in the local environment corresponding to the local environment identifier based on the local environment identifier included in the debugging solution, generate a target joint debugging request for debugging the target microservice based on the identification information and the target exception information included in the debugging solution, and the generated target joint debugging request is used to debug the exception indicated by the target exception information.

[0142] In the microservice debugging device provided in the embodiments of the present application, the detailed explanations adopted during the operation of each functional module can refer to the corresponding detailed explanations in the above-mentioned embodiments of the microservice debugging method, which will not be elaborated here.

[0143] Further, an embodiment of the present application also provides a computer-readable storage medium, where the storage medium includes a stored program, and when the program runs, it controls the device where the storage medium is located to execute the above-mentioned microservice debugging method.

[0144] Further, an embodiment of the present application also provides an electronic device, where the electronic device includes: a memory for storing a program; a processor coupled to the memory for running the program to execute the above-mentioned microservice debugging method.

[0145] In the above embodiments, the descriptions of the respective embodiments have their own focuses. For parts not detailed in a certain embodiment, reference may be made to the relevant descriptions of other embodiments.

[0146] It can be understood that the relevant features in the above methods and devices can be referred to each other. Additionally, the "first", "second", etc. in the above embodiments are used to distinguish the respective embodiments, and do not represent the superiority or inferiority of the respective embodiments.

[0147] Those skilled in the art can clearly understand that for the convenience and brevity of description, the specific working processes of the systems, devices, and units described above can refer to the corresponding processes in the foregoing method embodiments, and will not be elaborated herein again.

[0148] The algorithms and displays provided herein are not inherently related to any particular computer, virtual system, or other device. Various general-purpose systems can also be used in conjunction with the teachings herein. The structure required to construct such systems is obvious from the above description. In addition, the present application is not directed to any specific programming language. It should be understood that the content of the present application described herein can be implemented using various programming languages, and the description of the specific language above is for disclosing the preferred embodiments of the present application.

[0149] In addition, the memory may include non-permanent memory in a computer-readable medium, forms such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one storage chip.

[0150] Those skilled in the art should understand that the embodiments of the present application can be provided as methods, systems, or computer program products. Therefore, the present application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0151] This application is described with reference to the flowcharts and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the present application. It should be understood that each flow and / or block in the flowchart and / or block diagram can be implemented by computer program instructions, and the combination of the flows and / or blocks in the flowchart and / or block diagram can also be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing devices generate means for implementing the functions specified in one Figure 1 flow or multiple flows and / or blocks Figure 1 or multiple blocks.

[0152] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory generate a manufactured article including instruction means, and the instruction means implement the functions specified in one Figure 1 flow or multiple flows and / or blocks Figure 1 or multiple blocks.

[0153] These computer program instructions can also be loaded onto a computer or other programmable data processing device, so that a series of operation steps are executed on the computer or other programmable device to generate a computer-implemented process, and thus the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one Figure 1 flow or multiple flows and / or blocks Figure 1 or multiple blocks.

[0154] In a typical configuration, a computing device includes one or more processors (CPUs), an input / output interface, a network interface, and a memory.

[0155] The memory may include non-permanent memory in the form of computer-readable media, random access memory (RAM), and / or non-volatile memory, such as read-only memory (ROM) or flash memory (flash RAM). The memory is an example of computer-readable media.

[0156] A computer-readable medium includes both permanent and non-permanent, removable and non-removable media and can implement information storage by any method or technology. The information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassette tapes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transitory medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer-readable medium does not include transitory computer-readable media, such as modulated data signals and carrier waves.

[0157] It should also be noted that the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, such that a process, method, article or device comprising a series of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "comprising an..." does not exclude the presence of additional identical elements in the process, method, article or device comprising the element.

[0158] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, system, or computer program product. Therefore, the present application can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk memory, CD-ROM, optical memory, etc.) containing computer-usable program code.

[0159] The above are only the embodiments of the present application and are not used to limit the present application. For those skilled in the art, the present application can have various changes and modifications. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included within the scope of the claims of the present application.

Claims

1. A microservice debugging method, characterized in that: The method comprises: Determine the target microservice that has an abnormality during the microservice joint debugging process in the joint debugging environment, and deploy the target instance corresponding to the target microservice in the local environment; Generate a target joint debugging request for debugging the target microservice, wherein the target joint debugging request includes identification information for indicating that the target microservice is converted from an instance in the joint debugging environment to a target instance in the local environment, and the target joint debugging request is used to indicate that an instance of a microservice that is one position above the target microservice in the joint debugging order routes the target joint debugging request to the target instance of the target microservice in the local environment based on the identification information; Perform joint debugging on each microservice involved in the microservice joint debugging process based on the target joint debugging request; Based on the log generated by the target joint debugging request routed by the target instance processing, the target microservice is debugged in the local environment.

2. The method according to claim 1, characterized in that Based on the log generated by the target joint debugging request routed by the target instance processing, the target microservice is debugged in the local environment, including: If it is detected that the target instance processes the target joint debugging request routed from the target instance and generates target data, a target abnormality occurring in the target microservice is determined based on the target data, and the target data is used to indicate the abnormality of the target microservice; The target microservice is debugged in the local environment using a debugging operation corresponding to the target exception and used to eliminate the exception.

3. The method according to claim 1, characterized in that: Deploying a target instance corresponding to the target microservice in the local environment includes: obtaining a code used to deploy an instance of the target microservice in the joint debugging environment; and deploying a target instance corresponding to the target microservice in the local environment based on the code; or, Deploying a target instance corresponding to the target microservice in a local environment includes: obtaining an update code corresponding to the target microservice, the update code including a code used to deploy an instance of the target microservice in the joint debugging environment and a new code developed based on the code; and deploying the target instance corresponding to the target microservice in the local environment based on the update code.

4. The method according to claim 1, characterized in that The joint debugging environment and the local environment share the same registration center, and the registration center is used to record the joint debugging order of each microservice involved in the joint debugging, the routing information of the corresponding instance of each microservice in the joint debugging environment, and the routing information of the corresponding target instance of the target microservice in the local environment. Then, the method further includes: Set up a corresponding load balancing mechanism for each microservice involved in the joint debugging, so that each microservice instance can route the joint debugging request to the next microservice instance in the joint debugging sequence based on the load balancing mechanism; The load balancing mechanism is used to route the joint debugging request to the next microservice instance in the joint debugging environment based on the joint debugging sequence and routing information recorded by the registration center when the joint debugging request routed to the instance of the microservice does not include identification information; The load balancing mechanism is also used for: if the joint debugging request routed to the instance of the microservice includes identification information, then based on the joint debugging order recorded by the registration center, when it is determined that the next microservice is the target microservice indicated by the identification information, the joint debugging request is routed to the instance of the target microservice in the local environment based on the routing information recorded by the registration center; and, when it is determined that the next microservice is not the target microservice, the joint debugging request is routed to the instance of the next microservice in the joint debugging environment based on the routing information recorded by the registration center.

5. The method according to any one of claims 1 to 4, characterized in that The method further includes: in the microservice joint debugging process, each time a joint debugging request is routed to an instance of a microservice in a joint debugging environment, a log generated by the instance of the microservice processing the joint debugging request is obtained from the joint debugging environment, and if the obtained log contains prompt data indicating that an abnormality has occurred in the microservice, the microservice is determined as a target microservice that has occurred an abnormality in the microservice joint debugging process; and / or, If a microservice debugging instruction is received, the microservice indicated by the microservice debugging instruction is determined as the target microservice that has an exception during the microservice joint debugging process. The microservice debugging instruction is used to indicate the microservice that needs to be debugged in the local environment among the microservices participating in the microservice joint debugging.

6. The method according to claim 5, characterized in that The method further comprises: If the target microservice has an adjacent previous microservice in the joint debugging sequence, the previous microservice is added as the target microservice that has an abnormality during the microservice joint debugging process.

7. The method according to any one of claims 1 to 4, characterized in that Generating a target joint debugging request for debugging the target microservice, including: obtaining local routing information of the target instance in the local environment, and a joint debugging request when an exception occurs in the target microservice; generating identification information for indicating that the target microservice is converted from an instance in the joint debugging environment to a target instance in the local environment based on the local routing information; adding the identification information to a request header of the joint debugging request to form a target joint debugging request for debugging the target microservice; and / or, Generate a target joint debugging request for debugging the target microservice, including: obtaining local routing information of the target instance in the local environment, and capturing joint debugging request parameters when the target microservice is abnormal; simulating the joint debugging request when the target microservice is abnormal based on the request parameters by a request generator; generating identification information for indicating that the target microservice is converted from an instance in the joint debugging environment to a target instance in the local environment based on the local routing information; adding the identification information to the request header of the joint debugging request to form a target joint debugging request for debugging the target microservice; and / or, Generate a target joint debugging request for debugging the target microservice, including: obtaining local routing information of the target instance in the local environment, analyzing the log when the target microservice is abnormal, and estimating the abnormal type of the target microservice; generating identification information for indicating that the target microservice is converted from an instance in the joint debugging environment to a target instance in the local environment based on the local routing information; adding the identification information to a request header of a preset joint debugging request corresponding to the estimated abnormal type, to form a target joint debugging request for debugging the target microservice; and / or, After debugging the target microservice in the local environment based on the log generated by the target joint debugging request routed by the target instance processing, the method further includes: if the target microservice is successfully debugged, deploying an instance corresponding to the successfully debugged target microservice in the joint debugging environment, and replacing the original instance of the target microservice in the joint debugging environment with the deployed instance; and / or, The method further includes: obtaining at least one debugging scheme for the target microservice, the debugging scheme including a local environment identifier and target exception information, and different debugging schemes include different local environment identifiers; determining the local environment corresponding to the local environment identifier included in each debugging scheme as the local environment for deploying the target instance corresponding to the target microservice, and executing the step of deploying the target instance corresponding to the target microservice in the local environment; Then, a target joint debugging request for debugging the target microservice is generated, including: For each of the debugging schemes, respectively, the following are performed: based on the local environment identifier included in the debugging scheme, generating identification information for indicating that the target microservice is converted from an instance in the joint debugging environment to a target instance in the local environment corresponding to the local environment identifier; based on the identification information and the target exception information included in the debugging scheme, generating a target joint debugging request for debugging the target microservice, and the generated target joint debugging request is used to debug the exception indicated by the target exception information.

8. A microservice debugging device, characterized in that: The device comprises: A deployment module is used to determine a target microservice that has an abnormality during the microservice joint debugging process in the joint debugging environment, and deploy a target instance corresponding to the target microservice in the local environment; A generation module, used to generate a target joint debugging request for debugging the target microservice, wherein the target joint debugging request includes identification information for indicating that the target microservice is converted from an instance in the joint debugging environment to a target instance in the local environment, and the target joint debugging request is used to indicate that an instance of a microservice that is one position above the target microservice in the joint debugging sequence routes the target joint debugging request to a target instance of the target microservice in the local environment based on the identification information; A joint debugging module, used for performing joint debugging on each microservice participating in the microservice joint debugging process based on the target joint debugging request; The debugging module is used to debug the target microservice in the local environment based on the log generated by the target joint debugging request routed by the target instance processing.

9. A computer-readable storage medium, characterized in that: The storage medium includes a stored program, wherein when the program is running, the device where the storage medium is located is controlled to execute the microservice debugging method described in any one of claims 1 to claim 7.

10. An electronic device, characterized in that: The electronic device comprises: Memory, used to store programs; A processor, coupled to the memory, is used to run the program to execute the microservice debugging method described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Development and debugging method and device for micro-service application

    CN114385504A

  • Local service debugging method and system in process of developing micro-service architecture system

    CN115344408A

  • Micro-service full-link tracking method, device and system and medium

    CN115629940A

  • Local service debugging method and system based on micro-service architecture and containerization

    CN116800761A

  • Local joint debugging method, system and development platform

    CN119396685A