CN112416708A - Asynchronous call link monitoring method and system - Google Patents

Asynchronous call link monitoring method and system Download PDF

Info

Publication number
CN112416708A
CN112416708A CN202011284470.7A CN202011284470A CN112416708A CN 112416708 A CN112416708 A CN 112416708A CN 202011284470 A CN202011284470 A CN 202011284470A CN 112416708 A CN112416708 A CN 112416708A
Authority
CN
China
Prior art keywords
link
monitoring
service request
context
link context
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202011284470.7A
Other languages
Chinese (zh)
Other versions
CN112416708B (en
Inventor
刘慕雨
王泽洋
黄镜澄
张锦涛
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Industrial and Commercial Bank of China Ltd ICBC
Original Assignee
Industrial and Commercial Bank of China Ltd ICBC
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Industrial and Commercial Bank of China Ltd ICBC filed Critical Industrial and Commercial Bank of China Ltd ICBC
Priority to CN202011284470.7A priority Critical patent/CN112416708B/en
Publication of CN112416708A publication Critical patent/CN112416708A/en
Application granted granted Critical
Publication of CN112416708B publication Critical patent/CN112416708B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3003Monitoring arrangements specially adapted to the computing system or computing system component being monitored
    • G06F11/3006Monitoring arrangements specially adapted to the computing system or computing system component being monitored where the computing system is distributed, e.g. networked systems, clusters, multiprocessor systems

Abstract

The invention provides a method and a system for monitoring an asynchronous call link, which are applied to the technical field of cloud computing. The asynchronous call link monitoring method comprises the following steps: receiving a service request, and generating a link context according to the service request; wherein the link context includes a field; storing the link context to an external distributed storage; processing the service request and updating the field according to the current thread of the service request; acquiring a link context from the distributed storage device according to the updated field; and determining a monitoring index according to the link context and the service request processing result. The invention can achieve the purpose of monitoring the asynchronous call link.

Description

Asynchronous call link monitoring method and system
Technical Field
The invention relates to the technical field of cloud computing, in particular to a method and a system for monitoring an asynchronous call link.
Background
With the maturity of a distributed architecture, a large number of enterprise-level applications adopt distributed and cloud computing technologies, nodes running in enterprise production are often thousands of, calling relations among different types of nodes are complicated and intricate, the nodes are often cross-application, cross-team and cross-park, once a certain link is wrong, problems of development and operation and maintenance personnel positioning are very difficult, troubleshooting and analysis are often required through massive discrete logs, and efficiency is low. Due to the adoption of the distributed tracking technology, research and development and operation and maintenance personnel can better master the calling condition between the nodes, the problems on the line can be more efficiently and conveniently solved, and the possibility is provided for full-link monitoring.
The monitoring object of the distributed tracking technology is each service request (or called transaction or network call), and the cross-process, cross-node and cross-network transaction monitoring is realized by tracking the flow direction of the service request, so that the monitoring is also called full link monitoring. According to the latest full link monitoring standard (opentraffic), the principle of the distributed tracking technology is to mark a service request by generating an ID (i.e. TRACEID) at the entry node of the service request, and the TRACEID is transmitted through the whole call link, so that the distributed nodes are connected in series. Each time the network is invoked, a stage of the link, or some step of the service request chain, is marked by generating a span id. The service request is sent and received in a stage (S PAN), so the SPANID is also transmitted with the network protocol stack in the call. In addition, since the links are connected in series, it is necessary to know the SPANID of the previous stage, i.e., PARENTSPANID, PARENTSPANID, which is also required to be transmitted through the network protocol stack. In addition, according to opentraung standard, whether to collect flag and custom field, these two fields are also transmitted. Therefore, the whole link can be connected in series, the problem of the serial connection of the links is solved, and the calling condition of the whole link can be monitored. The aforementioned five fields to be transparently transferred, and the meta information (such as network information and interface information) of the network call are collectively referred to as a link context. With the context, the index can be correlated to perform monitoring analysis, for example, the sending time point and the receiving time point of the service request are recorded, and the response time of one service request can be calculated by subtracting. The sending point of the service request is also maintained in the link context. By averaging the response time of an interface at the server, the average response time of the interface can be monitored.
The distributed tracking technique principle described above is preferably implemented under synchronous service requests, because for a process, a synchronous service request is completed in one thread at a time, and the link context can be stored in the local memory of the thread. Taking a network call as an example, after a caller generates a field to be transparently transmitted, the caller records meta information (i.e., characteristics) of the network call, such as network information (e.g., caller IP, receiver IP), interface information (e.g., interface name, interface version number, interface type (e.g., RPC, HTTP, etc.)) and current time. Then, the caller stores the link context in the local memory of the thread processing the current service request (isolated from the memory space of other threads, so that the link context is not influenced mutually), and then the caller initiates a network call and waits for the receiver to return response data. After receiving the response, the caller takes the context out of the memory, records the current time, and subtracts the sending time recorded in the memory from the current time to obtain the total time consumption of the call, thereby achieving the purpose of monitoring the time consumption of the service request.
For asynchronous calling, after the caller sends the service request, the receiver directly returns the service request without waiting for the response of the receiver. When the receiver responds back, it is likely that another thread is processing the response, and therefore a solution that uses thread local memory to store the link context is not feasible. Monitoring asynchronous calls is necessary in many scenarios. Therefore, how to monitor the asynchronous call becomes a problem to be solved urgently, and the industry has no good scheme.
Disclosure of Invention
The embodiments of the present invention mainly aim to provide a method and a system for monitoring an asynchronous call link, so as to achieve the purpose of monitoring the asynchronous call link.
In order to achieve the above object, an embodiment of the present invention provides an asynchronous call link monitoring method, including:
receiving a service request, and generating a link context according to the service request; wherein the link context includes a field;
storing the link context to an external distributed storage;
processing the service request and updating the field according to the current thread of the service request;
acquiring a link context from the distributed storage device according to the updated field;
and determining a monitoring index according to the link context and the service request processing result.
An embodiment of the present invention further provides an asynchronous call link monitoring system, including:
a receiving unit, configured to receive a service request and generate a link context according to the service request; wherein the link context includes a field;
a storage unit for storing the link context to an external distributed storage apparatus;
the updating unit is used for processing the service request and updating the field according to the current thread of the service request;
a link context acquiring unit, configured to acquire a link context from the distributed storage apparatus according to the updated field;
and the monitoring index determining unit is used for determining the monitoring index according to the link context and the service request processing result.
The embodiment of the invention also provides computer equipment which comprises a memory, a processor and a computer program which is stored on the memory and runs on the processor, wherein the step of asynchronously calling the link monitoring method is realized when the processor executes the computer program.
Embodiments of the present invention further provide a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the steps of the asynchronous call link monitoring method.
The asynchronous call link monitoring method and system of the embodiment of the invention firstly generate the link context according to the service request, then store the link context to the external distributed storage device, then update the field according to the current thread of the service request and acquire the link context from the distributed storage device according to the updated field to determine the monitoring index, thereby achieving the purpose of monitoring the asynchronous call link.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art that other drawings can be obtained based on these drawings without creative efforts.
FIG. 1 is a flow diagram of a method for asynchronous call link monitoring in an embodiment of the invention;
FIG. 2 is a block diagram of an asynchronous call link monitoring system in an embodiment of the invention;
FIG. 3 is a system architecture diagram of a monitoring system;
FIG. 4 is a flow chart of the operation of the monitoring system;
FIG. 5 is a block diagram of an asynchronous call initiator according to an embodiment of the present invention;
FIG. 6 is a block diagram of a distributed storage apparatus according to an embodiment of the present invention;
FIG. 7 is a block diagram of an asynchronous call receiving apparatus according to an embodiment of the present invention;
FIG. 8 is a block diagram of the structure of an asynchronous call response device in an embodiment of the present invention;
fig. 9 is a block diagram showing the configuration of a monitoring data analysis device according to an embodiment of the present invention;
fig. 10 is a block diagram of a computer device in the embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
As will be appreciated by one skilled in the art, embodiments of the present invention may be embodied as a system, apparatus, device, method, or computer program product. Accordingly, the present disclosure may be embodied in the form of: entirely hardware, entirely software (including firmware, resident software, micro-code, etc.), or a combination of hardware and software.
In view of the defects in the asynchronous call link tracking aspect in the prior art, embodiments of the present invention provide an asynchronous call link monitoring method based on a full link monitoring technology, in which a distributed storage device is introduced to store a link context to a remote end, and when an asynchronous response is received, the link context is obtained from the remote end, so that the purpose of monitoring an asynchronous call link can be achieved by performing analysis and calculation. The present invention will be described in detail below with reference to the accompanying drawings.
Fig. 1 is a flowchart of an asynchronous call link monitoring method in an embodiment of the present invention. Fig. 2 is a flow chart of a method for asynchronously invoking link monitoring in another embodiment of the present invention. As shown in fig. 1 and 2, the asynchronously called link monitoring method includes:
s101: and receiving a service request, and generating a link context according to the service request.
The link context includes fields and features, the fields include a link ID (traueid, ID for marking a call chain), a current stage ID (SPANID, ID for marking a call in a link this time), a previous stage ID (PARENTSPANID, ID for a previous stage call), a presence or absence flag (SAMPLED), and an additional custom field (EXTRA, nullable), and the features (meta information) include call origination time, network information (e.g., caller IP, receiver IP), and interface information (e.g., interface name, interface version number, interface type (e.g., RPC interface, HTTP interface, etc.)).
S102: the link context is stored to external distributed storage.
In specific implementation, the link context is stored to the distributed storage device in the following way:
generating a Key (Key) according to the link ID and the current stage ID, generating a Value (Value) according to the link context, generating a Key-Value pair according to the Key and the Value, and storing the Key-Value pair to the distributed storage device. The distributed storage device is a Key-Value type (Key Value pair) database, which may be a Redis.
There is a timeout for each key-value pair. When the overtime time is reached, the key value pair does not receive asynchronous response within the overtime time, at the moment, a cleaning mechanism of the distributed storage device is triggered, before cleaning, the key value pair is firstly notified to the monitoring data analysis device, and then the key value pair is deleted from the distributed storage device. The key-value pair in question is saved to the monitoring data analysis means for subsequent checking.
S103: the service request is processed and the field is updated according to the current thread of the service request.
In one embodiment, S103 includes: and updating the current stage ID and the previous stage ID in the field according to the current thread of the service request. The initial previous stage ID is a null value, and the updated previous stage ID is the current stage ID before updating.
S104: and acquiring the link context from the distributed storage device according to the updated field.
The distributed storage device deletes the corresponding key value pair after the link context is acquired by the distributed storage device.
In specific implementation, the link context is obtained from the distributed storage device according to the updated previous stage ID and the updated link ID (i.e. the Value corresponding to the previous stage ID + PARENTSPANID is obtained from the distributed storage device with the TRACEID + PARENTSPANID as the Key).
S105: and determining a monitoring index according to the link context and the service request processing result.
Wherein, the monitoring index comprises time consumption, success data and failure data of the service request
In one embodiment, S105 includes:
and determining the time consumed by the service request according to the link context acquisition time and the call initiation time after determining the link context acquisition time, and generating success data and failure data according to the service request processing result.
For example, subtracting the link context acquisition time and the call initiation time may result in a service request being time consuming. When the code field in the service request processing result is 0, the service request processing result is successful, the successful data is 1, and the failed data is 0; otherwise, the service request processing result is failure, the success data is 0, and the failure data is 1.
The execution subject of the asynchronous call link monitoring method shown in fig. 1 is an asynchronous call link monitoring system, which is applied to a host or a server; the distributed storage device, the monitoring data analysis device and the asynchronous call link monitoring system form an integral monitoring system together. As can be seen from the process shown in fig. 1, the asynchronous call link monitoring method according to the embodiment of the present invention first generates a link context according to a service request, then stores the link context in an external distributed storage device, and then updates a field according to a current thread of the service request and obtains the link context from the distributed storage device according to the updated field to determine a monitoring index, thereby achieving the purpose of monitoring an asynchronous call link.
In one embodiment, the asynchronously called link monitoring method further comprises: associating the monitoring indicator with the feature; and sending the monitoring indexes of the characteristics and the associated characteristics to an external monitoring data analysis device so that the monitoring data analysis device analyzes the data of the interface corresponding to the interface information according to the monitoring indexes.
During specific implementation, the monitoring data analysis device stores the monitoring indexes into a real-time analysis database, and stores the associated characteristics and key value pairs (overtime call details) reported by the distributed storage device into a distributed Search engine (Elastic Search), so that subsequent searching and detail checking are facilitated. And then the monitoring data analysis device performs aggregation calculation according to different index types so as to realize monitoring analysis on asynchronous call. For example, for an asynchronous interface corresponding to certain interface information, average calculation is performed on service request consumed time of a plurality of service requests corresponding to the asynchronous interface, and average response time of the asynchronous interface is calculated; and respectively carrying out accumulation calculation on the successful data and the failed data of the asynchronous interface, and dividing the result by unit time to calculate the successful data and the failed data of the asynchronous interface in the unit time.
To sum up, the specific process of the embodiment of the invention is as follows:
1. and receiving a service request, and generating a link context according to the service request.
2. And generating a key according to the link ID and the current stage ID in the link context, generating a value according to the link context, generating a key value pair according to the key and the value, and storing the key value pair to an external distributed storage device.
3. And processing the service request, and updating the current stage ID and the previous stage ID in the field according to the current thread of the service request.
4. And acquiring the link context from the distributed storage device according to the updated previous-stage ID and the updated link ID.
5. And determining the time consumed by the service request according to the link context acquisition time and the call initiation time after determining the link context acquisition time, and generating success data and failure data according to the service request processing result.
6. And after the monitoring index is associated with the characteristic, the monitoring index associated with the characteristic is sent to a monitoring data analysis device.
7. And the monitoring data analysis device analyzes the data of the interface corresponding to the interface information according to the monitoring index.
In summary, the asynchronous call link monitoring method provided in the embodiment of the present invention has the following beneficial effects:
1. the monitoring of the asynchronous call link is necessary in many scenes, and the invention provides a scheme for monitoring the asynchronous call link by introducing a remote distributed storage device.
2. The invention is compatible with the traditional synchronous call link tracking scheme, and the asynchronous call link and the synchronous link are connected in series by multiplexing the synchronously called link context to form real full link monitoring.
3. The invention relates the link and the index on the basis of link tracking, provides an index monitoring scheme aiming at asynchronous call in the link, and helps enterprises to better monitor the operation condition of the IT system by monitoring key indexes such as average response time, success data and failure data.
Based on the same inventive concept, the embodiment of the invention also provides an asynchronous call link monitoring system, and as the problem solving principle of the system is similar to the asynchronous call link monitoring method, the implementation of the system can refer to the implementation of the method, and repeated parts are not described again.
Fig. 2 is a block diagram of an asynchronous call link monitoring system according to an embodiment of the present invention. Fig. 3 is a system architecture diagram of a monitoring system. Fig. 4 is a flow chart of the operation of the monitoring system. Fig. 5 is a block diagram of an asynchronous call initiator according to an embodiment of the present invention. Fig. 6 is a block diagram of a distributed storage apparatus according to an embodiment of the present invention. Fig. 7 is a block diagram of the asynchronous call receiving apparatus according to the embodiment of the present invention. Fig. 8 is a block diagram of the asynchronous call response device in the embodiment of the present invention. Fig. 9 is a block diagram showing the structure of a monitoring data analysis device according to an embodiment of the present invention. As shown in fig. 2 to 9, the asynchronous call link monitoring system includes:
a receiving unit, configured to receive a service request and generate a link context according to the service request; wherein the link context includes a field;
a storage unit for storing the link context to an external distributed storage apparatus;
the updating unit is used for processing the service request and updating the field according to the current thread of the service request;
a link context acquiring unit, configured to acquire a link context from the distributed storage apparatus according to the updated field;
and the monitoring index determining unit is used for determining the monitoring index according to the link context and the service request processing result.
In one embodiment, the field includes a link ID and a current phase ID;
the storage unit is specifically configured to:
generating a key according to the link ID and the current stage ID, and generating a value according to the link context;
and generating a key value pair according to the key and the value, and storing the key value pair to an external distributed storage device.
In one embodiment, the update unit is specifically configured to:
and updating the current stage ID and the previous stage ID in the field according to the current thread of the service request.
In one embodiment, the link context obtaining unit is specifically configured to:
and acquiring the link context from the distributed storage device according to the updated previous-stage ID and the updated link ID.
In one embodiment, the link context further includes a characteristic, the characteristic includes call initiation time, and the monitoring index includes service request time consumption, success data and failure data;
the monitoring index determining unit is specifically configured to:
determining link context acquisition time;
determining the time consumed by the service request according to the link context acquisition time and the call initiation time;
and generating success data and failure data according to the service request processing result.
In one embodiment, the features further comprise interface information;
the asynchronous call link monitoring system further comprises:
an association unit for associating the monitoring index with the feature;
and the sending unit is used for sending the monitoring indexes of the characteristics and the associated characteristics to an external monitoring data analysis device so that the monitoring data analysis device can analyze the data of the interface corresponding to the interface information according to the monitoring indexes.
As shown in fig. 3 to 9, in practical applications, the asynchronous call link monitoring system includes an asynchronous call initiating device, an asynchronous call receiving device, and an asynchronous call responding device. The asynchronous call initiating device is connected with the distributed storage device; the asynchronous call initiating device is connected with the asynchronous call receiving device; the distributed storage device is connected with the asynchronous call response device; the asynchronous call receiving device is connected with the asynchronous call response device, the asynchronous call response device is connected with the monitoring data analysis device, and the distributed storage device is connected with the monitoring data analysis device.
The asynchronous call initiating device is used for initiating asynchronous calls, and generating context on a link before initiating calls and storing the context to the distributed storage device. As shown in fig. 5, the asynchronous call initiator includes: context generating unit, context memory cell and call initiation unit, wherein:
the context generating unit includes a receiving unit, configured to generate a link context, including fields traueid (ID of a call chain is marked), SPANID (ID of a call in a link is marked), PARENTSPANID (ID of a call in a previous stage), SAMPLED (flag of whether to acquire a sample), and EXTRA (additional custom field, which may be null) that need to be passed through to a next node (asynchronous call receiving apparatus). The method also includes meta information (i.e. characteristics) of the call, which mainly includes network information (such as caller IP and receiver IP), interface information (such as interface name, interface version number, interface type (such as RPC interface, HTTP interface, etc.)) and current call initiation time. These feature information associated with this call are referred to as the link context.
The context storage unit comprises a storage unit for storing the link context to a remote distributed storage device, i.e. a Key-Value type (Key Value pair) database. Here, taking a K-V type database Redis commonly used in the industry as an example, the TRACEID + SPANID is used as a Key, the link context is stored as Value to the distributed storage device, and a timeout time is provided for each Key-Value pair.
The call initiating unit initiates a network call, and simultaneously transmits five fields (TRACEID, SPANID, PARENTSPANID, SAMPLED and EXTRA) needing to be transmitted through to the next node, namely the asynchronous call receiving device through the network protocol. The protocol stack transparent transmission is to store five fields in a HEADER (HEADER) of the HTTP protocol for the HTTP service request to be transmitted; for RPC service requests, the transfer across the network is kept in RPC CONTEXT. Due to the asynchronous call, the asynchronous call initiating device does not need to wait for an asynchronous response (namely a service request processing result), and directly returns a call initiating success notice.
The distributed storage is a Key-Value type (Key-Value pair) distributed storage, each Key-Value pair representing a link context. As shown in fig. 6, the distributed storage apparatus includes a storage unit, a reading unit, and a cleaning unit, wherein:
the storage unit stores the key value pairs reported by the context storage unit, and each key value pair has overtime.
The reading unit acquires the VALUE (namely the link context) according to the Key, and deletes the Key VALUE pair after the Key VALUE pair is successfully acquired.
And the cleaning unit triggers a cleaning mechanism after reaching the overtime, notifies the key value pair to the asynchronous call response device before cleaning, and deletes the key value pair from the storage unit. These in-doubt service requests, in-doubt key-value pairs, are stored to the monitoring data analysis means for subsequent verification.
The asynchronous call receiving device is used for receiving asynchronous calls, receiving and processing asynchronous service requests and notifying the asynchronous call responding device of results after the asynchronous call receiving device completes processing. As shown in fig. 7, the asynchronous call receiving apparatus includes a receiving unit and a response unit, wherein:
the receiving unit comprises an updating unit used for receiving asynchronous call and processing service request, and simultaneously taking out the transparently transmitted field from the protocol stack.
After the response unit processes the service request, the transparent field is continuously put into the protocol stack, and the asynchronous call response device is called to respond to the asynchronous service request.
And after receiving the asynchronous response, the asynchronous call response device acquires the link context from the distributed storage device according to the keywords in the response information, calculates indexes such as time consumption, success data and failure data of the service request and reports the calculated indexes to the monitoring data analysis device. As shown in fig. 8, the asynchronous call response device includes a response receiving unit, a context obtaining unit, a monitoring index calculating unit, and a monitoring index reporting unit. Wherein:
the response receiving unit receives the asynchronous response and acquires the five fields of the transparent transmission from the protocol stack.
The context obtaining unit comprises a link context obtaining unit, configured to obtain, according to the transparent field, a corresponding Value, that is, a link context, from the distributed storage apparatus with the traueid + PARENTSPANID as a Key.
The monitoring index calculation unit comprises a monitoring index determination unit and a monitoring index calculation unit, wherein the monitoring index determination unit is used for determining the acquisition time of the link context and subtracting the call initiation time of the link context to obtain the service request time consumption of the asynchronous service request; and determining whether the asynchronous call is successful or not according to the response data acquired by the response receiving unit, wherein the successful data is 1 if the asynchronous call is successful, the failed data is 0, the successful data is 0 if the asynchronous call is failed, and the failed data is 1.
The monitoring index reporting unit comprises a correlation unit and a sending unit and is used for reporting the calculated characteristics of the index correlation service request to the monitoring data analysis device for monitoring analysis.
The monitoring data analysis device is used for receiving the monitoring data and carrying out aggregation calculation according to different index types so as to facilitate subsequent analysis. As shown in fig. 9, the monitoring data analysis apparatus includes a receiving unit and an aggregation calculation unit, in which:
the receiving unit receives the monitoring index reported by the asynchronous call responding device and stores the monitoring index into a real-time analysis database, and stores the associated characteristics and the key value pair (overtime call detail) reported by the distributed storage device into a distributed Search engine (Elastic Search), so that the follow-up searching and detail checking are facilitated.
An aggregation calculation unit: and performing aggregation calculation according to different index types to realize monitoring analysis of asynchronous call. For example, for an asynchronous interface corresponding to certain interface information, average calculation is performed on service request consumed time of a plurality of service requests corresponding to the asynchronous interface, and average response time of the asynchronous interface is calculated; and respectively carrying out accumulation calculation on the successful data and the failed data of the asynchronous interface, and dividing the result by unit time to calculate the successful data and the failed data of the asynchronous interface in the unit time.
To sum up, the asynchronous call link monitoring system according to the embodiment of the present invention first generates a link context according to the service request, then stores the link context to an external distributed storage device, then updates a field according to the current thread of the service request, and obtains the link context from the distributed storage device according to the updated field to determine a monitoring index, thereby achieving the purpose of monitoring the asynchronous call link.
The embodiment of the invention also provides a specific implementation mode of computer equipment, which can realize all the steps in the asynchronous call link monitoring method in the embodiment. Fig. 10 is a block diagram of a computer device in an embodiment of the present invention, and referring to fig. 10, the computer device specifically includes the following:
a processor (processor)1001 and a memory (memory) 1002.
The processor 1001 is configured to call the computer program in the memory 1002, and the processor implements all the steps of the asynchronous call link monitoring method in the above embodiment when executing the computer program, for example, the processor implements the following steps when executing the computer program:
receiving a service request, and generating a link context according to the service request; wherein the link context includes a field;
storing the link context to an external distributed storage;
processing the service request and updating the field according to the current thread of the service request;
acquiring a link context from the distributed storage device according to the updated field;
and determining a monitoring index according to the link context and the service request processing result.
To sum up, the computer device according to the embodiment of the present invention generates a link context according to the service request, stores the link context in an external distributed storage device, updates a field according to a current thread of the service request, and obtains the link context from the distributed storage device according to the updated field to determine a monitoring index, thereby achieving the purpose of monitoring the asynchronous call link.
An embodiment of the present invention further provides a computer-readable storage medium capable of implementing all steps in the asynchronous call link monitoring method in the foregoing embodiment, where the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the computer program implements all steps of the asynchronous call link monitoring method in the foregoing embodiment, for example, when the processor executes the computer program, the processor implements the following steps:
receiving a service request, and generating a link context according to the service request; wherein the link context includes a field;
storing the link context to an external distributed storage;
processing the service request and updating the field according to the current thread of the service request;
acquiring a link context from the distributed storage device according to the updated field;
and determining a monitoring index according to the link context and the service request processing result.
To sum up, the computer-readable storage medium according to the embodiment of the present invention first generates a link context according to the service request, then stores the link context in an external distributed storage device, and then updates a field according to the current thread of the service request and obtains the link context from the distributed storage device according to the updated field to determine the monitoring index, thereby achieving the purpose of monitoring the asynchronous call link.
The above-mentioned embodiments are intended to illustrate the objects, technical solutions and advantages of the present invention in further detail, and it should be understood that the above-mentioned embodiments are only exemplary embodiments of the present invention, and are not intended to limit the scope of the present invention, and any modifications, equivalent substitutions, improvements and the like made within the spirit and principle of the present invention should be included in the scope of the present invention.
Those of skill in the art will further appreciate that the various illustrative logical blocks, units, and steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both. To clearly illustrate the interchangeability of hardware and software, various illustrative components, elements, and steps have been described above generally in terms of their functionality. Whether such functionality is implemented as hardware or software depends upon the particular application and design requirements of the overall system. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present embodiments.
The various illustrative logical blocks, or elements, or devices described in connection with the embodiments disclosed herein may be implemented or performed with a general purpose processor, a digital signal processor, an Application Specific Integrated Circuit (ASIC), a field programmable gate array or other programmable logic device, discrete gate or transistor logic, discrete hardware components, or any combination thereof designed to perform the functions described herein. A general-purpose processor may be a microprocessor, but in the alternative, the processor may be any conventional processor, controller, microcontroller, or state machine. A processor may also be implemented as a combination of computing devices, e.g., a digital signal processor and a microprocessor, a plurality of microprocessors, one or more microprocessors in conjunction with a digital signal processor core, or any other similar configuration.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. A software module may be stored in RAM memory, flash memory, ROM memory, EPROM memory, EEPROM memory, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art. For example, a storage medium may be coupled to the processor such the processor can read information from, and write information to, the storage medium. In the alternative, the storage medium may be integral to the processor. The processor and the storage medium may reside in an ASIC, which may be located in a user terminal. In the alternative, the processor and the storage medium may reside in different components in a user terminal.
In one or more exemplary designs, the functions described above in connection with the embodiments of the invention may be implemented in hardware, software, firmware, or any combination of the three. If implemented in software, the functions may be stored on or transmitted over as one or more instructions or code on a computer-readable medium. Computer-readable media includes both computer storage media and communication media that facilitate transfer of a computer program from one place to another. Storage media may be any available media that can be accessed by a general purpose or special purpose computer. For example, such computer-readable media can include, but is not limited to, RAM, ROM, EEPROM, CD-ROM or other optical disk storage, magnetic disk storage or other magnetic storage devices, or any other medium which can be used to carry or store program code in the form of instructions or data structures and which can be read by a general-purpose or special-purpose computer, or a general-purpose or special-purpose processor. Additionally, any connection is properly termed a computer-readable medium, and, thus, is included if the software is transmitted from a website, server, or other remote source via a coaxial cable, fiber optic cable, twisted pair, Digital Subscriber Line (DSL), or wirelessly, e.g., infrared, radio, and microwave. Such discs (disk) and disks (disc) include compact disks, laser disks, optical disks, DVDs, floppy disks and blu-ray disks where disks usually reproduce data magnetically, while disks usually reproduce data optically with lasers. Combinations of the above may also be included in the computer-readable medium.

Claims (14)

1. An asynchronously called link monitoring method, comprising:
receiving a service request, and generating a link context according to the service request; wherein the link context comprises a field;
storing the link context to an external distributed storage;
processing the service request and updating the field according to the current thread of the service request;
acquiring a link context from the distributed storage device according to the updated field;
and determining a monitoring index according to the link context and the service request processing result.
2. The asynchronously called link monitoring method of claim 1, wherein the fields include a link ID and a current phase ID;
storing the link context to an external distributed storage device comprises:
generating a key according to the link ID and the current stage ID, and generating a value according to the link context;
and generating a key-value pair according to the key and the value, and storing the key-value pair to an external distributed storage device.
3. The method of claim 2, wherein updating the field according to the current thread of the service request comprises:
and updating the current stage ID and the last stage ID in the field according to the current thread of the service request.
4. The method of claim 3, wherein obtaining the link context from the distributed storage according to the updated field comprises:
and acquiring the link context from the distributed storage device according to the updated last-stage ID and the link ID.
5. The method of claim 1, wherein the link context further comprises a characteristic, wherein the characteristic comprises a call initiation time, and the monitoring metrics comprise a service request elapsed time, success data, and failure data;
determining a monitoring index according to the link context and the service request processing result comprises:
determining link context acquisition time;
determining the time consumed by the service request according to the link context acquisition time and the call initiation time;
and generating success data and failure data according to the service request processing result.
6. The asynchronously called link monitoring method of claim 5, wherein the characteristics further comprise interface information;
the asynchronous call link monitoring method further comprises:
associating the monitoring indicator with the feature;
and sending the monitoring indexes of the characteristics and the associated characteristics to an external monitoring data analysis device so that the monitoring data analysis device analyzes the data of the interface corresponding to the interface information according to the monitoring indexes.
7. An asynchronously called link monitor system, comprising:
a receiving unit, configured to receive a service request, and generate a link context according to the service request; wherein the link context comprises a field;
a storage unit configured to store the link context to an external distributed storage apparatus;
the updating unit is used for processing the service request and updating the field according to the current thread of the service request;
a link context acquiring unit, configured to acquire a link context from the distributed storage apparatus according to the updated field;
and the monitoring index determining unit is used for determining a monitoring index according to the link context and the service request processing result.
8. The asynchronously called link monitoring system of claim 7, wherein the fields include a link ID and a current phase ID;
the storage unit is specifically configured to:
generating a key according to the link ID and the current stage ID, and generating a value according to the link context;
and generating a key-value pair according to the key and the value, and storing the key-value pair to an external distributed storage device.
9. The system according to claim 8, wherein the update unit is specifically configured to:
and updating the current stage ID and the last stage ID in the field according to the current thread of the service request.
10. The system according to claim 9, wherein the link context obtaining unit is specifically configured to:
and acquiring the link context from the distributed storage device according to the updated last-stage ID and the link ID.
11. The asynchronously called link monitoring system of claim 7, wherein the link context further comprises characteristics, the characteristics comprising call initiation time, the monitoring metrics comprising service request elapsed time, success data, and failure data;
the monitoring index determining unit is specifically configured to:
determining link context acquisition time;
determining the time consumed by the service request according to the link context acquisition time and the call initiation time;
and generating success data and failure data according to the service request processing result.
12. The asynchronously called link monitor system of claim 11, wherein the features further comprise interface information;
the asynchronous call link monitoring system further comprises:
a correlation unit for correlating the monitoring indicator with the feature;
and the sending unit is used for sending the monitoring indexes of the characteristics and the associated characteristics to an external monitoring data analysis device so that the monitoring data analysis device analyzes the data of the interface corresponding to the interface information according to the monitoring indexes.
13. A computer device comprising a memory, a processor and a computer program stored on the memory and running on the processor, characterized in that the steps of the asynchronous call link monitoring method according to any of claims 1 to 6 are implemented when the computer program is executed by the processor.
14. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the asynchronous call link monitoring method of any one of claims 1 to 6.
CN202011284470.7A 2020-11-17 2020-11-17 Asynchronous call link monitoring method and system Active CN112416708B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011284470.7A CN112416708B (en) 2020-11-17 2020-11-17 Asynchronous call link monitoring method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011284470.7A CN112416708B (en) 2020-11-17 2020-11-17 Asynchronous call link monitoring method and system

Publications (2)

Publication Number Publication Date
CN112416708A true CN112416708A (en) 2021-02-26
CN112416708B CN112416708B (en) 2023-09-22

Family

ID=74831495

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011284470.7A Active CN112416708B (en) 2020-11-17 2020-11-17 Asynchronous call link monitoring method and system

Country Status (1)

Country Link
CN (1) CN112416708B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113485891A (en) * 2021-06-30 2021-10-08 中国民航信息网络股份有限公司 Service log monitoring method and device, storage medium and electronic equipment
CN113986955A (en) * 2021-11-01 2022-01-28 华青融天(北京)软件股份有限公司 Method and device for determining service chain, electronic equipment and medium
CN115834699A (en) * 2021-09-16 2023-03-21 广州汽车集团股份有限公司 Service call chain tracking implementation method and system

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2018120722A1 (en) * 2016-12-30 2018-07-05 上海壹账通金融科技有限公司 Asynchronous interface testing method, terminal, device, system, and storage medium
CN109560989A (en) * 2018-12-06 2019-04-02 深圳市递四方信息科技有限公司 A kind of link monitoring system
CN110806931A (en) * 2019-10-31 2020-02-18 上海依图网络科技有限公司 Method and device for realizing call link tracking of distributed service and electronic equipment

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2018120722A1 (en) * 2016-12-30 2018-07-05 上海壹账通金融科技有限公司 Asynchronous interface testing method, terminal, device, system, and storage medium
CN109560989A (en) * 2018-12-06 2019-04-02 深圳市递四方信息科技有限公司 A kind of link monitoring system
CN110806931A (en) * 2019-10-31 2020-02-18 上海依图网络科技有限公司 Method and device for realizing call link tracking of distributed service and electronic equipment

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113485891A (en) * 2021-06-30 2021-10-08 中国民航信息网络股份有限公司 Service log monitoring method and device, storage medium and electronic equipment
WO2023273529A1 (en) * 2021-06-30 2023-01-05 中国民航信息网络股份有限公司 Service log monitoring method and apparatus, and storage medium and electronic device
CN115834699A (en) * 2021-09-16 2023-03-21 广州汽车集团股份有限公司 Service call chain tracking implementation method and system
CN113986955A (en) * 2021-11-01 2022-01-28 华青融天(北京)软件股份有限公司 Method and device for determining service chain, electronic equipment and medium
CN113986955B (en) * 2021-11-01 2024-03-19 华青融天(北京)软件股份有限公司 Service chain determining method and device, electronic equipment and medium

Also Published As

Publication number Publication date
CN112416708B (en) 2023-09-22

Similar Documents

Publication Publication Date Title
CN110661659B (en) Alarm method, device and system and electronic equipment
CN107908494B (en) Abnormal event processing method and device, electronic equipment and storage medium
CN112416708A (en) Asynchronous call link monitoring method and system
CN106815254B (en) Data processing method and device
CN110647460B (en) Test resource management method and device and test client
US20220086075A1 (en) Collecting route-based traffic metrics in a service-oriented system
CN111078513A (en) Log processing method, device, equipment, storage medium and log alarm system
US10372572B1 (en) Prediction model testing framework
CN111913824B (en) Method for determining data link fault cause and related equipment
CN113760677A (en) Abnormal link analysis method, device, equipment and storage medium
CN114745295A (en) Data acquisition method, device, equipment and readable storage medium
CN110737655B (en) Method and device for reporting data
CN115220995A (en) Agent probe-based micro-service full-link analysis method
CN115705190A (en) Method and device for determining dependence degree
CN112491609A (en) System application architecture discovery method and system based on business service
CN109087107B (en) Real-time monitoring method and system based on distributed memory database and electronic equipment
CN116010388A (en) Data verification method, data acquisition server and data verification system
CN113783862B (en) Method and device for checking data in edge cloud cooperation process
KR101968575B1 (en) Method for automatic real-time analysis for bottleneck and apparatus for using the same
CN114579416A (en) Index determination method, device, server and medium
CN114092246A (en) Problem positioning method and device for financial transaction link
CN113254313A (en) Monitoring index abnormality detection method and device, electronic equipment and storage medium
US10296967B1 (en) System, method, and computer program for aggregating fallouts in an ordering system
CN112671822B (en) Service request processing method, device, storage medium, server and system
CN110430093B (en) Data processing method and device and computer readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant