Distributed system monitoring device, method, equipment and medium

By introducing monitoring devices and methods of web page end, first system, second system, decorator and monitoring server end in distributed systems, the problems of low abnormal positioning efficiency and accuracy in distributed systems are solved, and more efficient logging is achieved Collect and merge to avoid omission of key information.

CN119473676APending Publication Date: 2025-02-18CHINA PING AN LIFE INSURANCE CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411522365.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-28
Publication Date
2025-02-18

AI Technical Summary

Technical Problem

In distributed systems, it is difficult to observe the full picture of the stack information of a single service during operation through breakpoints, resulting in low abnormal positioning efficiency and accuracy and high communication costs.

Method used

A distributed system monitoring device and method are proposed, which sends a trigger signal to the first system through the web page end. The first system performs the first function and the second system performs the second function. The decorator obtains stack information and abnormal keys in abnormal situations. Field, the monitoring server obtains the target payload based on the tracking identifier.

Benefits of technology

It improves the exception positioning efficiency and accuracy of distributed systems, makes up for the log collection and merging performance problems, and avoids the problem of missing out on key abnormal information.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119473676A_ABST
    Figure CN119473676A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a distributed system monitoring device and method, equipment and a medium. A trigger signal including the tracking identifier is sent to the first system through the webpage end, and the first system executes a first function according to the trigger signal; the second system executes a second function, and the first function depends on the second function; the decorator obtains a first payload and a tracking identifier from the first system and the second system when detecting that the first function or the second function is abnormal, and the first payload comprises stack information and an abnormal key field; the monitoring server obtains a target payload from the first payload according to the tracking identifier; according to the method, the performance problem of log collection and log combination of the distributed system can be solved, the problem of missing abnormal key information during log processing is avoided, and the abnormal positioning efficiency and precision of the distributed system are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data monitoring technology, and in particular to a distributed system monitoring device, method, equipment and medium. Background Art

[0002] For business software systems that use distributed systems, it is difficult to observe the full picture of the stack information of a single service during operation through breakpoints, which leads to the use of distributed log merging to locate problems during the joint debugging of related parties. This places high demands on the distributed collection, merging capabilities and performance of the log system and the completeness of the logs of related parties. At the same time, it will generate high communication costs, which brings inconvenience to the abnormal location of distributed systems. Summary of the invention

[0003] The main purpose of the embodiments of the present application is to propose a distributed system monitoring device, method, equipment and medium, which can improve the efficiency and accuracy of abnormal location in the distributed system.

[0004] To achieve the above-mentioned purpose, an embodiment of a first aspect of the embodiments of the present application proposes a distributed system monitoring device, including:

[0005] Web page;

[0006] a first system, the web page sends a trigger signal to the first system, the first system performs a first function according to the trigger signal, the trigger signal includes a tracking identifier;

[0007] a second system, the second system performing a second function, the first function being dependent on the second function;

[0008] A decorator, the decorator being used to obtain a first payload and the trace identifier from the first system and the second system when an exception is detected in the first function or the second function, the first payload including stack information and an exception key field;

[0009] A monitoring server is configured to obtain a target payload from the first payload according to the tracking identifier.

[0010] According to certain embodiments of the first aspect of the embodiments of the present application, the distributed system monitoring device also includes a number generator, which is used to send a tracking identifier to the web page.

[0011] According to certain embodiments of the first aspect of the embodiments of the present application, the monitoring server is used to sort the target payload according to the acquisition time to obtain a payload sorting result.

[0012] According to certain embodiments of the first aspect of the embodiments of the present application, the decorator is added in the form of a function to the function corresponding to the first function and the function corresponding to the second function.

[0013] According to certain embodiments of the first aspect of the embodiments of the present application, the decorator is used to obtain a second payload and the tracing identifier from the first system and the second system when it is detected that the first function and the second function are normal, the second payload including stack information, input parameters and output parameters of the first function, and input parameters and output parameters of the second function.

[0014] According to certain embodiments of the first aspect of the embodiments of the present application, the second system performs the second function according to a trigger signal forwarded by the first system.

[0015] According to certain embodiments of the first aspect of the embodiments of the present application, the first function is one of the functions of the first service of the first system, and the second function is one of the functions of the second service of the second system.

[0016] To achieve the above-mentioned purpose, an embodiment of the second aspect of the embodiments of the present application proposes a distributed system monitoring method, which is applied to the distributed system monitoring device as described in the embodiment of the first aspect of the embodiments of the present application, and the method includes:

[0017] In case of detecting an abnormality in a first function executed by a first system or a second function executed by a second system, obtaining a first payload and a trace identifier from the first system and the second system, the first payload including stack information and an abnormality key field;

[0018] obtaining a target payload from the first payload according to the tracking identifier;

[0019] Among them, the first function is executed by the first system according to the trigger signal sent by the web page, and the first function depends on the second function.

[0020] To achieve the above-mentioned purpose, an embodiment of the third aspect of the embodiments of the present application proposes an electronic device, which includes a memory and a processor, and the memory stores a computer program. When the processor executes the computer program, it implements the distributed system monitoring method described in the embodiment of the second aspect of the embodiments of the present application.

[0021] To achieve the above-mentioned purpose, an embodiment of the fourth aspect of the embodiments of the present application proposes a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the distributed system monitoring method described in the embodiment of the second aspect of the embodiments of the present application.

[0022] The distributed system monitoring device, method, equipment and medium proposed in the present application send a trigger signal including a tracking identifier to the first system through a web page, and the first system executes the first function according to the trigger signal; the second system executes the second function, and the first function depends on the second function; when the decorator detects an abnormality in the first function or the second function, it obtains a first payload and a tracking identifier from the first system and the second system, and the first payload includes stack information and abnormal key fields; the monitoring server obtains the target payload from the first payload according to the tracking identifier; it can make up for the performance problems of the distributed system in collecting and merging logs, avoid the problem of missing abnormal key information when processing logs, and improve the abnormality location efficiency and accuracy of the distributed system. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] Figure 1 is a step diagram of a distributed system monitoring method provided by an embodiment of the present application;

[0024] Figure 2 is a step diagram of step S100 provided in an embodiment of the present application;

[0025] Figure 3 is a step diagram of step S300 provided in an embodiment of the present application;

[0026] Figure 4 is a step diagram of step S400 provided in an embodiment of the present application;

[0027] Figure 5 is a schematic diagram of a distributed system monitoring device provided in an embodiment of the present application;

[0028] Figure 6 It is a structural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0029] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0030] It should be noted that, although the functional modules are divided in the device schematic diagram and the logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than the module division in the device or the order in the flowchart. The terms "first", "second", etc. in the specification, claims and the above drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.

[0031] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.

[0032] For business software systems that use distributed systems, it is difficult to observe the full picture of the stack information of a single service during operation through breakpoints, which leads to the use of distributed log merging to locate problems during the joint debugging of related parties. This places high demands on the distributed collection, merging capabilities and performance of the log system and the completeness of the logs of related parties. At the same time, it will generate high communication costs, which brings inconvenience to the abnormal location of distributed systems.

[0033] In order to solve the above problems, the embodiments of the present application provide a distributed system monitoring device, method, equipment and medium, which can improve the efficiency and accuracy of abnormal location in the distributed system.

[0034] The embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Among them, artificial intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.

[0035] AI basic technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics, etc. AI software technologies mainly include computer vision technology, robotics technology, biometrics technology, speech processing technology, natural language processing technology, and machine learning / deep learning.

[0036] The distributed system monitoring device, method, equipment and medium provided in the embodiments of the present application relate to the field of artificial intelligence technology. The distributed system monitoring method provided in the embodiments of the present application can be applied to a terminal, can be applied to a server side, or can be software running in a terminal or a server side. In some embodiments, the terminal can be a smart phone, a tablet computer, a laptop computer, a desktop computer, etc.; the server side can be configured as an independent physical server, or can be configured as a server cluster or a distributed system composed of multiple physical servers, and can also be configured as a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms; the software can be an application that implements a distributed system monitoring method, etc., but is not limited to the above forms.

[0037] The present application can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc. The present application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present application can also be practiced in distributed computing environments, in which tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.

[0038] It should be noted that in each specific implementation of the present application, when it comes to the need to perform relevant processing based on data related to user identity or characteristics such as user information, user behavior data, user historical data, and user location information, the user's permission or consent will be obtained first, and the collection, use, and processing of these data will comply with relevant regulations. In addition, when the embodiment of the present application needs to obtain the user's sensitive personal information, the user's separate permission or consent will be obtained through a pop-up window or jump to a confirmation page. After clearly obtaining the user's separate permission or consent, the necessary user-related data for the normal operation of the embodiment of the present application will be obtained.

[0039] The distributed system monitoring device, method, equipment and medium provided in the embodiments of the present application are specifically described through the following embodiments, and firstly, the distributed system monitoring device in the embodiments of the present application is described.

[0040] Reference Figure 5 The distributed system monitoring device includes a web page end 820, a first system 830, a second system 840, a decorator and a monitoring server end 860.

[0041] Among them, the web page end 820 sends a trigger signal to the first system 830, and the first system 830 executes the first function according to the trigger signal, and the trigger signal includes a tracking identifier; the second system 840 executes the second function, and the first function depends on the second function; the decorator is used to obtain the first payload and the tracking identifier from the first system 830 and the second system 840 when an abnormality is detected in the first function or the second function, and the first payload includes stack information and exception key fields; the monitoring server 860 is used to obtain the target payload from the first payload according to the tracking identifier.

