Link tracking method and device, electronic equipment and storage medium

By generating target tracking identification and recording operation logs on the server side of the microservice architecture, the problem of slow link tracking speed under the microservice architecture is solved, and the rapid determination and efficiency improvement of link tracking results are achieved.

CN119629249APending Publication Date: 2025-03-14CHINA TOWER CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411586795.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-07
Publication Date
2025-03-14

AI Technical Summary

Technical Problem

Under the microservice architecture, fast link tracking is essential for security, auditing, problem investigation, etc., but the existing technology is difficult to effectively improve the speed of link tracking.

Method used

Implementing the link tracking method on the server side of the microservice, including generating a target tracking identity, recording the operation log of the microservice program, and adding a trace identity to the log to determine the call sequence of the target service request.

Benefits of technology

Through the association of target tracking identification, the rapid determination of link tracking results is achieved, and the efficiency of link tracking is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119629249A_ABST
    Figure CN119629249A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a link tracking method and device, electronic equipment and a storage medium. The link tracking method is used for a server side for providing micro-services, and comprises the following steps: under the condition that a request for carrying out link tracking on a target service request of a target user is obtained, determining a target tracking identifier corresponding to the target service request from a pre-stored mapping relationship between the service request and the tracking identifier; a target operation log with a header containing the target tracking identifier is determined from pre-stored operation logs, and the operation log is used for recording related information of calling of the micro-service program; and determining a calling sequence of each micro-service program corresponding to the target service request based on the time and / or calling relationship of the target user calling each micro-service program in the target operation log, so as to take the calling sequence as a link tracking result.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This document belongs to the field of data processing technology, and specifically relates to a link tracking method and device, electronic equipment and storage medium. Background Art

[0002] In the microservice architecture, the business is broken down into a large number of fine-grained, highly functional services, each of which independently carries specific business functions. In many cases, a business request involves multiple microservices, thus forming a request link. Fast link tracking is essential for security, auditing, and troubleshooting. Therefore, a better link tracking solution is needed to increase the speed of link tracking. Summary of the invention

[0003] The embodiments of this specification provide a link tracking method and device, an electronic device, and a storage medium to provide a link tracking solution.

[0004] In a first aspect, an embodiment of the present specification provides a link tracking method for providing a microservice server, including: In the case of obtaining a request for link tracking of a target service request of a target user, determining a target tracking identifier corresponding to the target service request from a pre-stored mapping relationship between service requests and tracking identifiers; Determine, from the pre-stored operation logs, a target operation log containing the target tracking identifier in the header, wherein the operation log is used to record relevant information about the microservice program being called; Based on the time and / or calling relationship of the target user calling various microservice programs in the target operation log, the calling sequence of each microservice program corresponding to the target service request is determined, so as to use the calling sequence as the result of the link tracking.

[0005] Optionally, before performing link tracing, the method includes: generating the target tracking identifier based on the target service request input by the target user; In the case of calling a microservice program based on the target service request, generating a target operation log corresponding to the called microservice program; A header including the target tracking identifier is added to the target operation log.

[0006] Optionally, in the case of calling a microservice program based on the target service request, generating a target operation log corresponding to the called microservice program includes: In the case of calling a microservice program based on the target service request, a target operation log corresponding to the called microservice program is generated according to a preset log output item, and the log output item includes at least one or more of a business identifier, a log content, an operator, an operator identifier, and an operation content parameter.

[0007] Optionally, the log output item includes comparison data, and the method further includes: In the case of calling a microservice program based on the target service request, obtaining a business operation performed by the target user in the microservice program and data related to the business operation; Using a preset comparison function, a comparison operation is performed on the data before and after the business operation to obtain comparison data.

[0008] Optionally, after determining the target operation log, the method further includes: Determine a target output interface corresponding to the target operation log from a plurality of preset output interfaces of the operation log, wherein the output interface includes at least one or more of a message queue task interface, a database write interface, and a log print interface; The target operation log is output through the target output interface.

[0009] Optionally, when the target output interface is a log printing interface, outputting the target operation log through the target output interface includes: Creating a thread pool for printing the target operation log; The target operation log is submitted to the thread pool through the log printing interface to perform multi-threaded asynchronous printing of the target operation log.

[0010] Optionally, the microservice program includes multiple microservice methods, and the method further includes: Obtaining a target microservice method corresponding to the indicator to be recorded from the plurality of microservice methods; Inserting the AOP plug-in into the point of entry of the microservice method, and when the microservice method is accessed, the AOP plug-in records the relevant data of the indicator; When the target service request ends the call to the microservice program, a record result of the indicator is obtained according to relevant data of the indicator.

[0011] In a second aspect, an embodiment of the present specification provides a link tracking device, which is used to provide a microservice server, including: A tracking identifier module, configured to determine a target tracking identifier corresponding to the target service request from a pre-stored mapping relationship between service requests and tracking identifiers when obtaining a request for link tracking of a target service request of a target user; An operation log module, used to determine a target operation log containing the target tracking identifier in the header from a pre-stored operation log, wherein the operation log is used to record relevant information about the microservice program being called; The link tracking module is used to determine the calling sequence of each microservice program corresponding to the target service request based on the time and / or calling relationship of the target user calling various microservice programs in the target operation log, so as to use the calling sequence as the result of the link tracking.

[0012] Optionally, the link tracking device includes: An identifier generation module, used to generate the target tracking identifier based on the target service request input by the target user before link tracking is performed; A log generation module, used to generate a target operation log corresponding to the called microservice program when the microservice program is called based on the target service request; The header adding module is used to add a header including the target tracking identifier to the target operation log.

[0013] Optionally, the log generation module includes: The output item unit is used to generate a target operation log corresponding to the called microservice program according to a preset log output item when the microservice program is called based on the target service request, wherein the log output item includes at least one or more of a business identifier, a log content, an operator, an operator identifier, and an operation content parameter.

[0014] Optionally, the log output item includes comparison data, and the link tracking device further includes: A comparison data module, used to obtain the business operations performed by the target user in the microservice program and the data involved in the business operations when the microservice program is called based on the target service request; The comparison module is used to use a preset comparison function to compare the data before and after the business operation to obtain comparison data.

[0015] Optionally, the link tracking device further includes: An interface selection module, used to determine, after determining the target operation log, a target output interface corresponding to the target operation log from a plurality of preset output interfaces of the operation log, wherein the output interface at least includes one or more of a message queue task interface, a database write interface and a log print interface; The log output module is used to output the target operation log through the target output interface.

[0016] Optionally, the log output module includes: A thread pool unit, used for creating a thread pool for printing the target operation log when the target output interface is a log printing interface; A submitting unit is used to submit the target operation log to the thread pool through the log printing interface to perform multi-threaded asynchronous printing of the target operation log.

[0017] Optionally, the microservice program includes a plurality of microservice methods, and the link tracking device further includes: A microservice method module, used to obtain a target microservice method corresponding to the indicator to be recorded from the plurality of microservice methods; A data recording module, used to insert the AOP plug-in into the cut-off point of the microservice method, and when the microservice method is accessed, the AOP plug-in records the relevant data of the indicator; The recording result module is used to obtain the recording result of the indicator according to the relevant data of the indicator when the target service request ends the call to the microservice program.

[0018] In a third aspect, an embodiment of the present specification provides an electronic device, the electronic device comprising: a processor, and a memory arranged to store computer executable instructions, when the executable instructions are executed, the processor can: In the case of obtaining a request for link tracking of a target service request of a target user, determining a target tracking identifier corresponding to the target service request from a pre-stored mapping relationship between service requests and tracking identifiers; Determine, from the pre-stored operation logs, a target operation log containing the target tracking identifier in the header, wherein the operation log is used to record relevant information about the microservice program being called; Based on the time and / or calling relationship of the target user calling various microservice programs in the target operation log, the calling sequence of each microservice program corresponding to the target service request is determined, so as to use the calling sequence as the result of the link tracking.

[0019] In a fourth aspect, an embodiment of this specification provides a storage medium for storing a computer program, wherein the computer program can be executed by a processor to implement the following process: In the case of obtaining a request for link tracking of a target service request of a target user, determining a target tracking identifier corresponding to the target service request from a pre-stored mapping relationship between service requests and tracking identifiers; Determine, from the pre-stored operation logs, a target operation log containing the target tracking identifier in the header, wherein the operation log is used to record relevant information about the microservice program being called; Based on the time and / or calling relationship of the target user calling various microservice programs in the target operation log, the calling sequence of each microservice program corresponding to the target service request is determined, so as to use the calling sequence as the result of the link tracking.

[0020] In a fifth aspect, an embodiment of this specification provides a computer program product, including a computer program, which implements the following process when executed by a processor: In the case of obtaining a request for link tracking of a target service request of a target user, determining a target tracking identifier corresponding to the target service request from a pre-stored mapping relationship between service requests and tracking identifiers; Determine, from the pre-stored operation logs, a target operation log containing the target tracking identifier in the header, wherein the operation log is used to record relevant information about the microservice program being called; Based on the time and / or calling relationship of the target user calling various microservice programs in the target operation log, the calling sequence of each microservice program corresponding to the target service request is determined, so as to use the calling sequence as the result of the link tracking.

