A method for service request in-link anomaly monitoring and anomaly tracking

By combining the Hystrix semaphore pattern with the Javassist bytecode instrumentation service, the problem of rapid location and handling of link anomalies in microservice architecture is solved, improving the efficiency and speed of anomaly investigation.

CN116366487BActive Publication Date: 2026-05-08SHANGHAI ZHONGTONGJI NETWORK TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SHANGHAI ZHONGTONGJI NETWORK TECH CO LTD
Filing Date
2023-03-06
Publication Date
2026-05-08

AI Technical Summary

Technical Problem

In a microservices architecture, existing technologies cannot quickly locate and handle link anomalies, resulting in low efficiency in anomaly troubleshooting.

Method used

Hystrix semaphore pattern service is used to obtain microservice information and associate it with request ID. Combined with Javassist bytecode instrumentation service, link data monitoring and anomaly tracking are performed. Trace ID is used for unique identification to achieve rapid location of link anomalies and information push.

Benefits of technology

It enables rapid location and handling of microservice anomalies, improves the efficiency of anomaly investigation, and speeds up anomaly handling through accurate anomaly information.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116366487B_ABST
    Figure CN116366487B_ABST
Patent Text Reader

Abstract

The application relates to a method for monitoring and tracking link exceptions in a service request, belonging to the technical field of service exception monitoring, which comprises the following steps: a request for a service is associated with calling at least one microservice, and a request ID is generated; link data is associated with the request ID by using a hystrix semaphore mode service, and the microservice recorded in the link data is monitored; javassist bytecode splicing service is used to perform bytecode splicing processing on each microservice; when an exception of the microservice is monitored, link exception tracking is performed through the javassist bytecode splicing service, and exception information is obtained; the hystrix semaphore mode service and the javassist bytecode splicing service are combined to realize link exception monitoring and link exception tracking, the efficiency of technicians in locating exceptions is improved, and the speed of processing abnormal microservices is accelerated.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of service anomaly monitoring technology, specifically relating to a method for link anomaly monitoring and anomaly tracking in service requests. Background Technology

[0002] Currently, in a microservices architecture, a request often goes through multiple services, from service A to service B, then to service C, and then to other services before it can be completed. If one service fails in the entire service call chain, the entire chain will fail. When troubleshooting, technicians need to check each service one by one, from A to C and then to other services. The efficiency of troubleshooting is extremely low.

[0003] In existing technologies for this scenario, the Spring Cloud component library provides the Sleuth component. This component can clearly view the service interfaces and call chain involved in the entire request process through the traceid, which can provide a clear understanding of the entire call process. However, it still cannot perform anomaly monitoring and anomaly tracing for microservices in the chain, which makes it impossible for technical personnel to quickly locate abnormal microservices and handle anomalies quickly. Summary of the Invention

[0004] To address this, the present invention provides a method and system for calculating large-scale explosion damage information, thereby solving the problems in the prior art where technicians cannot quickly locate abnormal microservices and cannot quickly process anomalies.

[0005] To achieve the above objectives, the present invention adopts the following technical solution:

[0006] In a first aspect, the present invention provides a method for monitoring and tracking link anomalies in service requests, comprising:

[0007] Requesting a service will involve calling at least one microservice and generating a request ID.

[0008] The Hystrix semaphore mode service is used to obtain all microservice information involved in the request and save it as link data. The link data is associated with the request ID, and the microservices recorded in the link data are monitored.

[0009] By using the Javassist bytecode instrumentation service, bytecode instrumentation is performed on each microservice during the associated microservice call process;

[0010] When an anomaly is detected in the microservice recorded in the link data, the javassist bytecode instrumentation service is used to trace the link anomaly and obtain the anomaly information.

[0011] Collect abnormal information and push it to relevant technical personnel in real time.

[0012] Furthermore, the Hystrix semaphore pattern service is used to obtain all microservice information involved in the request and save it as link data. This link data is then associated with the request ID, and the microservices recorded in the link data are monitored, including:

[0013] Retrieve all microservice information involved in the request;

[0014] Microservice information is stored as trace data, and the trace data packet contains a traceid, which is a unique identifier for the trace data.

[0015] The Hystrix semaphore mode service is used to associate the link data with the request ID via the traceid;

[0016] The microservices recorded in the link data are monitored using semaphores in the Hystrix semaphore mode service.

[0017] Furthermore, the use of the Javassist bytecode instrumentation service to perform bytecode instrumentation on each microservice during the associated microservice call process includes:

[0018] Obtain microservice information from the link data;

[0019] Extract the number of microservices and their call paths from the microservice information;

[0020] The microservices are called one by one through the call path, and the javassist bytecode instrumentation service is used to perform bytecode instrumentation on the call parameters and return data during the microservice call process.

[0021] Furthermore, when an anomaly is detected in the microservice recorded in the monitoring link data, the link anomaly is traced using the Javassist bytecode instrumentation service, and anomaly information is obtained, including:

[0022] Hystrix semaphore mode service detects anomalies in microservices through semaphores and records the location of the anomaly;

[0023] The Hystrix semaphore mode service sends the abnormal location to the Javassist bytecode instrumentation service;

[0024] Based on the location of the exception, the Javassist bytecode instrumentation service obtains exception information by pre-inserting the bytecode of the microservice.

[0025] Furthermore, by combining the abnormal location, the Javassist bytecode instrumentation service obtains abnormal information through pre-instrumentation of the microservice's bytecode, including:

[0026] Based on the location of the anomaly, the Javassist bytecode instrumentation service traced the abnormal microservice to its location.

[0027] The Javassist bytecode instrumentation service parses out the exception information in the microservice where the exception occurred. The exception information includes the call parameters, return data and exception description when calling the microservice.

[0028] Furthermore, it also includes:

[0029] When collecting anomaly information, a queue is used to store the anomaly information on a local server, and / or...

[0030] When collecting anomaly information, a queue method is used to store the anomaly information on a cloud server.

[0031] In a second aspect, the present invention provides an electronic device, comprising:

[0032] At least one processor; and

[0033] A memory communicatively connected to the at least one processor; wherein,

[0034] The memory stores instructions that can be executed by the at least one processor, which enables the at least one processor to perform the method for link anomaly monitoring and anomaly tracing in the service request described in any of the above statements.

[0035] The present invention, by adopting the above technical solution, has at least the following beneficial effects:

[0036] By associating requests with trace data through the Hystrix semaphore mode service, the microservices recorded in the trace data can be monitored. Combined with the Javassist bytecode instrumentation service, trace anomaly tracing can be achieved. When an anomaly occurs, it can quickly locate the anomaly and provide accurate anomaly information. Relevant technical personnel are alerted through messages, which can improve the efficiency of technical personnel in locating anomalies. The accurate anomaly information can also speed up the processing of abnormal microservices.

[0037] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit the invention. Attached Figure Description

[0038] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0039] Figure 1 This is a flowchart illustrating a method for monitoring and tracking link anomalies in service requests, as shown in an exemplary embodiment of the present invention.

[0040] The present invention will be further described below with reference to the accompanying drawings and specific embodiments. Detailed Implementation

[0041] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be described in detail below. Obviously, the described embodiments are merely some embodiments of this invention, and not all embodiments. Based on the embodiments of this invention, all other implementation methods obtained by those skilled in the art without creative effort are within the scope of protection of this invention.

[0042] With existing technology, when a service is requested and invoked, if one service in the entire service call chain fails, the entire chain will fail. When troubleshooting, technicians need to check each service one by one, from A to C and then to other services. The efficiency of locating and handling exceptions is extremely low.

[0043] In this embodiment of the invention, requests are associated with link data through the Hystrix semaphore mode service, and the microservices recorded in the link data are monitored. Combined with the Javassist bytecode instrumentation service, link anomaly tracing can be achieved. When an anomaly occurs, it can quickly locate the anomaly and provide accurate anomaly information. Relevant technical personnel are alerted through messages, which can improve the efficiency of technical personnel in locating anomalies. The accurate anomaly information can also speed up the processing of abnormal microservices.

[0044] The method for real-time message push in this invention will be described below through specific embodiments.

[0045] Please see Figure 1 , Figure 1 This is a flowchart illustrating a method for monitoring and tracing link anomalies in service requests, as shown in an exemplary embodiment of the present invention. (See attached diagram.) Figure 1 The method includes:

[0046] Step S11: Requesting a service will involve calling at least one microservice and generating a request ID.

[0047] Step S12: Use the Hystrix semaphore mode service to obtain all microservice information involved in the request and save it as link data. Associate the link data with the request ID and monitor the microservices recorded in the link data.

[0048] Step S13: Utilize the Javassist bytecode instrumentation service to perform bytecode instrumentation on each microservice during the associated microservice call process;

[0049] Step S14: When an anomaly is detected in the microservice recorded in the link data, the link anomaly is traced through the javassist bytecode instrumentation service, and the anomaly information is obtained.

[0050] Step S15: Collect abnormal information and push it to relevant technical personnel in real time.

[0051] It should be noted that the technical solution provided in this embodiment can be used in conjunction with existing projects as a component or plugin in practice. Applicable scenarios include, but are not limited to, sending message alerts to relevant technical personnel when a request encounters an error.

[0052] In practice, the microservices involved in the request can have their complete call chain clearly recorded through the Javassist bytecode instrumentation service combined with the Hystrix semaphore pattern service, and real-time alerts can be provided for any exceptions.

[0053] It is understood that the technical solution provided in this embodiment associates requests with link data through the Hystrix semaphore mode service, monitors the microservices recorded in the link data, and combines it with the Javassist bytecode instrumentation service to realize link anomaly tracking. When an anomaly occurs, it can quickly locate the anomaly and provide accurate anomaly information. It can also remind relevant technical personnel through messages, which can improve the efficiency of technical personnel in locating anomalies. The accurate anomaly information can also speed up the processing of abnormal microservices.

[0054] In practice, step S11, "requesting a service will involve calling at least one microservice and generating a request ID," means that the process is as follows:

[0055] It should be noted that in a microservice cluster, requesting a service will be associated with multiple microservices, that is, multiple microservices will provide support for the request. When the request starts, a request ID will be generated. The request ID is a unique identifier for this request. The requested service will also contain association information of multiple microservices.

[0056] In practice, step S12, "using the Hystrix semaphore mode service to obtain all microservice information involved in the request and save it as link data, associating the link data with the request ID, and simultaneously monitoring the microservices recorded in the link data," specifically means:

[0057] Retrieve all microservice information involved in the request;

[0058] Microservice information is stored as trace data, and the trace data packet contains a traceid, which is a unique identifier for the trace data.

[0059] The Hystrix semaphore mode service is used to associate the link data with the request ID via the traceid;

[0060] The microservices recorded in the link data are monitored using semaphores in the Hystrix semaphore mode service.

[0061] It is understood that the technical solution provided in this embodiment uniquely identifies the link data through traceid, which is a string data. This data is very universal and convenient to transmit, and the traceid is associated with the request ID to ensure the uniqueness of the link data in each request, which is convenient for later retrieval. By associating the request with the link data through the Hystrix semaphore mode service, the microservices recorded in the link data can be monitored.

[0062] In practice, step S13, "using the Javassist bytecode instrumentation service to perform bytecode instrumentation on each microservice during the associated microservice call process," specifically means:

[0063] Obtain microservice information from the link data;

[0064] Extract the number of microservices and their call paths from the microservice information;

[0065] The microservices are called one by one through the call path, and the javassist bytecode instrumentation service is used to perform bytecode instrumentation on the call parameters and return data during the microservice call process.

[0066] It should be noted that the Javassist bytecode instrumentation service performs bytecode instrumentation on each microservice recorded in the link data during invocation. It can not only instrument the invocation parameters and return data of microservices, but also perform bytecode instrumentation on important data according to business needs, so as to achieve the purpose of anomaly tracking of important data that has been instrumented by bytecode.

[0067] Understandably, bytecode instrumentation through the Javassist bytecode instrumentation service can prepare for link anomaly tracing. Without modifying the project source code, you can select the data in the link that needs to be monitored for anomalies and instrument it according to business needs, thus flexibly completing the preparation work for link anomaly tracing.

[0068] In practice, step S14, "when an anomaly is detected in the microservice recorded in the link data, link anomaly tracing is performed through the Javassist bytecode instrumentation service, and anomaly information is obtained," specifically means:

[0069] Hystrix semaphore mode service detects anomalies in microservices through semaphores and records the location of the anomaly;

[0070] The Hystrix semaphore mode service sends the abnormal location to the Javassist bytecode instrumentation service;

[0071] Based on the location of the exception, the Javassist bytecode instrumentation service obtains exception information by pre-inserting the bytecode of the microservice.

[0072] It should be noted that, through the aforementioned abnormal location, the Javassist bytecode instrumentation service traces the abnormal microservice; the Javassist bytecode instrumentation service parses the abnormal information in the abnormal microservice, which includes the call parameters, return data, and abnormal description when calling the microservice.