[0042] The distributed system monitoring device also includes a number transmitter 810 , which is used to send a tracking identifier to a web page 820 .

[0043] Tracing identifiers are used to track transaction processing in distributed systems. They can help developers and operators understand system behavior and locate errors and performance bottlenecks. Tracing identifiers are globally unique identifiers that identify the call chain of a request. In a distributed system, a request may span multiple services or components. Tracing identifiers connect all related operations in these services or components in series to form a complete tracing chain. By collecting and aggregating these related call information, the call chain of the entire request can be constructed, thereby tracing the flow path of the request in the system.

[0044] Tracing identifiers are usually expressed in string form, and different standards or protocols can be used to define their format and transmission method. Common standards include OpenTracing and Zipkin. There are many ways to generate tracing identifiers, and the most common ones are to use a universally unique identifier (Universally Unique Identifier, UUID) or a random number generator such as a timestamp. In order to ensure the global uniqueness of the tracing identifier, some specific information can be added when generating it, such as the node name, timestamp, etc.

[0045] In the distributed system, a unique tracking identifier is generated by a global number generator 810. A request is initiated to the number generator 810 at each request. In other embodiments, the tracking identifier can be generated by a universal unique identifier, which is a 128-bit long number. The UUID is calculated based on data such as the current time, counter, and hardware identification (usually the MAC address of the wireless network card). In other embodiments, the tracking identifier is generated by combining the current timestamp and a random number. This method can ensure uniqueness in time sequence and has a certain degree of randomness. In other embodiments, the tracking identifier is generated by combining the machine ID, serial number and a timestamp.

[0046] The web page 820 triggers the first service of the first system 830 through the interface. The first function is one of the functions of the first service of the first system 830. The first service of the first system 830 will execute the first function during the transaction processing. The web page 820 sends a trigger signal to the first system 830. The first system 830 executes the first service according to the trigger signal and executes the first function during the transaction processing of the first service. The trigger signal includes a tracking identifier.

[0047] For example, the first system 830 is system A, the first service is SrvA, and the first function is FunA. The web page 820 triggers the service SrvA of system A through the interface. The web page 820 sends a trigger signal including a tracking identifier to system A, and system A executes the service SrvA according to the trigger signal, and executes FunA during the transaction processing of the service SrvA.

[0048] The first function of the first service of the first system 830 depends on the second function of the second service of the second system 840. Specifically, a certain processing logic of the first function depends on a certain processing logic of the second function. The first service of the first system 830 sends a tracking identifier to the second service of the second system 840. The second system 840 executes the second function according to the trigger signal forwarded by the first system 830.

[0049] For example, the second system 840 is system B, the first service is SrvB, and the first function is Fun B. System B executes service SrvB and executes FunB during the transaction processing of service SrvB.

[0050] For example, in an e-commerce platform, system A is the order system and system B is the inventory system. After a user places an order on the platform, the order system needs to process the order, while the inventory system is responsible for managing the inventory. During the order processing process, the order system needs to call the inventory system to ensure that the inventory is sufficient.

[0051] System A is responsible for processing user orders. It includes service logic SrvA, which includes the following steps: verify order information; calculate order price; check whether the inventory is sufficient; create an order; initiate payment process. Service logic SrvA is a core service in system A, which is responsible for processing the entire life cycle of an order. Among them, method FunA is checkInventory, which is responsible for checking whether the inventory is sufficient.

[0052] System B is responsible for managing the inventory of goods. It includes service logic SrvB, which includes the following steps: update inventory; query inventory. Service logic SrvB is a core service in system B, which is responsible for handling inventory-related operations. Among them, method FunB is queryInventory, which is responsible for querying the inventory quantity of a specific product.

[0053] The calling relationship between method FunA and method FunB is as follows: A user places an order on system A. System A's service logic SrvA starts processing the order. SrvA calls method FunA to check whether the inventory is sufficient. In the process of checking the inventory, method FunA needs to call system B's service logic SrvB. Method FunA calls method FunB through an interface to obtain the inventory quantity of a specific product. Method FunB queries and returns the inventory quantity from the database. Method FunA determines whether there is enough inventory to meet the order requirements based on the returned inventory quantity. If the inventory is sufficient, SrvA continues to execute the subsequent order creation and payment process; if the inventory is insufficient, an exception is thrown.

[0054] The decorator is added in the form of a function to the function corresponding to the first function and the function corresponding to the second function.

[0055] It is understandable that decorator functions allow new functions to be added without modifying the original function code. Decorators are often used in scenarios such as logging, performance testing, transaction processing, and permission verification. The return value of a decorator is also a function object. Decorator functions execute specific logic before and after method execution and when exceptions occur.

[0056] Define a decorator function. This function can receive a function as a parameter and return a new function that will wrap the original function and execute additional logic before and after the call. When deploying the first system 830 and the second system 840, add decorator functions to all business classes and methods of the first system 830 and the second system 840 through scripts. Use a try block to wrap the call of the function of the first service and the function of the second service. This allows catching exceptions that occur during the execution of the function.

[0057] When detecting that the first function and the second function are normal, the decorator obtains a second payload and a trace identifier from the first system 830 and the second system 840 , where the second payload includes stack information, input parameters and output parameters of the first function, and input parameters and output parameters of the second function.

[0058] Exemplarily, for the decorator function, when executing the first function of the first service, inside the try block, the function of the first function of the first service is called, the input parameters are recorded, the input parameters are passed to the function of the first function of the first service, and the output parameters returned by the function of the first function of the first service are recorded.

[0059] When the function of the first function of the first service is successfully executed and no exception is thrown, the decorator uses the traceback module to capture the current stack information. In addition, the current stack trace can be printed through the print_stack() function and the string representation of the stack information can be obtained through the format_stack() function.

[0060] Similarly, when executing the second function of the second service, inside the try block, call the function of the second function of the second service, record the input parameters, pass the input parameters to the function of the second function of the second service, and record the output parameters returned by the function of the second function of the second service.

[0061] When the function of the second function of the second service is successfully executed and no exception is thrown, the traceback module is used to capture the current stack information. In addition, the current stack trace can be printed through the print_stack() function and the string representation of the stack information can be obtained through the format_stack() function.

[0062] The stack information, the input parameters and output parameters of the first function, and the input parameters and output parameters of the second function are combined into a payload in a structured data format as a second payload. At the same time, a system timestamp and a tracking identifier are obtained. The second payload, the system timestamp and the tracking identifier are sent to the monitoring server 860.

[0063] When detecting an exception in the first function or the second function, the decorator obtains a first payload and a trace identifier from the first system 830 and the second system 840 , where the first payload includes stack information and an exception key field.

[0064] When an exception occurs in the function of the first function of the first service, the decorator uses the catch block to capture the exception signal of the first function of the first service, and also uses the traceback module to capture the stack information of the exception. In the catch block, the type, message and other related information of the exception are also recorded to obtain the exception key field. Similarly, the decorator uses the traceback module to capture the stack information of the first function of the first service. In addition, the stack trace of the first function of the first service can be printed through the print_stack() function and the string representation of the stack information of the first function of the first service can be obtained through the format_stack() function.

[0065] Even if no exception occurs in the function of the second function of the second service, since the first function depends on the second function, the decorator still needs to use the traceback module to capture the stack information of the second function of the second service, and can also print the stack trace of the second function of the second service through the print_stack() function and obtain the string representation of the stack information of the second function of the second service through the format_stack() function.

[0066] When an exception occurs in the function of the second function of the second service, the decorator uses the catch block to capture the exception signal of the second function of the second service, and also uses the traceback module to capture the stack information of the exception. In the catch block, the type, message and other related information of the exception are also recorded to obtain the exception key field. Similarly, the decorator uses the traceback module to capture the stack information of the second function of the second service. In addition, the stack trace of the second function of the second service can be printed through the print_stack() function and the string representation of the stack information of the second function of the second service can be obtained through the format_stack() function.

[0067] The stack information and the exception key field are combined into a payload in a structured data format as the first payload. At the same time, the acquisition time and the tracking identifier are determined. The first payload, the acquisition time and the tracking identifier are sent to the monitoring server 860.

[0068] The monitoring server 860 is connected to the observation web page 850, which is another web page 820 different from the input web page 820. The monitoring server 860 sorts the target payload according to the acquisition time to obtain a payload sorting result. For example, the target payload is sorted from early to late according to the acquisition time to obtain a payload sorting result, or the target payload is sorted from late to early according to the acquisition time to obtain a payload sorting result.

[0069] The monitoring server 860 sends the load sorting result to the observation web page 850 via WebSocket. The observation web page 850 renders the exception stack in a highlighted style for monitoring personnel to view.

[0070] The observation web page 850 initiates a WebSocket connection request to the monitoring server 860 through a browser. This can be done through the WebSocket object and using the new WebSocket (url) statement, where url is the address sent by the monitoring server 860.

[0071] After receiving the connection request, the monitoring server 860 performs a handshake according to the protocol. The handshake process includes the observation web page 850 and the monitoring server 860 exchanging protocol versions, the WebSocket version supported by the observation web page 850, and a Sec-WebSocket-Key for verifying the connection.