[0021] In an embodiment of the present specification, after determining the target tracking identifier corresponding to the target service request from the stored mapping relationship, the target operation log carrying the target tracking identifier in the header is determined from the stored operation log, so as to determine the link tracking result according to the target operation log. This process combines the operation log and the link tracking to determine the link tracking result of the target service request based on the target tracking identifier set in the header, and associates multiple microservice operations through the target tracking identifier, so as to realize the rapid determination of the link tracking result and improve the efficiency of link tracking. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] In order to more clearly illustrate one or more embodiments of this specification or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in one or more embodiments of this specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0023] Figure 1 It is a flowchart of a link tracking method provided by an embodiment of this specification; Figure 2 It is a structural diagram of a link tracking device provided in an embodiment of this specification; Figure 3 It is a structural diagram of an electronic device provided in an embodiment of this specification. DETAILED DESCRIPTION

[0024] The following will be combined with the drawings in the embodiments of this specification to clearly and completely describe the technical solutions in the embodiments of this specification. Obviously, the described embodiments are part of the embodiments of this specification, not all of the embodiments. Based on the embodiments in this specification, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this document.

[0025] The terms "first", "second", etc. in the specification and claims of this document are used to distinguish similar objects, and are not 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 this specification can be implemented in an order other than those illustrated or described herein, and the objects distinguished by "first", "second", etc. are generally of the same type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims means at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.

[0026] The link tracking method and device, electronic device, and storage medium provided in the embodiments of this specification are described in detail below with reference to the accompanying drawings through specific embodiments and their application scenarios.

[0027] Figure 1 A link tracking method provided by an embodiment of the present invention is shown. The method can be executed by an electronic device, and the electronic device may include: a server and / or a terminal device, wherein the terminal device may be, for example, a vehicle-mounted terminal or a mobile phone terminal. In other words, the method can be executed by software or hardware installed in the aforementioned electronic device. The link tracking method is used to provide a microservice server, and includes the following steps: Step S102: when a request for link tracking of a target service request of a target user is obtained, a target tracking identifier corresponding to the target service request is determined from a pre-stored mapping relationship between service requests and tracking identifiers.

[0028] Among them, the microservice architecture is a distributed system architecture that aims to split an application into multiple smaller, loosely coupled, and autonomous services, each of which can be independently developed, deployed, and expanded, thereby achieving faster, more flexible, and more reliable software development and delivery. A service request can be a request for a service provided by the microservice architecture. A service request can be a consumer service request, an information query request, a scheduling request, etc. Different service requests may use different microservices. This specification does not specifically limit the type of service request, which can be determined based on actual conditions.

[0029] When a user initiates a service request, multiple microservices in the microservice architecture are usually used, and these microservices will call each other and transfer data. For example, for a scheduling request based on a plan, three microservices may be involved: inbound, inventory, and outbound. Link tracking of microservices usually refers to tracking the flow of a service request in the microservice system. The object of link tracking is the target service request, and the user who initiates the target service request is the target user.

[0030] The tracking identifier is a unique identifier used to distinguish the links corresponding to each service request. When a user initiates a service request, the server generates a tracking identifier for the service request. In one implementation, before performing link tracking, the link tracking method includes: generating the target tracking identifier based on the target service request input by the target user; In the case of calling a microservice program based on the target service request, generating a target operation log corresponding to the called microservice program; A header including the target tracking identifier is added to the target operation log.

[0031] The target tracking identifier is the tracking identifier corresponding to the target service request. Specifically, when the server receives the target service request input by the target user, it will generate the target tracking identifier based on the target service request. To ensure the uniqueness of the tracking identifier, the UUID (Universally Unique Identifier) ​​algorithm can be used to generate the tracking identifier (including the target tracking identifier).

[0032] The operation log is a log used to record the relevant information of the microservice program being called. After each microservice program is called, the relevant information of the microservice program being called will be generated. The target operation log is the operation log corresponding to the target service request. In one implementation, when the microservice program is called based on the target service request, the target operation log corresponding to the called microservice program is generated, including: When a microservice program is called based on the target service request, a target operation log corresponding to the called microservice program is generated according to a preset log output item.

[0033] Specifically, the output items of the operation log can be specified in advance to generate an operation log that conforms to the output items. In the case of calling a microservice program based on a target service request, a target operation log can be generated based on the log output item. The log output item may include at least one or more of a business identifier, log content, operator, operator identifier, and operation content parameter. The log output item is not specifically limited in this specification and can be determined according to actual conditions.

[0034] The above process can provide operation logs in a unified format through preset log output items to facilitate the needs of business auditing, etc. On the one hand, there is no need to repeatedly develop and maintain related logic, which can save the development time of microservice business developers for such scenarios. On the other hand, by using standardized operation logs, it can provide a reliable data foundation for business auditing, etc. when unified analysis and identification are performed based on needs.

[0035] In one example, a Java annotation class OperateLog may be defined and implemented, and the OperateLog may include the above-mentioned log output items for generating operation logs, so that users only need to add Java annotations to automatically generate operation logs. After generating an operation log including preset log output items, in order to improve the convenience of using the target tracking identifier, a header may be set for the operation log, and a target tracking identifier may be added to the header.

[0036] Since the microservice architecture can be set up on at least one server, in addition to the server that generates the tracking identifier, each server that sets up the microservice architecture can save the mapping relationship between the service request and the tracking identifier for query. In the case of obtaining a request for link tracking of a target service request, the target mapping relationship corresponding to the target service request can be determined from the multiple sets of mapping relationships saved by the server, and then the target identifier corresponding to the target service request can be determined from the target mapping relationship.

[0037] Step S104: determining a target operation log having a header containing the target tracking identifier from pre-stored operation logs.

[0038] Step S106: Based on the time and / or calling relationship of the target user calling various microservice programs in the target operation log, determine the calling sequence of each microservice program corresponding to the target service request, and use the calling sequence as the result of the link tracking.

[0039] Among them, the call sequence is a sequence that reflects the order in which microservices are called, and the arrangement order of microservices in the call sequence reflects the order in which microservice programs are called based on target service requests. The acquisition process of the call sequence corresponding to the target service request can be obtained based on the target operation log. Specifically, the target operation log containing the target tracking identifier in the header can be determined from the operation log pre-stored on the server side of the microservice architecture, and then the call sequence can be determined using the information contained in the target operation log.

[0040] The time information and calling relationship of the microservice program in the target operation log reflect to a certain extent the order in which the microservice program is called. In one example, the time information and / or calling relationship of the microservice program can be obtained from the target operation log, and then the calling sequence of the target service request can be determined based on the obtained information, and the calling sequence is used as the result of link tracking and fed back to the user who initiated the link tracking request.

[0041] In an embodiment of the present specification, after determining the target tracking identifier corresponding to the target service request from the stored mapping relationship, the target operation log carrying the target tracking identifier in the header is determined from the stored operation log, so as to determine the link tracking result according to the target operation log. This process combines the operation log and the link tracking to determine the link tracking result of the target service request based on the target tracking identifier set in the header, and associates multiple microservice operations through the target tracking identifier, so as to realize the rapid determination of the link tracking result and improve the efficiency of link tracking.

[0042] In one implementation, the log output items include comparison data, and the link tracking method further includes: In the case of calling a microservice program based on the target service request, obtaining a business operation performed by the target user in the microservice program and data related to the business operation; Using a preset comparison function, a comparison operation is performed on the data before and after the business operation to obtain comparison data.

[0043] The data involved in the business operation may be business parameters, business data, etc. For example, the data involved in the business operation may be permission data. When a user uses a microservice program to perform a business operation, the user or the system may modify the above data (for example, modify permission data, etc.). By comparing the data involved in the above business operation through a comparison function, comparison data can be obtained. The comparison data can be used to remind the target user to pay attention to the change of data.

[0044] In one example, the comparison function may be a diff function, and the input parameter of the diff function is two or more variable names to be compared in the business operation. Specifically, when the data involved in the business operation is a business parameter, the two input parameters of the diff function (the two parameter data before and after the business operation) may be serialized into JSON and stored. After the business operation is completed, the diff function may be used to compare the two input parameters to obtain the changes before and after the data involved in the business operation.

[0045] The comparison data obtained in the above process can be used for auditing, troubleshooting, etc. The comparison operation of the comparison function can improve work efficiency.

[0046] Generally, logs only support writing into a database or only support printing into a text file. In one implementation, after determining the target operation log, the method further includes: Determine a target output interface corresponding to the target operation log from a plurality of preset output interfaces of the operation log, wherein the output interface includes at least one or more of a message queue task interface, a database write interface, and a log print interface; The target operation log is output through the target output interface.

[0047] The message queue task interface is used to send the operation log to users who are interested in the operation of the microservice program through the message queue, the database write interface is used to write the operation log to the database, and the log printing interface is used to record the operation information in text form. Specifically, the log printing interface can be implemented through SLF4J (Simple LoggingFacade for Java).

[0048] After determining the target operation log, the user can select the desired target output interface from the preset multiple output interfaces and output the target operation log through the target output interface. By setting multiple output interfaces, the user can freely switch between multiple output methods, which is highly easy to use and flexible.

[0049] In one implementation, when the target output interface is a log printing interface, outputting the target operation log through the target output interface includes: Creating a thread pool for printing the target operation log; The target operation log is submitted to the thread pool through the log printing interface to perform multi-threaded asynchronous printing of the target operation log.

[0050] Log printing is an important and common requirement, but when performing high-concurrency processing, using a simple log printing method may affect performance.

