Abnormal link tracking method and apparatus
By mounting probes in the microservice architecture and using traceID to query key-value memory cache middleware, a lightweight distributed anomaly tracing mechanism was implemented, solving the problem of low efficiency in anomaly location and troubleshooting in the microservice architecture and improving the stability and maintainability of the system.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIJING SHANGYUE NETWORK TECH CO LTD
- Filing Date
- 2025-02-14
- Publication Date
- 2026-06-23
AI Technical Summary
In microservice architecture, the process of anomaly localization and troubleshooting is inefficient, manual troubleshooting is labor-intensive, leading to delayed fault response and affecting system maintainability. Existing solutions suffer from high deployment costs, high resource consumption, and complex maintenance.
By attaching probes to obtain the Web interface component and log processing component in the IOC container, capturing ERROR logs and displaying them as page pop-ups, and using traceID to query the key-value memory cache middleware to obtain exception details, the exception tracing process is simplified.
It reduces storage and computing resource consumption, simplifies the anomaly feedback and troubleshooting process, improves system stability and maintainability, and reduces the workload of development and testing personnel.
Smart Images

Figure CN119621491B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the technical field of anomaly detection, and more particularly to an anomaly link tracing method and apparatus. Background Technology
[0002] With the continuous development of technology and the arrival of the information age, microservice architecture has gradually become the mainstream architectural pattern in modern system design. By splitting a single system into multiple independent services, microservice architecture not only effectively improves the system's concurrent processing capabilities but also significantly enhances its flexibility and scalability, thus becoming an important technical means to drive business growth.
[0003] In a microservices architecture, each service typically consists of multiple nodes that collaborate to handle requests through load balancing mechanisms. A complete business process is supported and supported by multiple services, which work together to ensure system stability, reliability, and high throughput. However, due to the distributed nature of microservices, locating, tracing, identifying the root cause, and troubleshooting and resolving anomalies presents significant challenges. How to quickly, efficiently, and accurately locate problems and reduce communication costs between testers and developers has become a critical issue affecting system maintenance efficiency and availability.
[0004] Currently, anomaly localization and troubleshooting in microservice scenarios primarily rely on manual investigation. Testers discover system errors and notify developers, who then reproduce the problem, deduce possible causes, and use the API URL to execute log query commands on relevant web service nodes to filter out log records related to the anomaly. If the anomaly involves multiple services or middleware services, this query process needs to be repeated on other service nodes. Since each service in a microservice architecture contains multiple nodes, and the number of services is large, the workload of manual investigation increases exponentially with the number of nodes, leading to low efficiency. Especially in complex business scenarios with a large number of nodes, manual investigation is prone to causing delays in fault response, severely impacting system maintainability. Existing solutions for anomaly tracing in microservice scenarios suffer from high deployment costs, high resource consumption, and complex maintenance. How to properly address these issues has become a pressing issue for the industry. Summary of the Invention
[0005] This invention provides an anomaly link tracing method and apparatus to achieve lightweight distributed anomaly link tracing, which not only reduces the consumption of storage and computing resources, but also simplifies the anomaly feedback and troubleshooting process.
[0006] According to a first aspect of the present invention, an abnormal link tracing method is provided, the abnormal link tracing method comprising:
[0007] When the system starts, a probe is mounted. The probe is used to obtain the IOC container currently loaded by the system. The IOC container is injected with web interface components and log processing components.
[0008] When a page function malfunctions, the probe is triggered to obtain an ERROR log and provide feedback in the form of a page pop-up. The log processing component is used to receive the ERROR log and encapsulate it. The page pop-up includes a web interface component and a traceID.
[0009] When viewing the error details link in the pop-up window, a request to query the error link is initiated to the current service based on the web interface component and traceID included in the pop-up window;
[0010] Based on the request to query the abnormal link, the web interface component queries the key-value memory cache middleware to obtain the exception details, encapsulates the exception details, and returns the HTTP return value.
[0011] In one embodiment, it includes:
[0012] A web interface component is injected into the IOC container, and the web interface component is used to query exception details.
[0013] In one embodiment, it also includes:
[0014] A log processing component is added to the log framework. This log processing component is used to print ERROR-level logs to a key-value memory cache middleware. The log processing component needs to be registered with the log framework.
[0015] In one embodiment, it includes:
[0016] Before mounting the probe, prepare one or more business projects that rely on Spring Boot open-source components and have a call relationship, and keep the traceId consistent in the call chain.
[0017] In one embodiment, it includes:
[0018] The encapsulated value information in the ERROR log includes one or more of the following: service name, IP address, log category, method-level code line number, and key, wherein the key consists of a prefix and traceID.
[0019] In one embodiment, it also includes:
[0020] The encapsulated value information in the ERROR log is stored in JSON format;
[0021] The ERROR log is stored using a key-value memory cache middleware.
[0022] According to a second aspect of the present invention, an abnormal link tracing device is provided, comprising:
[0023] The mounting module is used to mount a probe when the system starts. The probe is used to obtain the IOC container currently loaded by the system. The IOC container is injected with web interface components and log processing components.
[0024] The triggering module is used to trigger the probe to obtain ERROR logs when the page function is abnormal, and to provide feedback in the form of a page pop-up. The log processing component is used to receive the ERROR logs and encapsulate them. The page pop-up includes a web interface component and a traceID.
[0025] The request module is used to initiate a request to query the abnormal link to the current service based on the web interface component and traceID in the page pop-up when viewing the abnormal details link;
[0026] The query module is used to query the key-value memory cache middleware to obtain exception details based on the request to query the exception link, encapsulate the exception details, and return the HTTP return value.
[0027] According to a third aspect of the present invention, an electronic device is provided, comprising: a communication interface, a processor, and a memory;
[0028] The memory is used to store program instructions, which, when executed by the processor that is connected to the memory via the communication interface, implement any of the above-described abnormal link tracing methods.
[0029] According to a fourth aspect of the present invention, a computer-readable storage medium is provided, on which computer program instructions are stored, which, when executed by a computer (e.g., a processor in the computer), implement any of the above-described abnormal link tracing methods.
[0030] In summary, this invention provides an anomaly tracing method and apparatus. The method includes: when the system starts, attaching a probe to obtain the IOC container currently loaded by the system, wherein a web interface component and a log processing component are injected into the IOC container; when a page function malfunctions, triggering the probe to obtain an ERROR log and providing feedback in the form of a page pop-up, wherein the log processing component receives and encapsulates the ERROR log, and the page pop-up includes the web interface component and a traceID; when viewing the anomaly details link in the page pop-up, initiating a query request for the anomaly tracing link to the current service based on the web interface component and traceID included in the page pop-up; based on the query request for the anomaly tracing link, the web interface component queries a key-value memory cache middleware to obtain the anomaly details, and encapsulates the anomaly details into an HTTP return value, so that developers can easily obtain the anomaly details for analysis and repair, avoiding the cumbersome method of querying logs to obtain the anomaly details. The technical solution of this application provides a lightweight distributed anomaly tracing technology solution, which can not only significantly reduce the occupation of storage and computing resources, but also simplify the anomaly feedback and troubleshooting process, which is of great significance for improving the stability and maintainability of the system.
[0031] Other features and advantages of the invention will be set forth in the description which follows, and will be apparent in part from the description, or may be learned by practicing the invention. The objects and other advantages of the invention may be realized and obtained by means of the structures particularly pointed out in the written description and drawings.
[0032] The technical solution of the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. Attached Figure Description
[0033] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0034] Figure 1 A flowchart of an abnormal link tracing method provided for an embodiment of the present invention;
[0035] Figure 2 A schematic diagram of a page pop-up window for another abnormal link tracing method provided in an embodiment of the present invention;
[0036] Figure 3 An anomaly details diagram of yet another anomaly link tracing method provided as an embodiment of the present invention;
[0037] Figure 4 A traceID diagram of another abnormal link tracing method provided in the embodiments of the present invention;
[0038] Figure 5 A structural diagram of an abnormal link tracing device provided for an embodiment of the present invention;
[0039] Figure 6 This is a structural diagram of an electronic device provided as an embodiment of the present invention. Detailed Implementation
[0040] The features and exemplary embodiments of various aspects of this application will be described in detail below. To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only intended to explain this application and not to limit it. For those skilled in the art, this application can be implemented without some of these specific details. The following description of the embodiments is merely to provide a better understanding of this application by illustrating examples.
[0041] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising..." does not exclude the presence of additional identical elements in the process, method, article, or apparatus that includes said element.
[0042] like Figure 1 As shown, the present invention provides an abnormal link tracing method, which includes:
[0043] In step S11, when the system starts, a probe is mounted. The probe is used to obtain the IOC container currently loaded by the system. The IOC container is injected with web interface components and log processing components.
[0044] In step S12, when a page function malfunctions, the probe is triggered to obtain an ERROR log and provide feedback in the form of a page pop-up. The log processing component is used to receive the ERROR log and encapsulate it. The page pop-up includes a web interface component and a traceID.
[0045] In step S13, when viewing the abnormal details link in the pop-up window, a request to query the abnormal link is initiated to the current service based on the web interface component and traceID included in the pop-up window;
[0046] In step S14, based on the request to query the abnormal link, the web interface component queries the key-value memory cache middleware to obtain the abnormal details, encapsulates the abnormal details, and returns the HTTP return value.
[0047] In one embodiment, a probe is mounted at system startup to obtain the currently loaded IOC container. The IOC container is an implementation of dependency injection, commonly used in modern development frameworks such as Spring. It manages the lifecycle of objects and the dependencies between them, ensuring that dependencies are correctly injected into each object when needed. The probe, by accessing the IOC container at system startup, can monitor and manage various components within the system. The web interface component provides the interface for the system to interact with the outside world, while the logging component records errors and related information that occur during system operation. These two components are injected into the IOC container at system startup through the mounting of the probe, ensuring they can respond to and handle various events promptly during system runtime. The IOC container not only performs dependency injection but also manages application system components. In a microservice architecture, the IOC container can flexibly manage modules, ensuring loose coupling between components and enabling dynamic injection and configuration of modules. Through the IOC container, each service in the system can run independently, without depending on the specific implementation of other services.
[0048] When a page function malfunctions in the system, a probe is triggered, and the probe captures ERROR-level logs. These ERROR-level logs are displayed to the user as a pop-up window, indicating that a system error has occurred, as shown in the attached image. Figure 2 As shown, the log processing component is responsible for receiving captured ERROR logs and encapsulating them. The encapsulated log information is stored and provided to the user via a pop-up window. The purpose of encapsulating log information is to ensure the structured and standardized nature of exception information, thereby facilitating quick understanding and handling of problems by developers and testers. The encapsulated log information includes, but is not limited to, service name, IP address, log category, method-level code line number, and traceID. With this information, developers can quickly locate the specific location of the error, thereby reducing troubleshooting time.
[0049] In addition to displaying the encapsulated information of the error log, the pop-up window also includes a traceID. A traceID is a tracing mechanism in distributed systems used to identify the entire call chain of a request from the beginning to the end of the system. The introduction of traceIDs allows developers to accurately pinpoint the nodes and stages where problems occur by tracing the call chain with the same traceID, thus quickly locating the issue. When developers or testers view the exception details link in the pop-up window, the system will initiate a query request for the exception chain to the current service based on the Web interface component and traceID in the pop-up window, retrieving the entire exception chain information, as shown in the attached image. Figure 3 As shown, this is to identify the upstream and downstream services where the anomaly occurred and trace the root cause of the problem.
[0050] The request to query abnormal links is implemented through the traceID. The system can trace back to all service nodes through which the request passed and find possible errors on each node, such as... Figure 4 As shown. Querying abnormal links not only helps to locate errors in individual nodes, but also reveals problems in cross-service calls.
[0051] When querying the exception chain, the Web interface component needs to query a key-value in-memory cache middleware (such as Redis) to obtain exception details. Redis is a high-performance in-memory storage system that stores data in key-value pairs and supports high-speed reads. Leveraging Redis's high efficiency as a caching system allows exception log information to be quickly retrieved and queried with almost no latency. As an in-memory database, Redis offers very high read and write speeds, making it particularly suitable for storing frequently accessed data, such as exception logs. Because Redis is memory-based, its access latency is negligible. For developers who need to quickly locate problems, being able to quickly obtain exception details is crucial. Although Redis is in-memory storage, it also provides persistence options, ensuring that log data is not lost even after a system restart. ERROR logs are stored as structured JSON data. Each log key consists of a traceID and a prefix. This design allows for easy retrieval of all relevant logs for a given request via the traceID. By storing this log data in Redis, the system can efficiently store and retrieve large amounts of exception information. An IOC container is used to manage the lifecycle and dependencies of the Web interface component and the log processing component. The web interface component is responsible for querying exception details, while the log processing component is responsible for processing and storing error logs.
[0052] The web interface component exposes the interface for querying exception details, receives user requests, and returns exception information. The log processing component captures ERROR logs in the background, encapsulates and stores this log information in a structured manner for later querying. The log processing component needs to be registered with the logging framework to ensure that no important information is missed during log capture and storage. The encapsulated value of the ERROR log includes the service name, IP address, log category, method-level code line number, and any or more information from the key, stored in Redis using traceID as the key. The encapsulated log information is stored in JSON format to ensure data structure, readability, and cross-system compatibility.
[0053] Service name and IP address help developers identify which service node experienced the problem, thus pinpointing the environment in which the failure occurred. Method-level line counts provide specific line information about the code where the exception occurred, further assisting developers in locating the specific code position. TraceID ensures developers can trace the entire call chain and understand the request's flow within the system. JSON, as a lightweight data exchange format, conveniently stores structured data and easily interacts with other systems. Using JSON format to store ERROR logs ensures that exception logs are not only quickly accessible internally but also compatible with other external tools, facilitating subsequent exception analysis and troubleshooting.
[0054] Before mounting the probe, develop one or more business applications with call relationships and maintain traceID consistency across the call chain. Spring Boot is a lightweight framework that helps developers simplify application development, configuration, and deployment in microservice architectures. Business applications developed with Spring Boot can easily integrate various distributed components and technologies, such as Redis and logging frameworks, thereby achieving efficient exception tracing. Spring Boot simplifies configuration and development; its auto-configuration and convention-over-configuration features significantly reduce configuration workload, allowing developers to focus on business implementation. Spring Boot integrates tightly with other Spring ecosystem components (such as Spring Cloud), facilitating the construction of distributed systems.
[0055] This invention provides an innovative lightweight distributed exception tracing technology that combines an IOC container, web interface component, log processing component, and key-value memory caching middleware (such as Redis) in a microservice architecture to achieve efficient exception log capture, storage, and retrieval. Developers can quickly locate exceptions, avoiding tedious log querying processes, thereby improving system stability and developer productivity.
[0056] A distributed microservice system developed based on Spring Boot open-source components contains one or more business projects with certain calling relationships. Each business project maintains a consistent traceID during the calling process to enable call chain tracing.
[0057] When each business process in a distributed microservice system starts, the probe of this invention is mounted. This probe is lightweight, requiring no additional third-party packages or code modifications, and is non-intrusive to the business processes. When a system exception occurs, the probe, in conjunction with a logging framework, captures exception information, including stack trace, service name, thread, class, method, and line number of the exception. An exception is displayed via a pop-up window, providing a hyperlink. Clicking this hyperlink locates and displays detailed exception information, returning a page model in the same format displaying the captured exception details. If it is necessary to directly request the defined interface URL to pass the traceID parameter on the page, a hyperlink is added to the pop-up window, and the traceID is obtained from the returned interface model. The probe automatically stores the captured exception details in a key-value memory cache middleware according to a specific format. This cache middleware has an automatic expiration function, enabling low-cost, lightweight storage of exception information. The probe can be extended to implement different controllers, defining different key-value memory cache middleware data structure logic, adding interception at each entry point, thereby displaying the call chain flowchart. Because all business processes maintain consistent traceIDs during the call process, the call chain can be traced through the traceID, quickly locating the location of the exception. This reduces the time and effort developers spend troubleshooting exceptions, and lowers communication costs and exception reproduction costs between testers and developers. Only exception logs of the exceptions that occurred are stored, fully utilizing the existing storage resources of the business system without requiring additional complex storage deployments. This achieves non-intrusive, low-cost exception information storage and display, which is of great significance for improving the maintainability of the entire business system.
[0058] No complex supporting services need to be deployed; functionality can be achieved simply by attaching a probe during service deployment, resulting in minimal resource consumption on business systems. Business engineering requires no additional dependencies or code modifications, and has no impact on existing business systems. Extensibility is possible on the existing probe, allowing for flexible definition of data structure logic for writing to different key-value memory cache middleware, adding interception functionality to display call chain flowcharts, and adapting to diverse business needs. Only exception logs are stored, utilizing existing storage resources in the business system for low-cost exception information storage and display, reducing development and testing costs. It quickly locates the source of exceptions, reducing the workload for developers and testers and improving the maintainability of the entire business system.
[0059] The technical solution in this embodiment provides a lightweight distributed anomaly tracing technology, which can not only significantly reduce the consumption of storage and computing resources, but also simplify the anomaly feedback and troubleshooting process. Especially for microservice scenarios with a large number of nodes, it greatly reduces the workload of manual anomaly troubleshooting.
[0060] In one embodiment, Figure 5 This is a block diagram illustrating an abnormal link tracing device according to an exemplary embodiment. Figure 5 As shown, the abnormal link tracing device includes a mounting module 51, a triggering module 52, a request module 53, and a query module 54.
[0061] The mounting module 51 is used to mount a probe when the system starts. The probe is used to obtain the IOC container currently loaded by the system. The IOC container is injected with web interface components and log processing components.
[0062] The triggering module 52 is used to trigger the probe to obtain ERROR logs when the page function is abnormal, and to provide feedback in the form of a page pop-up. The log processing component is used to receive the ERROR logs and encapsulate them. The page pop-up includes a web interface component and a traceID.
[0063] The request module 53 is used to initiate a request to query the abnormal link to the current service based on the web interface component and traceID in the page pop-up when viewing the abnormal details link in the page pop-up;
[0064] The query module 54 is used to query the key-value memory cache middleware to obtain exception details based on the request of the query exception link, and encapsulate the exception details into an HTTP return value so that developers can easily obtain exception details for analysis and repair, avoiding the need to obtain exception details through cumbersome log querying.
[0065] The mounting module 51, triggering module 52, requesting module 53, and querying module 54 included in the block diagram of the abnormal link tracing device are controlled to execute the abnormal link tracing method described in any of the above embodiments.
[0066] like Figure 6 As shown, the present invention provides an electronic device 600, which includes: a communication interface, a processor 601, and a memory 602;
[0067] The memory 602 stores program instructions. When these instructions are executed by the processor 601, which communicates with the memory 602 via the communication interface, the system starts by attaching a probe. This probe is used to obtain the IOC container currently loaded by the system. The IOC container is injected with a web interface component and a log processing component. When a page function malfunctions, the probe is triggered to obtain an ERROR log, which is then displayed as a pop-up window. The log processing component receives and encapsulates the ERROR log. The pop-up window includes the web interface component and a trace ID. When viewing the exception details link in the pop-up window, a request to query the exception link is initiated to the current service based on the web interface component and trace ID in the pop-up window. Based on the request to query the exception link, the web interface component queries the key-value memory cache middleware to obtain the exception details and encapsulates the exception details into an HTTP return value. This allows developers to easily obtain the exception details for analysis and repair, avoiding the cumbersome process of querying logs to obtain exception details.
[0068] This invention provides a computer-readable storage medium storing computer program instructions. When the computer program instructions are executed by a processor, a probe is attached during system startup. The probe is used to obtain the IOC container currently loaded by the system. A web interface component and a log processing component are injected into the IOC container. When a page function malfunctions, the probe is triggered to obtain an ERROR log and provide feedback in the form of a page pop-up. The log processing component receives the ERROR log and encapsulates it. The page pop-up includes the web interface component and a traceID. When viewing the exception details link in the page pop-up, a request to query the exception link is initiated to the current service based on the web interface component and traceID included in the page pop-up. Based on the request to query the exception link, the web interface component queries the key-value memory cache middleware to obtain the exception details and encapsulates the exception details into an HTTP return value, so that developers can easily obtain the exception details for analysis and repair, avoiding the cumbersome method of querying logs to obtain exception details.
[0069] It should be understood that the specific features, operations, and details described above regarding the method of the present invention can also be similarly applied to the apparatus and system of the present invention, or vice versa. Furthermore, each step of the method of the present invention described above can be performed by a corresponding component or unit of the apparatus or system of the present invention.
[0070] It should be understood that the various modules / units of the device of the present invention can be implemented wholly or partially through software, hardware, firmware, or a combination thereof. Each module / unit can be embedded in the processor of a computer device in hardware or firmware form or independent of the processor, or it can be stored in the memory of a computer device in software form for the processor to call to execute the operation of each module / unit. Each module / unit can be implemented as an independent component or module, or two or more modules / units can be implemented as a single component or module.
[0071] In one embodiment, a computer device is provided, including a memory and a processor. The memory stores computer instructions executable by the processor, which, when executed by the processor, instruct the processor to perform steps of the methods of embodiments of the present invention. The computer device can be broadly categorized as a server, terminal, or any other electronic device with the necessary computing and / or processing capabilities. In one embodiment, the computer device may include a processor, memory, network interface, communication interface, etc., connected via a system bus. The processor of the computer device can be used to provide the necessary computing, processing, and / or control capabilities. The memory of the computer device may include a non-volatile storage medium and internal memory. The non-volatile storage medium may store an operating system, computer programs, etc. The internal memory can provide an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The network interface and communication interface of the computer device can be used to connect and communicate with external devices via a network. When the computer program is executed by the processor, it performs the steps of the methods of the present invention.
[0072] This invention can be implemented as a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, causes the steps of the methods of embodiments of the invention to be performed. In one embodiment, the computer program is distributed across multiple network-coupled computer devices or processors, such that the computer program is stored, accessed, and executed in a distributed manner by one or more computer devices or processors. A single method step / operation, or two or more method steps / operations, may be executed by a single computer device or processor or by two or more computer devices or processors. One or more method steps / operations may be executed by one or more computer devices or processors, and one or more other method steps / operations may be executed by one or more other computer devices or processors. One or more computer devices or processors may execute a single method step / operation, or execute two or more method steps / operations.
[0073] It will be understood by those skilled in the art that the method steps of the present invention can be performed by a computer program instructing related hardware, such as a computer device or processor. The computer program can be stored in a non-transitory computer-readable storage medium, and its execution causes the steps of the present invention to be performed. Depending on the context, any references herein to memory, storage, databases, or other media may include non-volatile and / or volatile memory. Examples of non-volatile memory include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (PROM, which provides a lightweight distributed anomaly tracing technology solution that significantly reduces storage and computing resource consumption and simplifies anomaly feedback and troubleshooting processes, significantly improving system stability and maintainability), flash memory, magnetic tape, floppy disk, magneto-optical data storage device, optical data storage device, hard disk, solid-state drive, etc. Examples of volatile memory include random access memory (RAM), external cache memory, etc.
[0074] The technical features described above can be combined arbitrarily. Although not all possible combinations of these technical features are described, any combination of these technical features should be considered to be covered by this specification, provided that such combination does not contain contradictions.
[0075] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. An abnormal link tracing method, characterized in that, Applied to distributed systems, including: When the system starts, a probe is mounted. The probe is used to obtain the IOC container currently loaded by the system. The IOC container is injected with web interface components and log processing components. When a page function malfunctions, the probe is triggered to obtain an ERROR log and provide feedback in the form of a page pop-up. The log processing component is used to receive the ERROR log and encapsulate it. The page pop-up includes a web interface component and a traceID. When viewing the exception details link in the pop-up window, a request to query the exception link is initiated to the current service based on the web interface component and traceID included in the pop-up window. The pop-up window also includes a hyperlink for carrying the traceID to define the interface URL. The traceID is obtained from the interface return model. Based on the request to query the abnormal link, the web interface component queries the key-value memory cache middleware to obtain the abnormal details, and encapsulates the abnormal details into an HTTP return value so that developers can easily obtain the abnormal details for analysis and repair, avoiding the need to obtain abnormal details through cumbersome log querying. Also includes: The encapsulated value information in the ERROR log includes one or more of the following: service name, IP address, log category, method-level code line number, and key, wherein the key consists of a prefix and traceID; Also includes: The encapsulated value information in the ERROR log is stored in JSON format; The ERROR log is stored using a key-value memory cache middleware.
2. The abnormal link tracing method as described in claim 1, characterized in that, The IOC container includes: A web interface component is injected into the IOC container, and the web interface component is used to query exception details.
3. The abnormal link tracing method as described in claim 1, characterized in that, The log processing component includes: A log processing component is added to the log framework. This log processing component is used to print ERROR-level logs to a key-value memory cache middleware. The log processing component needs to be registered with the log framework.
4. The abnormal link tracing method as described in claim 1, characterized in that, Also includes: Before mounting the probe, prepare one or more business projects that rely on Spring Boot open-source components and have a call relationship, and keep the traceID consistent in the call chain.
5. An abnormal link tracing device, characterized in that, include: The mounting module is used to mount a probe when the system starts. The probe is used to obtain the IOC container currently loaded by the system. The IOC container is injected with web interface components and log processing components. The triggering module is used to trigger the probe to obtain ERROR logs when the page function is abnormal, and to provide feedback in the form of a page pop-up. The log processing component is used to receive the ERROR logs and encapsulate them. The page pop-up includes a web interface component and a traceID. The request module is used to initiate a request to query the abnormal link to the current service based on the web interface component and traceID included in the page pop-up when viewing the abnormal details link in the page pop-up. The page pop-up also includes a hyperlink for carrying the traceID to define the interface URL. The traceID is obtained from the interface return model. The query module is used to query the key-value memory cache middleware to obtain exception details based on the request of the query exception link, and encapsulate the exception details into an HTTP return value so that developers can easily obtain exception details for analysis and repair, avoiding the need to obtain exception details through cumbersome log querying. The apparatus is further configured to include encapsulated value information in the ERROR log, including one or more of the following: service name, IP address, log category, method-level code line number, and key, wherein the key consists of a prefix and traceID; the encapsulated value information in the ERROR log is stored in JSON format; and the ERROR log is saved using a key-value memory caching middleware.
6. The abnormal link tracing device as described in claim 5, characterized in that: The mounting module, the triggering module, the request module, and the query module are controlled to execute the abnormal link tracing method according to any one of claims 1 to 4.
7. An electronic device, characterized in that, include: Communication interface, processor, memory; The memory is used to store program instructions, which, when executed by the processor that is communicatively connected to the memory via the communication interface, cause the electronic device to implement the abnormal link tracing method according to any one of claims 1 to 4.
8. A computer-readable storage medium having program instructions stored thereon, characterized in that, When the program instructions are executed by a computer, the computer causes the computer to implement the abnormal link tracing method according to any one of claims 1 to 4.