[0072] After the handshake is successful, the observation web page terminal 850 responds to the observation web page terminal 850, confirming that the connection has been established, and returns a Sec-WebSocket-Accept response header, which includes a hash value calculated based on the Sec-WebSocket-Key.

[0073] After the WebSocket connection is established, the monitoring server 860 and the observation web page 850 can transmit data through the WebSocket connection. During the data transmission process, the WebSocket protocol will handle the framing and reassembly of the data to ensure the integrity and order of the data.

[0074] When the observation web page 850 receives the load sorting result from the monitoring server 860, an onmessage event is triggered. The observation web page 850 can set an event listener on the WebSocket object to handle this event. Similarly, the monitoring server 860 also has a corresponding mechanism to process the received data.

[0075] In order to keep the connection active and detect whether the connection is still valid, the monitoring server 860 and the observation web page 850 can periodically send heartbeat messages. These messages are usually small data packets used to confirm that both ends of the connection are active.

[0076] If an error occurs during the connection process or the connection needs to be closed, the WebSocket protocol provides a close() method to close the connection. Before closing the connection, a close frame containing a status code and a closing reason is usually sent first so that the other party knows that the connection is about to be closed. Both the monitoring server 860 and the observation web page 850 can listen to the onclose event to handle the connection closing situation.

[0077] When deploying in the production environment later, remove the relevant script comments and you can monitor the offline distributed system.

[0078] The distributed system monitoring device can make up for the performance problems of the distributed system in collecting and merging logs, avoid the problem of missing abnormal key information when processing logs, and improve the abnormality locating efficiency and accuracy of the distributed system.

[0079] The embodiments of the present application provide a distributed system monitoring method, which is applied to the above distributed system monitoring device.

[0080] Reference Figure 1 , a distributed system monitoring method, comprising the following steps:

[0081] Step S210, when it is detected that the first function executed by the first system or the second function executed by the second system is abnormal, obtaining a first payload and a tracking identifier from the first system and the second system;

[0082] Step S220: Obtain a target payload from the first payload according to the tracking identifier.

[0083] Among them, the first payload includes stack information and exception key fields, the first function is executed by the first system 830 according to the trigger signal sent by the web page 820, and the first function depends on the second function.

[0084] Reference Figure 2 The distributed system monitoring method further includes the following steps: Step S100, sending a tracking identifier to the web page end 820 via a transmitter.

[0085] Tracing identifiers are used to track transaction processing in distributed systems. They can help developers and operators understand system behavior and locate errors and performance bottlenecks. Tracing identifiers are globally unique identifiers that identify the call chain of a request. In a distributed system, a request may span multiple services or components. Tracing identifiers connect all related operations in these services or components in series to form a complete tracing chain. By collecting and aggregating these related call information, the call chain of the entire request can be constructed, thereby tracing the flow path of the request in the system.

[0086] Tracing identifiers are usually expressed in string form, and different standards or protocols can be used to define their format and transmission method. Common standards include OpenTracing and Zipkin. There are many ways to generate tracing identifiers, and the most common ones are to use a universally unique identifier (Universally Unique Identifier, UUID) or a random number generator such as a timestamp. In order to ensure the global uniqueness of the tracing identifier, some specific information can be added when generating it, such as the node name, timestamp, etc.

[0087] In the distributed system, a unique tracking identifier is generated by a global number generator 810. A request is initiated to the number generator 810 at each request. In other embodiments, the tracking identifier can be generated by a universal unique identifier, which is a 128-bit long number. The UUID is calculated based on data such as the current time, counter, and hardware identification (usually the MAC address of the wireless network card). In other embodiments, the tracking identifier is generated by combining the current timestamp and a random number. This method can ensure uniqueness in time sequence and has a certain degree of randomness. In other embodiments, the tracking identifier is generated by combining the machine ID, serial number and a timestamp.

[0088] The web page 820 triggers the first service of the first system 830 through the interface. The first function is one of the functions of the first service of the first system 830. The first service of the first system 830 will execute the first function during the transaction processing. The web page 820 sends a trigger signal to the first system 830. The first system 830 executes the first service according to the trigger signal and executes the first function during the transaction processing of the first service. The trigger signal includes a tracking identifier.

[0089] For example, the first system 830 is system A, the first service is SrvA, and the first function is FunA. The web page 820 triggers the service SrvA of system A through the interface. The web page 820 sends a trigger signal including a tracking identifier to system A, and system A executes the service SrvA according to the trigger signal, and executes FunA during the transaction processing of the service SrvA.

[0090] The first function of the first service of the first system 830 depends on the second function of the second service of the second system 840. Specifically, a certain processing logic of the first function depends on a certain processing logic of the second function. The first service of the first system 830 sends a tracking identifier to the second service of the second system 840. The second system 840 executes the second function according to the trigger signal forwarded by the first system 830.