[0051] In one example, a thread pool can be used to asynchronously process log printing. Specifically, the process of using a thread pool to process log printing can be to first create a thread pool, then submit the target operation log to the thread pool for log printing through the log printing interface, and after printing is completed, the thread pool can be closed to release resources.

[0052] In the above process, multi-threaded asynchronous printing of the target operation log is achieved through the thread pool, which can improve the efficiency of log printing and will not hinder the execution of specific business codes of the log printing user.

[0053] Aspect-Oriented Programming (AOP) is a technology that uses precompilation to dynamically proxy program functions during runtime. This technology extracts common functions from different objects and calls them through pointcut triggering. AOP can be used to implement log monitoring, transaction management, permission control, etc. When a microservice program is running, AOP can match the target method that needs to be cut in, that is, the backend data interface to be called, according to the defined pointcut, and generate aspects through dynamic proxy. In one implementation, the microservice program includes multiple microservice methods, and the method also includes: Obtaining a target microservice method corresponding to the indicator to be recorded from the plurality of microservice methods; Inserting the AOP plug-in into the point of entry of the microservice method, and when the microservice method is accessed, the AOP plug-in records the relevant data of the indicator; When the target service request ends the call to the microservice program, a record result of the indicator is obtained according to relevant data of the indicator.

[0054] Among them, the indicators to be recorded can be indicators corresponding to the microservice methods that relevant users (such as auditors, security monitoring personnel, etc.) are interested in. The indicators can be the number of successful or recognized operations, the time taken to execute the operation, etc. Microservice methods include but are not limited to: adding, modifying, querying, deleting, and other operations.

[0055] Specifically, you can first determine the target microservice method corresponding to the indicator to be recorded from multiple microservice methods, so as to find the cut-off point (which can be an object, annotation, etc.) for the AOP plug-in to cut in. After determining the target microservice method, you can insert the AOP plug-in into the cut-off point of the microservice method through annotations to introduce the relevant functions of the AOP plug-in. The AOP plug-in can be called in the form of a cut-off trigger.

[0056] When the microservice method is accessed, the AOP plug-in will function to record the relevant data of the indicator to be recorded (number of operations, operation time, etc.). When the target service request ends the call to the microservice program, the record result of the indicator can be obtained based on the relevant recorded data and the user's requirements (such as requiring the record result to be a line graph, etc.). For example, the record result can be an operation trend graph, which makes it easy to discover sudden changes in operations.

[0057] The above process, by introducing AOP in the microservice program, realizes the function of non-invasively counting the relevant data of the indicators to be recorded, which helps to improve the statistical efficiency of the indicators of the microservice method, facilitates the monitoring and alarm of business operations, and helps to understand the operation status of key operations.

[0058] It should be noted that the link tracking method provided in the embodiments of this specification can be executed by a link tracking device or a control module in the link tracking device for executing the link tracking method. In the embodiments of this specification, the link tracking device executing the link tracking method is taken as an example to illustrate the link tracking device provided in the embodiments of this specification.

[0059] Figure 2 FIG. 1 is a schematic diagram of the structure of a link tracking device according to an embodiment of the present invention. Figure 2 As shown, the link tracking device 200 is used to provide a microservice server, including: The tracking identifier module 210 is used to determine the target tracking identifier corresponding to the target service request from the pre-stored mapping relationship between the service request and the tracking identifier when obtaining a request for link tracking of the target service request of the target user; An operation log module 220 is used to determine a target operation log having a header containing the target tracking identifier from pre-stored operation logs, wherein the operation log is used to record relevant information about the microservice program being called; The link tracking module 230 is used to determine the calling sequence of each microservice program corresponding to the target service request based on the time and / or calling relationship of the target user calling various microservice programs in the target operation log, so as to use the calling sequence as the result of the link tracking.

[0060] In one embodiment, the link tracking device 200 includes: An identifier generation module, used to generate the target tracking identifier based on the target service request input by the target user before link tracking is performed; A log generation module, used to generate a target operation log corresponding to the called microservice program when the microservice program is called based on the target service request; The header adding module is used to add a header including the target tracking identifier to the target operation log.

[0061] In one embodiment, the log generation module includes: The output item unit is used to generate a target operation log corresponding to the called microservice program according to a preset log output item when the microservice program is called based on the target service request, wherein the log output item includes at least one or more of a business identifier, a log content, an operator, an operator identifier, and an operation content parameter.

[0062] In one embodiment, the log output item includes comparison data, and the link tracking device 200 further includes: A comparison data module, used to obtain the business operations performed by the target user in the microservice program and the data involved in the business operations when the microservice program is called based on the target service request; The comparison module is used to use a preset comparison function to compare the data before and after the business operation to obtain comparison data.

[0063] In one embodiment, the link tracking device 200 further includes: An interface selection module, used to determine, after determining the target operation log, a target output interface corresponding to the target operation log from a plurality of preset output interfaces of the operation log, wherein the output interface at least includes one or more of a message queue task interface, a database write interface and a log print interface; The log output module is used to output the target operation log through the target output interface.

[0064] In one embodiment, the log output module includes: A thread pool unit, used for creating a thread pool for printing the target operation log when the target output interface is a log printing interface; A submitting unit is used to submit the target operation log to the thread pool through the log printing interface to perform multi-threaded asynchronous printing of the target operation log.

[0065] In one embodiment, the microservice program includes a plurality of microservice methods, and the link tracking device 200 further includes: A microservice method module, used to obtain a target microservice method corresponding to the indicator to be recorded from the plurality of microservice methods; A data recording module, used to insert the AOP plug-in into the cut-off point of the microservice method, and when the microservice method is accessed, the AOP plug-in records the relevant data of the indicator; The recording result module is used to obtain the recording result of the indicator according to the relevant data of the indicator when the target service request ends the call to the microservice program.

[0066] In an embodiment of the present specification, after determining the target tracking identifier corresponding to the target service request from the stored mapping relationship, the target operation log carrying the target tracking identifier in the header is determined from the stored operation log, so as to determine the link tracking result according to the target operation log. This process combines the operation log and the link tracking to determine the link tracking result of the target service request based on the target tracking identifier set in the header, and associates multiple microservice operations through the target tracking identifier, so as to realize the rapid determination of the link tracking result and improve the efficiency of link tracking.

[0067] It should be noted that the embodiments of the link tracking device in this specification and the embodiments of the link tracking method in this specification are based on the same inventive concept, so the specific implementation of this embodiment can refer to the implementation of the corresponding link tracking method mentioned above, and the repeated parts will not be repeated.

[0068] Each module in the above-mentioned link tracking device can be implemented in whole or in part by software, hardware and a combination thereof. Each of the above-mentioned modules can be embedded in or independent of the processor in the terminal device or the processor on the server in the form of hardware, or can be stored in the memory in the terminal device or the memory on the server in the form of software, so that the processor can call and execute the corresponding operations of each of the above modules.

[0069] Furthermore, corresponding to the link tracing method described above, based on the same technical concept, one or more embodiments of this specification also provide an electronic device, which is used to execute the link tracing method described above. Figure 3 A schematic diagram of the structure of an electronic device provided for one or more embodiments of this specification.

[0070] Based on the same idea, one or more embodiments of this specification also provide an electronic device, such as Figure 3 As shown. The electronic device may have relatively large differences due to different configurations or performances, and may include one or more processors 301 and memory 302, and the memory 302 may store one or more storage applications or data. Among them, the memory 302 may be a temporary storage or a permanent storage. The application stored in the memory 302 may include one or more modules (not shown in the figure), and each module may include a series of computer executable instructions in the electronic device. Furthermore, the processor 301 can be configured to communicate with the memory 302 to execute a series of computer executable instructions in the memory 302 on the electronic device. The electronic device may also include one or more power supplies 303, one or more wired or wireless network interfaces 304, one or more input and output interfaces 305, and one or more keyboards 306.

[0071] In a specific embodiment, the electronic device includes a memory and one or more programs, wherein the one or more programs are stored in the memory, and the one or more programs may include one or more modules, and each module may include a series of computer executable instructions for the electronic device, and the one or more programs configured to be executed by one or more processors include the following computer executable instructions: In the case of obtaining a request for link tracking of a target service request of a target user, determining a target tracking identifier corresponding to the target service request from a pre-stored mapping relationship between service requests and tracking identifiers; Determine, from the pre-stored operation logs, a target operation log containing the target tracking identifier in the header, wherein the operation log is used to record relevant information about the microservice program being called; Based on the time and / or calling relationship of the target user calling various microservice programs in the target operation log, the calling sequence of each microservice program corresponding to the target service request is determined, so as to use the calling sequence as the result of the link tracking.

[0072] In an embodiment of the present specification, after determining the target tracking identifier corresponding to the target service request from the stored mapping relationship, the target operation log carrying the target tracking identifier in the header is determined from the stored operation log, so as to determine the link tracking result according to the target operation log. This process combines the operation log and the link tracking to determine the link tracking result of the target service request based on the target tracking identifier set in the header, and associates multiple microservice operations through the target tracking identifier, so as to realize the rapid determination of the link tracking result and improve the efficiency of link tracking.

[0073] It should be noted that the embodiments of the electronic device in this specification and the embodiments of the link tracking method in this specification are based on the same inventive concept, so the specific implementation of this embodiment can refer to the implementation of the corresponding link tracking method mentioned above, and the repeated parts will not be repeated.