[0073] It is understood that in this embodiment, the Javassist bytecode instrumentation service can be used to achieve link anomaly tracing. When an anomaly occurs, it can quickly locate the anomaly and provide accurate anomaly information. It can also alert relevant technical personnel through messages, thereby improving the speed of anomaly handling.

[0074] In practice, step S15, "collecting abnormal information and pushing it to relevant technical personnel in real time," specifically means:

[0075] Count the number of microservice anomalies recorded in the link data, and the paths without anomalies;

[0076] Collect statistics on the call parameters, return data, and exception description for each abnormal microservice;

[0077] The above statistical data will be pushed to relevant technical personnel in real time.

[0078] It should be noted that when business needs require it, a queue service can be added to store the link anomaly information one by one in an orderly manner on the local server, or on a dedicated cloud server.

[0079] It is understandable that the technical solution provided in this embodiment pushes the abnormal path, call parameters, return data and abnormal description of the abnormal microservice to the relevant technical personnel in real time and stores them. This not only enables the relevant technical personnel to understand the project situation as soon as possible, but also makes it convenient for the relevant technical personnel to conduct statistical investigations later.

[0080] In one embodiment, an electronic device is provided, comprising:

[0081] At least one processor; and

[0082] A memory communicatively connected to the at least one processor; wherein,

[0083] The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform a method for link anomaly monitoring and anomaly tracing in the service request.

[0084] In the description of this specification, references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.

[0085] Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention. Those skilled in the art can make changes, modifications, substitutions and variations to the above embodiments within the scope of the present invention.

Claims

1. A method for detecting and tracking link anomalies in service requests, characterized in that, The method includes: Requesting a service will involve calling at least one microservice and generating a request ID. The Hystrix semaphore mode service is used to obtain all microservice information involved in the request and save it as link data. The link data is associated with the request ID, and the microservices recorded in the link data are monitored. By using the Javassist bytecode instrumentation service, bytecode instrumentation is performed on each microservice during the associated microservice call process; When an anomaly is detected in the microservice recorded in the link data, the javassist bytecode instrumentation service is used to trace the link anomaly and obtain the anomaly information. Collect abnormal information and push it to relevant technical personnel in real time; When an anomaly is detected in the microservice recorded in the monitoring link data, the Javassist bytecode instrumentation service is used to trace the link anomaly and obtain anomaly information, including: the Hystrix semaphore mode service detects the anomaly in the microservice through semaphores and records the anomaly location; the Hystrix semaphore mode service sends the anomaly location to the Javassist bytecode instrumentation service; and the Javassist bytecode instrumentation service obtains the anomaly information by pre-inserting the bytecode of the microservice based on the anomaly location. The Javassist bytecode instrumentation service obtains exception information by pre-inserting the bytecode of the microservices, based on the exception location. This includes: tracing the exception to the microservice that experienced the exception through the exception location; and parsing the exception information from the microservice that experienced the exception, which includes the call parameters, return data, and exception description when the microservice was called.

2. The method according to claim 1, characterized in that, The process of using Hystrix semaphore mode to obtain all microservice information involved in the request and saving it as link data, associating the link data with the request ID, and monitoring the microservices recorded in the link data includes: Retrieve all microservice information involved in the request; Microservice information is stored as trace data, and the trace data packet contains a traceid, which is a unique identifier for the trace data. The Hystrix semaphore mode service is used to associate the link data with the request ID via the traceid; The microservices recorded in the link data are monitored using semaphores in the Hystrix semaphore mode service.

3. The method according to claim 2, characterized in that, The process of using Javassist bytecode instrumentation service to perform bytecode instrumentation on each microservice during associated microservice calls includes: Obtain microservice information from the link data; Extract the number of microservices and their call paths from the microservice information; The microservices are called one by one through the call path, and the javassist bytecode instrumentation service is used to perform bytecode instrumentation on the call parameters and return data during the microservice call process.

4. The method according to claim 1, characterized in that, Also includes: When collecting anomaly information, a queue is used to store the anomaly information on a local server, and / or... When collecting anomaly information, a queue method is used to store the anomaly information on a cloud server.

5. An electronic device, comprising: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-4.

Citation Information

Patent Citations

  • Micro-service link tracking and performance analysis method, system, equipment and application

    CN113946499A

  • Link tracking and abnormity diagnosis method based on Web request

    CN115529227A