[0091] For example, the second system 840 is system B, the first service is SrvB, and the first function is Fun B. System B executes service SrvB and executes FunB during the transaction processing of service SrvB.

[0092] For example, in an e-commerce platform, system A is the order system and system B is the inventory system. After a user places an order on the platform, the order system needs to process the order, while the inventory system is responsible for managing the inventory. During the order processing process, the order system needs to call the inventory system to ensure that the inventory is sufficient.

[0093] System A is responsible for processing user orders. It includes service logic SrvA, which includes the following steps: verify order information; calculate order price; check whether the inventory is sufficient; create an order; initiate payment process. Service logic SrvA is a core service in system A, which is responsible for processing the entire life cycle of an order. Among them, method FunA is checkInventory, which is responsible for checking whether the inventory is sufficient.

[0094] System B is responsible for managing the inventory of goods. It includes service logic SrvB, which includes the following steps: update inventory; query inventory. Service logic SrvB is a core service in system B, which is responsible for handling inventory-related operations. Among them, method FunB is queryInventory, which is responsible for querying the inventory quantity of a specific product.

[0095] The calling relationship between method FunA and method FunB is as follows: A user places an order on system A. System A's service logic SrvA starts processing the order. SrvA calls method FunA to check whether the inventory is sufficient. In the process of checking the inventory, method FunA needs to call system B's service logic SrvB. Method FunA calls method FunB through an interface to obtain the inventory quantity of a specific product. Method FunB queries and returns the inventory quantity from the database. Method FunA determines whether there is enough inventory to meet the order requirements based on the returned inventory quantity. If the inventory is sufficient, SrvA continues to execute the subsequent order creation and payment process; if the inventory is insufficient, an exception is thrown.

[0096] The decorator is added in the form of a function to the function corresponding to the first function and the function corresponding to the second function.

[0097] It is understandable that decorator functions allow new functions to be added without modifying the original function code. Decorators are often used in scenarios such as logging, performance testing, transaction processing, and permission verification. The return value of a decorator is also a function object. Decorator functions execute specific logic before and after method execution and when exceptions occur.

[0098] Define a decorator function. This function can receive a function as a parameter and return a new function that will wrap the original function and execute additional logic before and after the call. When deploying the first system 830 and the second system 840, add decorator functions to all business classes and methods of the first system 830 and the second system 840 through scripts. Use a try block to wrap the call of the function of the first service and the function of the second service. This allows catching exceptions that occur during the execution of the function.

[0099] Reference Figure 3, the distributed system monitoring method also includes the following steps: Step S300, when the decorator detects that the first function and the second function are normal, obtains the second payload and the tracking identifier from the first system and the second system.

[0100] The second payload includes stack information, input parameters and output parameters of the first function, and input parameters and output parameters of the second function.

[0101] Exemplarily, for the decorator function, when executing the first function of the first service, inside the try block, the function of the first function of the first service is called, the input parameters are recorded, the input parameters are passed to the function of the first function of the first service, and the output parameters returned by the function of the first function of the first service are recorded.

[0102] When the function of the first function of the first service is successfully executed and no exception is thrown, the decorator uses the traceback module to capture the current stack information. In addition, the current stack trace can be printed through the print_stack() function and the string representation of the stack information can be obtained through the format_stack() function.

[0103] Similarly, when executing the second function of the second service, inside the try block, call the function of the second function of the second service, record the input parameters, pass the input parameters to the function of the second function of the second service, and record the output parameters returned by the function of the second function of the second service.

[0104] When the function of the second function of the second service is successfully executed and no exception is thrown, the traceback module is used to capture the current stack information. In addition, the current stack trace can be printed through the print_stack() function and the string representation of the stack information can be obtained through the format_stack() function.

[0105] The stack information, the input parameters and output parameters of the first function, and the input parameters and output parameters of the second function are combined into a payload in a structured data format as a second payload. At the same time, a system timestamp and a tracking identifier are obtained. The second payload, the system timestamp and the tracking identifier are sent to the monitoring server 860.

[0106] When detecting an exception in the first function or the second function, the decorator obtains a first payload and a trace identifier from the first system 830 and the second system 840 , where the first payload includes stack information and an exception key field.

[0107] When an exception occurs in the function of the first function of the first service, the decorator uses the catch block to capture the exception signal of the first function of the first service, and also uses the traceback module to capture the stack information of the exception. In the catch block, the type, message and other related information of the exception are also recorded to obtain the exception key field. Similarly, the decorator uses the traceback module to capture the stack information of the first function of the first service. In addition, the stack trace of the first function of the first service can be printed through the print_stack() function and the string representation of the stack information of the first function of the first service can be obtained through the format_stack() function.