[0074] Furthermore, corresponding to the link tracking method described above, based on the same technical concept, one or more embodiments of this specification further provide a storage medium for storing computer executable instructions. In a specific embodiment, the storage medium may be a USB flash drive, an optical disk, a hard disk, etc. When the computer executable instructions stored in the storage medium are executed by the processor, the following process can be implemented: In the case of obtaining a request for link tracking of a target service request of a target user, determining a target tracking identifier corresponding to the target service request from a pre-stored mapping relationship between service requests and tracking identifiers; Determine, from the pre-stored operation logs, a target operation log containing the target tracking identifier in the header, wherein the operation log is used to record relevant information about the microservice program being called; Based on the time and / or calling relationship of the target user calling various microservice programs in the target operation log, the calling sequence of each microservice program corresponding to the target service request is determined, so as to use the calling sequence as the result of the link tracking.

[0075] In an embodiment of the present specification, after determining the target tracking identifier corresponding to the target service request from the stored mapping relationship, the target operation log carrying the target tracking identifier in the header is determined from the stored operation log, so as to determine the link tracking result according to the target operation log. This process combines the operation log and the link tracking to determine the link tracking result of the target service request based on the target tracking identifier set in the header, and associates multiple microservice operations through the target tracking identifier, so as to realize the rapid determination of the link tracking result and improve the efficiency of link tracking.

[0076] It should be noted that the embodiment of the storage medium in this specification and the method of link tracking in this specification are based on the same inventive concept, so the specific implementation of this embodiment can refer to the implementation of the corresponding link tracking method mentioned above, and the repeated parts will not be repeated.

[0077] Furthermore, corresponding to the link tracking method described above, based on the same technical concept, one or more embodiments of this specification further provide a computer program product, the computer program product includes a computer program, and when the computer program is executed by a processor, the following process can be implemented: In the case of obtaining a request for link tracking of a target service request of a target user, determining a target tracking identifier corresponding to the target service request from a pre-stored mapping relationship between service requests and tracking identifiers; Determine, from the pre-stored operation logs, a target operation log containing the target tracking identifier in the header, wherein the operation log is used to record relevant information about the microservice program being called; Based on the time and / or calling relationship of the target user calling various microservice programs in the target operation log, the calling sequence of each microservice program corresponding to the target service request is determined, so as to use the calling sequence as the result of the link tracking.

[0078] In an embodiment of the present specification, after determining the target tracking identifier corresponding to the target service request from the stored mapping relationship, the target operation log carrying the target tracking identifier in the header is determined from the stored operation log, so as to determine the link tracking result according to the target operation log. This process combines the operation log and the link tracking to determine the link tracking result of the target service request based on the target tracking identifier set in the header, and associates multiple microservice operations through the target tracking identifier, so as to realize the rapid determination of the link tracking result and improve the efficiency of link tracking.

[0079] It should be noted that the embodiment of the computer program product in this specification and the embodiment of the link tracking method in this specification are based on the same inventive concept, so the specific implementation of this embodiment can refer to the implementation of the corresponding link tracking method mentioned above, and the repeated parts will not be repeated.

[0080] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0081] In the 1990s, it was very clear whether the improvement of a technology was hardware improvement (for example, improvement of the circuit structure of diodes, transistors, switches, etc.) or software improvement (improvement of the method flow). However, with the development of technology, many improvements of the method flow today can be regarded as direct improvements of the hardware circuit structure. Designers almost always obtain the corresponding hardware circuit structure by programming the improved method flow into the hardware circuit. Therefore, it cannot be said that the improvement of a method flow cannot be implemented with a hardware entity module. For example, a programmable logic device (PLD) (such as a field programmable gate array (FPGA)) is such an integrated circuit whose logical function is determined by the user's programming of the device. Designers can "integrate" a digital system on a PLD by programming themselves, without having to ask chip manufacturers to design and make dedicated integrated circuit chips. Moreover, nowadays, instead of manually making integrated circuit chips, this kind of programming is mostly implemented by "logic compiler" software, which is similar to the software compiler used when developing and writing programs, and the original code before compilation must also be written in a specific programming language, which is called hardware description language (HDL). There is not only one kind of HDL, but many kinds, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. The most commonly used ones are VHDL (Very-High-Speed ​​Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should also know that it is only necessary to program the method flow slightly in the above-mentioned hardware description languages ​​and program it into the integrated circuit, and then it is easy to obtain the hardware circuit that implements the logic method flow.

