A resource call chain log recording method and device under a micro-service architecture
By generating request identifiers for each service request in a microservice architecture, recording and processing the task attributes of microservice modules, and generating resource call chain logs, the problem of difficult log file management is solved, achieving efficient log file management and system optimization.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CAIXUETANG EDUCATION CULTURE MEDIA CHENGDU CO LTD
- Filing Date
- 2025-04-18
- Publication Date
- 2026-04-28
AI Technical Summary
In a microservice architecture, log files are scattered across different servers, making log files difficult to manage and resulting in low management efficiency.
By generating a request identifier for each service request, recording the task attributes of each microservice module, generating resource call chain logs, and performing structured processing and storage, fine-grained end-to-end call chain tracing is achieved.
It improves the efficiency of log file management, and enhances the system's debuggability, fault location efficiency, and system performance optimization efficiency.
Smart Images

Figure CN120407326B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of microservices technology, and in particular to a method and apparatus for logging resource call chains under a microservices architecture. Background Technology
[0002] With the increasing complexity of network services and the rapid development of globalization, the deployment and monitoring methods of existing software systems have encountered challenges. The continuous development of microservices research, represented by containers (Docker), is becoming a new trend to replace traditional resource virtualization.
[0003] Microservice architecture is a method of developing a single application as a set of small services. In a microservice system built on the microservice architecture style, an application request is broken down into different application functions and corresponding microservices are built. These microservices are then distributed across different servers. Each microservice is implemented through its own application process and communicates through lightweight mechanisms.
[0004] Microservice architecture offers advantages such as independent deployment, flexible scaling, and effective resource isolation. However, it also has drawbacks. For example, because microservices are distributed across different servers, each microservice generates a large number of log files during the response process. These log files are also scattered across different servers, making log file management difficult and unable to correlate with internal resource calls within microservices, resulting in low log file management efficiency.
[0005] In the process of realizing this invention, the inventors discovered at least the following problems in the prior art:
[0006] Log files in microservice systems are difficult to manage, resulting in low management efficiency. Summary of the Invention
[0007] The purpose of this invention is to provide a method and apparatus for recording resource call chain logs in a microservice architecture, so as to solve the technical problem that log files in microservice systems are difficult to manage and have low management efficiency in the prior art.
[0008] The preferred technical solutions among the many technical solutions provided by this invention can produce a variety of technical effects, which are described in detail below.
[0009] To achieve the above objectives, the present invention provides the following technical solution:
[0010] In a first aspect, the present invention provides a method for recording resource call chain logs under a microservice architecture, including:
[0011] Receive a service request and generate a request identifier based on the service request;
[0012] The task attributes of each resource in each microservice module are obtained based on the request identifier; wherein, the task attributes of each resource in each microservice module are defined and recorded by the resource call chain log model;
[0013] The task attributes of each resource in each microservice module are structured to obtain the resource call chain log;
[0014] The resource call chain log is recorded and stored.
[0015] Optionally, the task attributes of each resource in each of the microservice modules are defined and recorded by a resource call chain log model, and the method for generating the resource call chain log model in the microservice module includes:
[0016] Establish a standard resource type enumeration based on databases, caches, and message queues;
[0017] The SQL statements in the database are parameterized and anonymized, and the HTTP request methods and paths are recorded to obtain standardized operation instructions.
[0018] A unified state coding system is obtained;
[0019] A high-precision timer is used to record the start and end times of the operation, and the time difference is calculated to obtain the time consumption calculation rules;
[0020] The standard resource type enumeration, operation instructions, status coding system, and time consumption calculation rules are integrated to obtain the resource call chain log model in the microservice module.
[0021] Optionally, receiving a service request and generating a request identifier based on the service request includes:
[0022] Receive service requests sent by users;
[0023] The service request is generated as a request identifier using a hash algorithm; each different service request generates a different and unique request identifier, which is injected into the request context and passed along the call chain.
[0024] Optionally, generating a request identifier from the service request using a hash algorithm includes:
[0025] Extract the request parameters from the service request;
[0026] Convert the request parameters into a JSON string;
[0027] The current timestamp is appended to the JSON string;
[0028] The JSON string, which includes the current timestamp, is processed using MD5 to obtain a unique request identifier.
[0029] Optionally, in obtaining the task attributes of each resource in each microservice module, the task attributes include the resource type, operation command, operation status, and operation time of the resource operation.
[0030] Optionally, the resource types can be categorized and statistically analyzed using the Link field, and a performance bottleneck analysis report can be generated based on the resource types.
[0031] Optionally, after recording and storing the resource call chain log, the method further includes:
[0032] The resource call chain logs are delivered to Alibaba Cloud Log Service for log display and / or old log transfer.
[0033] Secondly, the present invention also provides a resource call chain logging processing device under a microservice architecture, comprising:
[0034] The generation module receives service requests and generates a request identifier based on the service requests.
[0035] The acquisition module obtains the task attributes of each resource in each microservice module based on the request identifier; wherein, the task attributes of each resource in each microservice module are defined and recorded by the resource call chain log model;
[0036] The processing module performs structured processing on the task attributes of each resource in each microservice module to obtain the resource call chain log;
[0037] The recording module records and stores the resource call chain log.
[0038] Thirdly, the present invention also provides a terminal device, comprising:
[0039] One or more processors and memory;
[0040] The memory is used to store one or more computer programs, and the one or more processors are used to execute the one or more computer programs stored in the memory, so that the processors execute the resource call chain logging method steps under the microservice architecture.
[0041] Fourthly, the present invention also provides a computer-readable storage medium storing a computer program, characterized in that the program, when executed by a processor, implements the steps of a resource call chain logging method under a microservice architecture.
[0042] Implementing one of the above-described technical solutions of the present invention has the following advantages or beneficial effects:
[0043] The method described in this invention generates a request identifier for each service request, records the task attributes of each resource within the microservice module, and finally processes the task attributes to obtain resource call chain logs. This enables fine-grained end-to-end call chain tracing, allowing the association and retrieval of logs from each microservice module in the microservice system. This improves the efficiency of log file management, enhances system debuggability, fault location efficiency, and system performance optimization efficiency. Attached Figure Description
[0044] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort. In the drawings:
[0045] Figure 1 This is a schematic diagram of the workflow of Embodiment 1 of the present invention;
[0046] Figure 2 This is a schematic diagram of the workflow of Embodiment 2 of the present invention;
[0047] Figure 3 This is a schematic diagram of the structure of Embodiment 3 of the present invention. Detailed Implementation
[0048] To make the objectives, technical solutions, and advantages of the present invention clearer, various exemplary embodiments described below will be referenced to the accompanying drawings, which form part of the exemplary embodiments, illustrating various exemplary embodiments that may be used to implement the present invention. Unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this disclosure. It should be understood that they are merely examples of processes, methods, and apparatuses consistent with some aspects of the present invention disclosed as detailed in the appended claims, and other embodiments may be used, or structural and functional modifications may be made to the embodiments listed herein without departing from the scope and spirit of the present invention.
[0049] In the description of this invention, it should be understood that the terms "center," "longitudinal," "lateral," etc., indicate the orientation or positional relationship based on the accompanying drawings, and are only for the convenience of describing the invention and simplifying the description, and do not indicate or imply that the referred element must have a specific orientation, or be constructed and operated in a specific orientation. The terms "first," "second," etc., are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. The term "a plurality" means two or more. The terms "connected" and "linked" should be interpreted broadly, for example, they can refer to fixed connections, detachable connections, integral connections, mechanical connections, electrical connections, communication connections, direct connections, indirect connections through an intermediate medium, and can refer to the internal communication of two elements or the interaction relationship between two elements. The term "and / or" includes any and all combinations of one or more of the related listed items. Those skilled in the art can understand the specific meaning of the above terms in this invention according to the specific circumstances.
[0050] To illustrate the technical solution described in this invention, specific embodiments are described below, showing only the parts related to the embodiments of this invention.
[0051] Example 1:
[0052] like Figure 1 As shown, this invention provides a method for logging resource call chains in a microservice architecture, including:
[0053] S10. Receive a service request and generate a request identifier based on the service request;
[0054] S20. Obtain the task attributes of each resource in each microservice module based on the request identifier; wherein, the task attributes of each resource in each microservice module are defined and recorded by the resource call chain log model;
[0055] S30. Perform structured processing on the task attributes of each resource in each microservice module to obtain the resource call chain log;
[0056] S40. Record and store the resource call chain log.
[0057] The resource call chain logging method under a microservice architecture provided in this embodiment includes receiving service requests, generating request identifiers based on the service requests, then obtaining the task attributes of each resource in each microservice module based on the request identifiers, subsequently performing structured processing on the task attributes of each resource in each microservice module to obtain resource call chain logs, and finally recording and storing the resource call chain logs. The method described in this embodiment generates request identifiers for each service request, records the task attributes of each resource within the microservice module, and finally processes the task attributes to obtain resource call chain logs. This enables fine-grained end-to-end call chain tracing, allowing the association and retrieval of logs from each microservice module in the microservice system, thus improving the efficiency of log file management.
[0058] Below, we will combine Figure 1 The resource call chain logging method under the microservice architecture described in this embodiment is explained in detail.
[0059] First, step S10 is executed to receive a service request and generate a request identifier based on the service request. Specifically, the main process is as follows: receiving a service request sent by the user; generating a request identifier from the service request using a hash algorithm; wherein, each different service request will generate a different and unique request identifier, and the request identifier will be injected into the request context and passed along with the call chain.
[0060] Furthermore, the microservice system first receives service requests from users. Upon receiving a service request, the microservice system generates a globally unique request identifier using a hash algorithm, based on the specific service request. Specifically, the request identifier is injected into the request context and propagated throughout the system along the call chain. This ensures that in a complex microservice architecture, each service component can access this unique identifier, enabling end-to-end tracking and monitoring of service requests. This allows the system to effectively manage and coordinate interactions between various microservice components, ensuring correct request processing and response. Simultaneously, the existence of the request identifier improves system debuggability and fault location efficiency, allowing staff to quickly trace the stage and cause of a problem.
[0061] Furthermore, a request identifier is generated from the service request using a hash algorithm, including: extracting the request parameters from the service request; converting the request parameters into a JSON string; appending the current timestamp to the JSON string; and performing MD5 processing on the JSON string with the current timestamp appended to obtain a unique request identifier.
[0062] First, all relevant request parameters are extracted from the service request. These parameters include, but are not limited to, key information such as user ID, operation type, and data range. Next, these parameters are converted into a structured JSON string. The JSON string format ensures data clarity and ease of processing. After generating the JSON string, a current timestamp is appended to it. Specifically, the timestamp records the exact moment the request was generated, further ensuring the uniqueness of each request identifier. Even if two requests have identical parameters, the generated request identifiers will differ due to the different timestamps. Finally, the JSON string with the current timestamp is processed using MD5. It's worth noting that MD5 is a widely used hash algorithm that can convert data of arbitrary length into a fixed-length hash value. After MD5 processing the JSON string with the current timestamp, a unique request identifier is obtained. This request identifier can be used for subsequent logging, request tracing, and data validation, ensuring the efficient operation of the microservice system and the accuracy of the data.
[0063] In this embodiment, the request identifier generated by the hash algorithm is actually the message ID used to uniquely identify each request in a Remote Procedure Call (RPC), which in this embodiment is rpc_msg_id. The request identifier generated by the hash algorithm ensures that each request has a unique identifier, thereby effectively tracking and managing related requests in the system. The use of the hash algorithm not only improves the uniqueness of the identifier but also enhances the security and reliability of the system. It should be noted that while rpc_msg_id in this embodiment facilitates searching and troubleshooting, in actual troubleshooting, it is necessary to combine it with other information, such as the specific interface of the service request.
[0064] Then, step S20 is executed to obtain the task attributes of each resource in each microservice module based on the request identifier; wherein, the task attributes of each resource in each microservice module are defined and recorded by the resource call chain log model.
[0065] Specifically, request identifiers generated through hash algorithms can effectively track and manage related requests in a microservice system. Furthermore, due to the uniqueness and immutability of request identifiers, related requests can be quickly located and identified within complex microservice systems. Therefore, a microservice system can easily obtain the task attributes of each resource in each microservice module based on the request identifier.
[0066] By using request identifiers generated through hash algorithms, we can effectively track and manage related requests in a microservice system. These request identifiers are unique and immutable, enabling rapid location and identification of each request within a complex microservice architecture. Therefore, in a microservice system, these request identifiers allow us to easily obtain the task attributes of each resource within each microservice module.
[0067] Furthermore, the task attributes of each resource in each microservice module are defined and recorded by the resource call chain log model. The generation method of the resource call chain log model in the microservice module includes: establishing a standard resource type enumeration based on the database, cache, and message queue; parameterizing and de-identifying the SQL statements in the database, and recording the HTTP request method and path to obtain standardized operation instructions; unifying the status codes to obtain a status coding system; using a high-precision timer to record the start and end times of the operation and calculating the time difference to obtain the time consumption calculation rules; and integrating the standard resource type enumeration, operation instructions, status coding system, and time consumption calculation rules to obtain the resource call chain log model in the microservice module.
[0068] In this embodiment, the task attributes of each resource in each microservice module are defined and recorded by the resource call chain log model. Generating the resource call chain log model in the microservice module includes the following steps.
[0069] First, a standard resource type enumeration needs to be established based on the specific characteristics of the database (MySQL), cache (Redis), and message queue (RabbitMQ). This standard resource type enumeration is used to unify the types of different resources, ensuring accurate identification and classification when logging.
[0070] Next, the SQL statements in the database (e.g., `SELECT * FROM table WHERE id = ?`) need to be parameterized and anonymized to protect data security. Simultaneously, the method and path of each HTTP request (e.g., `POST / api / v1 / payment`) need to be recorded to obtain standardized operation instructions. These standardized instructions will provide a clear operation log, facilitating subsequent analysis and processing.
[0071] Next, the status codes need to be standardized to form a complete and consistent status coding system. This system can accurately record the status of each operation in the log, such as 200 (success), 500 (error), 404 (resource not found), etc. This allows for better tracking and monitoring of resource usage.
[0072] In addition, a high-precision timer (PHP) is needed to record the start and end times of each operation to further improve log accuracy. By calculating the time difference, the time consumption calculation rules for each operation can be obtained. In this embodiment, the calculated difference is converted to milliseconds and can be defined using the following field: runtime = endTime - startTime. The time consumption calculation rules can improve the efficiency of operation evaluation and identify potential performance bottlenecks.
[0073] Finally, the standard resource type enumeration, operation instructions, status coding system, and time consumption calculation rules are integrated. This integration results in a comprehensive resource call chain log model, which records in detail the call status of each resource in the microservice module. This resource call chain log model not only provides a better understanding of the system's operation but also offers crucial diagnostic information when problems arise, thereby improving the stability and reliability of the microservice system.
[0074] Furthermore, in retrieving the task attributes of each resource in each microservice module, the task attributes include the resource type, operation command, operation status, and operation time. Specifically, the resource type refers to the type of object being operated on, such as a file, database record, or network request. The operation command describes the specific action performed on the resource, such as creating, reading, updating, or deleting. The operation status reflects the current progress of the task, such as whether it is being executed, completed, or failed. Finally, the operation time records the time required to complete the task, which helps to evaluate system performance and optimize resource utilization.
[0075] In this embodiment, the resource type (such as database / API) is marked by the link field, the operation instructions (such as SQL statement, API path) are recorded by the command field, the operation status is defined by the state field, and the operation time is defined by the runtime field.
[0076] Furthermore, resource types are categorized and statistically analyzed using the Link field, enabling the generation of performance bottleneck analysis reports based on resource type. Specifically, the Link field (e.g., link:"MySQL.order_db") is used to perform detailed categorization and statistics on various resource types, generating targeted performance bottleneck analysis reports. Through in-depth analysis of performance bottlenecks, specific improvement measures can be proposed (not specifically limited in this embodiment) to ensure efficient resource utilization and stable system operation.
[0077] Subsequently, step S30 is executed to perform structured processing on the task attributes of each resource in each microservice module to obtain resource call chain logs. Specifically, this embodiment also requires detailed structured processing on the task attributes of each resource in each microservice module. After structured processing, the corresponding resource call chain logs will be obtained.
[0078] The resource call chain log records the call process and operation status of each resource within a microservice module. This log provides a better understanding of resource usage, helps identify potential problems, and allows for optimization of resource allocation and management. Furthermore, the resource call chain log can be used for troubleshooting and performance optimization. By reviewing the call records in the log, the location of problems can be quickly pinpointed, and their causes analyzed. Simultaneously, the data in the logs can be used to evaluate resource performance, identify bottlenecks and shortcomings, and perform targeted optimizations. This also leads to better management and optimization of the microservice architecture.
[0079] Finally, step S40 is executed to record and store the resource call chain log for subsequent analysis and auditing. The recorded resource call chain log allows tracking of the call process for each resource, helping to better understand the system's operation, promptly identify potential problems, and provide strong data support for system optimization and improvement. Furthermore, proper recording and storage of the resource call chain log also improves log query efficiency, enabling rapid problem location and analysis when needed.
[0080] As an optional implementation, after recording and storing the resource call chain logs, the method further includes: delivering the resource call chain logs to Alibaba Cloud Log Service for log display and / or transferring old logs. Specifically, after recording and storing the resource call chain logs, the log data can also be delivered to Alibaba Cloud Log Service (SLS) for real-time log display and analysis. Simultaneously, this function can also be used to transfer old log data for historical data querying and long-term storage.
[0081] The method described in this embodiment generates a request identifier for each service request, records the task attributes of each resource within the microservice module, and finally processes the task attributes to obtain the resource call chain log, thereby achieving fine-grained end-to-end call chain tracing. This enables the association and retrieval of logs from each microservice module in the microservice system, improving the efficiency of log file management. It also enhances the system's debuggability, fault location efficiency, and system performance optimization efficiency.
[0082] The embodiment is merely a specific example and does not indicate that this is the only way to implement the present invention.
[0083] Example 2:
[0084] Based on the same inventive concept, such as Figure 2 As shown, the second embodiment of the present invention also provides a resource call chain logging processing device under a microservice architecture, including:
[0085] The generation module S100 receives service requests and generates a request identifier based on the service requests.
[0086] The acquisition module S200 retrieves the task attributes of each resource in each microservice module based on the request identifier; wherein, the task attributes of each resource in each microservice module are defined and recorded by the resource call chain log model;
[0087] The processing module S300 performs structured processing on the task attributes of each resource in each microservice module to obtain the resource call chain log;
[0088] The recording module S400 records and stores the resource call chain log.
[0089] As an optional implementation, the task attributes of each resource in each microservice module are defined and recorded by a resource call chain log model. The method for generating the resource call chain log model in the microservice module includes:
[0090] Establish a standard resource type enumeration based on databases, caches, and message queues;
[0091] The SQL statements in the database are parameterized and anonymized, and the HTTP request methods and paths are recorded to obtain standardized operation instructions.
[0092] A unified state coding system is obtained;
[0093] A high-precision timer is used to record the start and end times of the operation, and the time difference is calculated to obtain the time consumption calculation rules;
[0094] By integrating standard resource type enumeration, operation instructions, status coding system, and time consumption calculation rules, a resource call chain log model in the microservice module is obtained.
[0095] As an optional implementation, receiving a service request and generating a request identifier based on the service request includes:
[0096] Receive service requests sent by users;
[0097] The service request is generated as a request identifier using a hash algorithm; each different service request generates a different and unique request identifier, which is injected into the request context and passed along the call chain.
[0098] As an optional implementation, the service request is generated as a request identifier using a hash algorithm, including:
[0099] Extract request parameters from the service request;
[0100] Convert the request parameters into JSON strings;
[0101] Concatenate the current timestamp into the JSON string;
[0102] The JSON string containing the current timestamp is processed using MD5 to obtain a unique request identifier.
[0103] As an optional implementation, in obtaining the task attributes of each resource in each microservice module, the task attributes include the resource type, operation command, operation status, and operation time of the resource operation.
[0104] As an optional implementation, resource types can be categorized and statistically analyzed using the Link field, and a performance bottleneck analysis report can be generated based on the resource type.
[0105] As an optional implementation, the processing apparatus further includes:
[0106] The transfer module delivers resource call chain logs to Alibaba Cloud Log Service for log display and / or old log transfer.
[0107] Since the resource call chain logging processing under the microservice architecture described in this embodiment is the apparatus used to implement the resource call chain logging method under the microservice architecture in Embodiment 1 of this application, those skilled in the art can understand the specific implementation method and various variations of the resource call chain logging processing under the microservice architecture in this embodiment based on the resource call chain logging method under the microservice architecture described in Embodiment 1 of this application. Therefore, how the resource call chain logging processing under this microservice architecture implements the method in Embodiment 1 of this application will not be described in detail here. Any apparatus used by those skilled in the art to implement the resource call chain logging method under the microservice architecture in Embodiment 1 of this application falls within the scope of protection of this application.
[0108] Example 3:
[0109] Based on the same inventive concept, the third embodiment of the present invention also provides a terminal device, such as... Figure 3 As shown, it includes one or more processors 301 and a memory 302; wherein, the memory is used to store one or more computer programs, and the one or more processors are used to execute the one or more computer programs stored in the memory, so that the processors perform the features / steps of the xx method embodiment as described in Embodiment 1.
[0110] Those skilled in the art will understand that all or part of the features / steps of the above-described method embodiments can be implemented by methods, data processing systems, or computer programs. These features may be implemented without hardware, entirely in software, or a combination of hardware and software. The aforementioned computer program may be stored in one or more computer-readable storage media. When the computer program is executed (e.g., by a processor), it performs the steps of the resource call chain logging method embodiments under the microservice architecture described above.
[0111] Example 4:
[0112] Based on the same inventive concept, the fourth embodiment of the present invention also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of any of the methods of the resource call chain logging method under the microservice architecture described in the first embodiment above.
[0113] The above description is merely a preferred embodiment of the present invention. Those skilled in the art will understand that various changes or equivalent substitutions can be made to these features and embodiments without departing from the spirit and scope of the present invention. Furthermore, under the teachings of the present invention, these features and embodiments can be modified to adapt to specific situations and materials without departing from the spirit and scope of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed herein, and all embodiments falling within the scope of the claims of this application are within the protection scope of the present invention.
Claims
1. A method for logging resource call chains in a microservice architecture, characterized in that, include: Receive a service request and generate a request identifier based on the service request; The task attributes of each resource in each microservice module are obtained based on the request identifier; wherein, the task attributes of each resource in each microservice module are defined and recorded by a resource call chain log model, and the method for generating the resource call chain log model in the microservice module includes: Establish a standard resource type enumeration based on databases, caches, and message queues; The SQL statements in the database are parameterized and anonymized, and the HTTP request methods and paths are recorded to obtain standardized operation instructions. A unified state coding system is obtained; A high-precision timer is used to record the start and end times of the operation, and the time difference is calculated to obtain the time consumption calculation rules; The standard resource type enumeration, operation instructions, status coding system and time consumption calculation rules are integrated to obtain the resource call chain log model in the microservice module; The task attributes of each resource in each microservice module are structured to obtain the resource call chain log; The resource call chain log is recorded and stored.
2. The resource call chain logging method under a microservice architecture according to claim 1, characterized in that, The process of receiving a service request and generating a request identifier based on the service request includes: Receive service requests sent by users; The service request is generated as a request identifier using a hash algorithm; each different service request generates a different and unique request identifier, which is injected into the request context and passed along the call chain.
3. The resource call chain logging method under a microservice architecture according to claim 2, characterized in that, The step of generating a request identifier from the service request using a hash algorithm includes: Extract the request parameters from the service request; Convert the request parameters into a JSON string; The current timestamp is appended to the JSON string; The JSON string, which includes the current timestamp, is processed using MD5 to obtain a unique request identifier.
4. The resource call chain logging method under a microservice architecture according to claim 1, characterized in that, In obtaining the task attributes of each resource in each microservice module, the task attributes include the resource type, operation command, operation status, and operation time of the resource operation.
5. The resource call chain logging method under a microservice architecture according to claim 4, characterized in that, The resource types are categorized and statistically analyzed using the Link field, and a performance bottleneck analysis report can be generated based on the resource types.
6. The resource call chain logging method under a microservice architecture according to claim 1, characterized in that, After recording and storing the resource call chain log, the method further includes: The resource call chain logs are delivered to Alibaba Cloud Log Service for log display and / or old log transfer.
7. A resource call chain logging and processing device under a microservice architecture, characterized in that, include: The generation module receives service requests and generates a request identifier based on the service requests. The acquisition module obtains the task attributes of each resource in each microservice module based on the request identifier; wherein, the task attributes of each resource in each microservice module are defined and recorded by a resource call chain log model, and the method for generating the resource call chain log model in the microservice module includes: Establish a standard resource type enumeration based on databases, caches, and message queues; The SQL statements in the database are parameterized and anonymized, and the HTTP request methods and paths are recorded to obtain standardized operation instructions. A unified state coding system is obtained; A high-precision timer is used to record the start and end times of the operation, and the time difference is calculated to obtain the time consumption calculation rules; The standard resource type enumeration, operation instructions, status coding system and time consumption calculation rules are integrated to obtain the resource call chain log model in the microservice module; The processing module performs structured processing on the task attributes of each resource in each microservice module to obtain the resource call chain log; The recording module records and stores the resource call chain log.
8. A terminal device, characterized in that, include: One or more processors and memory; The memory is used to store one or more computer programs, and the one or more processors are used to execute the one or more computer programs stored in the memory, so that the processors perform the steps of the resource call chain logging method under the microservice architecture as described in any one of claims 1-6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by the processor, the program implements the resource call chain logging method steps under the microservice architecture as described in any one of claims 1-6.
Citation Information
Patent Citations
Distributed big data log link tracking method and system under micro-service architecture
CN112612675A
Model training method and device, fault prediction method and device, medium and program product
CN119204149A