[0108] Even if no exception occurs in the function of the second function of the second service, since the first function depends on the second function, the decorator still needs to use the traceback module to capture the stack information of the second function of the second service, and can also print the stack trace of the second function of the second service through the print_stack() function and obtain the string representation of the stack information of the second function of the second service through the format_stack() function.

[0109] When an exception occurs in the function of the second function of the second service, the decorator uses the catch block to capture the exception signal of the second function of the second service, and also uses the traceback module to capture the stack information of the exception. In the catch block, the type, message and other related information of the exception are also recorded to obtain the exception key field. Similarly, the decorator uses the traceback module to capture the stack information of the second function of the second service. In addition, the stack trace of the second function of the second service can be printed through the print_stack() function and the string representation of the stack information of the second function of the second service can be obtained through the format_stack() function.

[0110] The stack information and the exception key field are combined into a payload in a structured data format as the first payload. At the same time, the acquisition time and the tracking identifier are determined. The first payload, the acquisition time and the tracking identifier are sent to the monitoring server 860.

[0111] Reference Figure 4 , the distributed system monitoring method also includes the following steps: Step S400, sorting the target effective load according to the acquisition time by the monitoring server to obtain the load sorting result.

[0112] The monitoring server 860 is connected to the observation web page 850, which is another web page 820 different from the input web page 820. For example, the monitoring server 860 sorts the target payloads from early to late according to the acquisition time to obtain the payload sorting result, or sorts the target payloads from late to early according to the acquisition time to obtain the payload sorting result.

[0113] The monitoring server 860 sends the load sorting result to the observation web page 850 through Websocket. The observation web page 850 renders the exception stack in a highlighted style for monitoring personnel to view.

[0114] The monitoring server 860 sends the load sorting result to the observation web page 850 via WebSocket. The observation web page 850 renders the exception stack in a highlighted style for monitoring personnel to view.

[0115] The observation web page 850 initiates a WebSocket connection request to the monitoring server 860 through a browser. This can be done through the WebSocket object and using the new WebSocket (url) statement, where url is the address sent by the monitoring server 860.

[0116] After receiving the connection request, the monitoring server 860 performs a handshake according to the protocol. The handshake process includes the observation web page 850 and the monitoring server 860 exchanging protocol versions, the WebSocket version supported by the observation web page 850, and a Sec-WebSocket-Key for verifying the connection.

[0117] After the handshake is successful, the observation web page terminal 850 responds to the observation web page terminal 850, confirming that the connection has been established, and returns a Sec-WebSocket-Accept response header, which includes a hash value calculated based on the Sec-WebSocket-Key.

[0118] After the WebSocket connection is established, the monitoring server 860 and the observation web page 850 can transmit data through the WebSocket connection. During the data transmission process, the WebSocket protocol will handle the framing and reassembly of the data to ensure the integrity and order of the data.

[0119] When the observation web page 850 receives the load sorting result from the monitoring server 860, an onmessage event is triggered. The observation web page 850 can set an event listener on the WebSocket object to handle this event. Similarly, the monitoring server 860 also has a corresponding mechanism to process the received data.

[0120] In order to keep the connection active and detect whether the connection is still valid, the monitoring server 860 and the observation web page 850 can periodically send heartbeat messages. These messages are usually small data packets used to confirm that both ends of the connection are active.

[0121] If an error occurs during the connection process or the connection needs to be closed, the WebSocket protocol provides a close() method to close the connection. Before closing the connection, a close frame containing a status code and a closing reason is usually sent first so that the other party knows that the connection is about to be closed. Both the monitoring server 860 and the observation web page 850 can listen to the onclose event to handle the connection closing situation.

[0122] When deploying in the production environment later, remove the relevant script comments and you can monitor the offline distributed system.

[0123] The distributed system monitoring method can make up for the performance problems of the distributed system in collecting and merging logs, avoid the problem of missing abnormal key information when processing logs, and improve the efficiency and accuracy of abnormal location of the distributed system.

[0124] The embodiment of the present application also provides an electronic device. Figure 6 The electronic device includes a memory 902 and a processor 901. The memory 902 stores a computer program. When the processor 901 executes the computer program, the above-mentioned distributed system monitoring method is implemented. The electronic device can be any intelligent terminal including a tablet computer, a vehicle-mounted computer, etc.

[0125] The processor 901 can be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), or one or more integrated circuits, etc., and is used to execute relevant programs to implement the technical solutions provided in the embodiments of the present application; the memory 902 can be implemented in the form of a read-only memory (Read Only Memory, ROM), a static storage device, a dynamic storage device, or a random access memory (Random Access Memory, RAM). The memory 902 can store an operating system and other application programs. When the technical solutions provided in the embodiments of this specification are implemented by software or firmware, the relevant program codes are stored in the memory 902, and the processor 901 is used to call and execute the training method and speech recognition method of the speech recognition model of the embodiments of the present application.