[0082] The controller may be implemented in any suitable manner, for example, the controller may take the form of a microprocessor or processor and a computer-readable medium storing a computer-readable program code (e.g., software or firmware) executable by the (micro)processor, a logic gate, a switch, an application-specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller, examples of which include but are not limited to the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320, and the memory controller may also be implemented as part of the control logic of the memory. It is also known to those skilled in the art that, in addition to implementing the controller in a purely computer-readable program code manner, the controller may be implemented in the form of a logic gate, a switch, an application-specific integrated circuit, a programmable logic controller, and an embedded microcontroller by logically programming the method steps. Therefore, such a controller may be considered as a hardware component, and the devices for implementing various functions included therein may also be considered as structures within the hardware component. Or even, the devices for implementing various functions may be considered as both software modules for implementing the method and structures within the hardware component.

[0083] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.

[0084] For the convenience of description, the above devices are described in terms of functions and are divided into various units. Of course, when implementing the embodiments of this specification, the functions of each unit can be implemented in the same or multiple software and / or hardware.

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

[0086] This specification is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of this specification. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0087] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0088] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0089] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0090] Memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.

[0091] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined in this article, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.

[0092] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0093] One or more embodiments of the present specification may 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. One or more embodiments of the present specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.

[0094] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0095] The above description is only an embodiment of this document and is not intended to limit this document. For those skilled in the art, this document may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of this document should be included in the scope of the claims of this document.

Claims

1. A link tracking method, characterized in that: The server side used to provide microservices includes: In the case of obtaining a request for link tracking of a target service request of a target user, determining a target tracking identifier corresponding to the target service request from a pre-stored mapping relationship between service requests and tracking identifiers; Determine, from the pre-stored operation logs, a target operation log containing the target tracking identifier in the header, wherein the operation log is used to record relevant information about the microservice program being called; Based on the time and / or calling relationship of the target user calling various microservice programs in the target operation log, the calling sequence of each microservice program corresponding to the target service request is determined, so as to use the calling sequence as the result of the link tracking.

2. The method according to claim 1, characterized in that Before performing link tracing, the method includes: generating the target tracking identifier based on the target service request input by the target user; In the case of calling a microservice program based on the target service request, generating a target operation log corresponding to the called microservice program; A header including the target tracking identifier is added to the target operation log.

3. The method according to claim 2, characterized in that In the case of calling a microservice program based on the target service request, generating a target operation log corresponding to the called microservice program includes: In the case of calling a microservice program based on the target service request, a target operation log corresponding to the called microservice program is generated according to a preset log output item, and the log output item includes at least one or more of a business identifier, a log content, an operator, an operator identifier, and an operation content parameter.

4. The method according to claim 3, characterized in that The log output item includes comparison data, and the method further includes: In the case of calling a microservice program based on the target service request, obtaining a business operation performed by the target user in the microservice program and data related to the business operation; Using a preset comparison function, a comparison operation is performed on the data before and after the business operation to obtain comparison data.

5. The method according to claim 1, characterized in that After determining the target operation log, the method further includes: Determine a target output interface corresponding to the target operation log from a plurality of preset output interfaces of the operation log, wherein the output interface includes at least one or more of a message queue task interface, a database write interface, and a log print interface; The target operation log is output through the target output interface.

6. The method according to claim 5, characterized in that In the case where the target output interface is a log printing interface, outputting the target operation log through the target output interface includes: Creating a thread pool for printing the target operation log; The target operation log is submitted to the thread pool through the log printing interface to perform multi-threaded asynchronous printing of the target operation log.

7. The method according to claim 1, characterized in that The microservice program includes a plurality of microservice methods, and the method further includes: Obtaining a target microservice method corresponding to the indicator to be recorded from the plurality of microservice methods; Inserting the AOP plug-in into the point of entry of the microservice method, and when the microservice method is accessed, the AOP plug-in records the relevant data of the indicator; When the target service request ends the call to the microservice program, a record result of the indicator is obtained according to relevant data of the indicator.

8. A link tracking device, characterized in that: The server side used to provide microservices includes: A tracking identifier module, configured to determine a target tracking identifier corresponding to the target service request from a pre-stored mapping relationship between service requests and tracking identifiers when obtaining a request for link tracking of a target service request of a target user; An operation log module, used to determine a target operation log containing the target tracking identifier in the header from a pre-stored operation log, wherein the operation log is used to record relevant information about the microservice program being called; The link tracking module is used to determine the calling sequence of each microservice program corresponding to the target service request based on the time and / or calling relationship of the target user calling various microservice programs in the target operation log, so as to use the calling sequence as the result of the link tracking.

9. An electronic device, characterized in that: include: processor; as well as A memory arranged to store computer executable instructions, the executable instructions being configured to be executed by the processor, the executable instructions comprising instructions for performing the steps in the method according to any one of claims 1 to 7.

10. A storage medium, characterized in that: The storage medium is used to store computer-executable instructions, and the executable instructions enable a computer to execute the method according to any one of claims 1 to 7.