[0126] The input / output interface 903 is used to realize information input and output; the communication interface 904 is used to realize communication interaction between this device and other devices, and communication can be realized through wired methods (such as USB, network cable, etc.) or wireless methods (such as mobile network, WIFI, Bluetooth, etc.); the bus 905 transmits information between the various components of the device (such as the processor 901, the memory 902, the input / output interface 903 and the communication interface 904); wherein the processor 901, the memory 902, the input / output interface 903 and the communication interface 904 realize communication connection with each other within the device through the bus 905.

[0127] An embodiment of the present application also provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the above-mentioned distributed system monitoring method is implemented.

[0128] The memory, as a non-transient computer-readable storage medium, can be used to store non-transient software programs and non-transient computer executable programs. In addition, the memory may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory may optionally include a memory remotely disposed relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0129] The embodiments described in the embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application and do not constitute a limitation on the technical solutions provided in the embodiments of the present application. Those skilled in the art will appreciate that with the evolution of technology and the emergence of new application scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.

[0130] Those skilled in the art will appreciate that the technical solutions shown in the figures do not constitute a limitation on the embodiments of the present application, and may include more or fewer steps than shown in the figures, or a combination of certain steps, or different steps.

[0131] The device embodiments described above are merely illustrative, and the units described as separate components may or may not be physically separated, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0132] Those skilled in the art will appreciate that all or some of the steps in the methods disclosed above, and the functional modules / units in the systems and devices may be implemented as software, firmware, hardware, or a suitable combination thereof.

[0133] The terms "first", "second", "third", "fourth", etc. (if any) in the specification of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0134] It should be understood that in the present application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.

[0135] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the above units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0136] The units described above as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0137] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0138] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including multiple instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, referred to as ROM), random access memory (Random Access Memory, referred to as RAM), disk or optical disk and other media that can store programs.

[0139] The preferred embodiments of the present invention are described above with reference to the accompanying drawings, but the scope of the rights of the present invention is not limited thereto. Any modification, equivalent substitution and improvement made by a person skilled in the art without departing from the scope and essence of the present invention should be within the scope of the rights of the present invention.

Claims

1. A distributed system monitoring device, characterized in that: include: Web page; a first system, the web page sends a trigger signal to the first system, the first system performs a first function according to the trigger signal, the trigger signal includes a tracking identifier; a second system, the second system performing a second function, the first function being dependent on the second function; A decorator, the decorator being used to obtain a first payload and the trace identifier from the first system and the second system when an exception is detected in the first function or the second function, the first payload including stack information and an exception key field; A monitoring server is configured to obtain a target payload from the first payload according to the tracking identifier.

2. The distributed system monitoring device according to claim 1, characterized in that: The distributed system monitoring device also includes a number transmitter, which is used to send a tracking identifier to the web page.

3. The distributed system monitoring device according to claim 1, characterized in that: The monitoring server is used to sort the target effective load according to the acquisition time to obtain the load sorting result.

4. The distributed system monitoring device according to claim 1, characterized in that: The decorator is added in the form of a function to the function corresponding to the first function and the function corresponding to the second function.

5. The distributed system monitoring device according to claim 1, characterized in that: The decorator is used to obtain a second payload and the tracing identifier from the first system and the second system when it is detected that the first function and the second function are normal, wherein the second payload includes stack information, input parameters and output parameters of the first function, and input parameters and output parameters of the second function.

6. The distributed system monitoring device according to claim 1, characterized in that: The second system executes the second function according to the trigger signal forwarded by the first system.

7. The distributed system monitoring device according to claim 1, characterized in that: The first function is one of the functions of the first service of the first system, and the second function is one of the functions of the second service of the second system.

8. A distributed system monitoring method, characterized in that: Applied to the distributed system monitoring device according to any one of claims 1 to 7, the method comprises: In case of detecting an abnormality in a first function executed by a first system or a second function executed by a second system, obtaining a first payload and a trace identifier from the first system and the second system, the first payload including stack information and an abnormality key field; obtaining a target payload from the first payload according to the tracking identifier; Among them, the first function is executed by the first system according to the trigger signal sent by the web page, and the first function depends on the second function.

9. An electronic device, characterized in that: The electronic device comprises a memory and a processor, the memory stores a computer program, and the processor implements the distributed system monitoring method of claim 8 when executing the computer program.

10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the distributed system monitoring method of claim 8 is implemented.

Citation Information

Cited By

  • TLCP encryption communication tracking method and system based on distributed micro service

    CN120856465A

  • Tlcp encryption communication tracking method and system based on distributed micro services

    CN120856465B