Remote call depth recognition method, device, computer equipment and readable storage medium
By building a remote call link tree and counting its depth, the problem of low statistics on remote call depth in application systems in traditional technology is solved, and more efficient and accurate remote call depth recognition is achieved, improving the processing performance and response time of the application system.
Patent Information
- Application Number
- CN202010622759.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-06-30
- Publication Date
- 2025-05-06
- Estimated Expiration
- 2040-06-30
AI Technical Summary
In traditional technology, the statistical efficiency of remote call depth of application systems is low, which makes it difficult to improve the processing performance and efficiency of application systems when facing complex services.
By obtaining the access log of the application system, a remote call link tree is built using the full-link call tracking identifier, the next layer request tracking identifier and the previous layer request tracking identifier to calculate the depth of the link tree to identify the remote call depth of the application system.
It improves the efficiency and accuracy of deep recognition of remote calls in the application system, and can automatically dynamically identify the systems and methods of remote calls based on real-time access logs, helping developers control system complexity and improve response time.
Smart Images

Figure CN111767161B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of system development technology, and in particular to a method, device, computer equipment and computer-readable storage medium for remote calling depth recognition of an application system. Background Art
[0002] As application systems become more powerful, they are also becoming more complex. If the application system is still processed centrally by a computer device and the application business is processed through local calls, it will become increasingly difficult to deal with complex business. In order to improve the processing efficiency of the application system, the application system will be transformed into a service-oriented system, and the methods in the system will be transformed from the original local remote calls to remote calls, realizing the transformation from centralized control to decentralized processing. When facing complex business, the processing performance and efficiency of the application system can be improved. After the application system is transformed into a service-oriented system, the methods in the system are transformed from the original local remote calls to remote calls. Since remote calls communicate through the network, remote calls need to consume service resources such as communication, and the service resources consumed and the response time are greatly increased compared to local calls.
[0003] In order to improve the response time of the service-oriented system after transformation, it is necessary to control the complexity of the system, that is, to limit the remote call depth of the methods in the application system. In traditional technology, the remote call depth is counted according to the remote call function in the computer program. If the computer program is relatively complex, the statistics of the remote call depth of the application system will be very cumbersome and inefficient. Summary of the invention
[0004] The embodiments of the present application provide a method, apparatus, computer device and computer-readable storage medium for identifying the remote call depth of an application system, which can solve the problem of low efficiency in statistics of the remote call depth of the application system in traditional technologies.
[0005] In the first aspect, an embodiment of the present application provides a remote call depth identification method for an application system, the method comprising: obtaining an access log of the application system, the access log containing remote call content, the remote call content containing a full-link call tracking identifier corresponding to each remote call, a next-layer request tracking identifier for each layer in each remote call, and an upper-layer request tracking identifier for each layer in each remote call; constructing a remote call link tree corresponding to each remote call according to the full-link call tracking identifier, the next-layer request tracking identifier, and the upper-layer request tracking identifier to obtain a plurality of the remote call link trees; and counting the maximum path length from the root node to the leaf node in all the remote call link trees to obtain the remote call depth of the application system.
[0006] In the second aspect, an embodiment of the present application also provides a remote call depth identification device for an application system, including: an acquisition unit, used to acquire an access log of the application system, the access log containing remote call content, the remote call content containing a full-link call tracking identifier corresponding to each remote call, a next-layer request tracking identifier for each layer in each remote call, and an upper-layer request tracking identifier for each layer in each remote call; a construction unit, used to construct a remote call link tree corresponding to each remote call according to the full-link call tracking identifier, the next-layer request tracking identifier, and the upper-layer request tracking identifier to obtain a plurality of the remote call link trees; a statistical unit, used to count the maximum value of the path length from the root node to the leaf node in all the remote call link trees to obtain the remote call depth of the application system.
[0007] In a third aspect, an embodiment of the present application further provides a computer device, which includes a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the steps of remotely calling a deep recognition method of the application system are implemented.
[0008] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the processor executes the steps of remotely calling a deep recognition method of the application system.
[0009] The embodiment of the present application provides a method, device, computer equipment and computer-readable storage medium for remote call depth identification of an application system. When the embodiment of the present application implements the remote call depth identification of the application system, since three identifiers are set during the remote call process of the application system, after obtaining the access log containing the three identifiers, a remote call link tree is constructed according to the three identifiers, so that by counting the depth of the link tree, the association relationship between the interface remote calls involved in the remote call is more accurately identified to calculate the remote call depth of the application system, so that the system and method that the remote call passes through can be automatically identified according to the real-time access log. Compared with the traditional technology of counting the remote call depth according to the remote call function in the computer program, the efficiency and accuracy of the remote call depth identification corresponding to the remote call of the application system can be improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0011] Figure 1 A schematic diagram of a flow chart of a remote calling depth recognition method of an application system provided in an embodiment of the present application;
[0012] Figure 2 A schematic diagram of a specific remote call link tree in the remote call depth identification method of the application system provided in the embodiment of the present application;
[0013] Figure 3 A schematic diagram of a sub-process of a remote calling depth recognition method of an application system provided in an embodiment of the present application;
[0014] Figure 4 A schematic block diagram of a remote calling depth recognition device of an application system provided in an embodiment of the present application; and
[0015] Figure 5 A schematic block diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0016] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0017] It should be understood that when used in this specification and the appended claims, the terms "include" and "comprises" indicate the presence of described features, integers, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or combinations thereof.
[0018] See also Figure 1 , Figure 1 A flowchart of a remote call depth recognition method for an application system provided in an embodiment of the present application. Figure 1 As shown, the method includes the following steps S101-S103:
[0019] S101. Obtain the access log of the application system, wherein the access log contains remote call content, and the remote call content includes the full-link call tracking identifier corresponding to each remote call, the next-layer request tracking identifier of each layer in each remote call, and the previous-layer request tracking identifier of each layer in each remote call.
[0020] Among them, in the embodiment of the present application, three call path tracking identifiers are used to track the remote call. The three tracking identifiers, namely, the full-link call tracking identifier, the next-layer request tracking identifier of each layer in each remote call, and the previous-layer request tracking identifier of each layer in each remote call, are defined as follows:
[0021] 1) The full-link call tracing identifier, in English TraceId, is used to describe the global tracing ID of each remote call. It is the entry point of tracing. When the application system initiates a remote call request, it checks whether there is traceId in the remote call request header. If there is no traceId, it will automatically generate a traceId and carry it with the request. Figure 2 , Figure 2 A specific remote call link tree diagram in the remote call depth identification method of the application system provided in the embodiment of the present application, such as Figure 2 As shown, Figure 2 The global trace ID in the remote call shown is traceIdA, and traceIdA is used to describe the global trace ID corresponding to a complete call of the application system.
[0022] 2) The request tracking identifier of the next layer in each remote call, in English, SpanId, is used to describe the request tracking ID of the next layer. For remote calls belonging to the same method, spanId is the same. Among them, the span tag is an inline tag of Hypertext Markup Language (HTML), which is used to combine inline elements in a document. SpanId is used to describe the request tracking ID of the next layer when calling the next layer in a remote call. Please continue to refer to Figure 2 ,like Figure 2 As shown, layer A contains calls to two methods, B and C. spanIdB is used to describe the call to B, and spanIdC is used to describe the call to C.
[0023] 3) The request tracking identifier of each layer in each remote call, in English, ParentSpanId, is the last request tracking ID, which is used to connect the previous and subsequent requests in series. Figure 2 ,like Figure 2 As shown in the figure, parentSpanIdA is used to describe the call made by A in the previous layer of the call. For the call of the first layer, parentSpanIdA is itself, the parentSpanId of the A system is parentSpanIdA, and parentSpanIdB is used to describe the call made by B in the previous layer of the call. The call relationships between the multiple layers involved in the remote call can be connected in series through traceId, spanId and parentSpanId.
[0024] Specifically, in order to track the calling process when the application system makes a remote call and thus build a remote call link tree, when the system makes a remote call, a full-link call tracking identifier, a next-layer request tracking identifier for each layer in each remote call, and a previous-layer request tracking identifier for each layer in each remote call are set in the call request corresponding to the remote call. The call path involved in the remote call is described based on the association relationship between the full-link call tracking identifier, the next-layer request tracking identifier for each layer in each remote call, and the previous-layer request tracking identifier for each layer in each remote call. When the application system makes a remote call, the system generates an access log, which is used to record the access of the application system to the access object, wherein the access log contains the remote call content, and the call content contains the full-link call tracking identifier corresponding to each remote call, the next layer request tracking identifier of each layer in each remote call, and the upper layer request tracking identifier of each layer in each remote call. When identifying the remote call depth of the application system, the access log of the application system is obtained, and the remote call content of the application system can be obtained, so that the call path corresponding to the remote call can be obtained through the full-link call tracking identifier corresponding to each remote call, the next layer request tracking identifier of each layer in each remote call, and the upper layer request tracking identifier of each layer in each remote call. For example, when the application system makes a remote call, the remote call of the application system can be recorded through the Access log. After the application system runs for a period of time, the application system will make different remote calls according to the business being processed. Each remote call will be recorded in the Access log, and the Access log will be collected and concentrated on the log server through the log server. When the application system call depth is identified, the Access log is obtained from the log server to obtain the remote call content of the remote call made by the application system.
[0025] S102. Construct a remote call link tree corresponding to each remote call according to the full-link call tracking identifier, the next-layer request tracking identifier and the previous-layer request tracking identifier to obtain a plurality of remote call link trees.
[0026] Specifically, since a remote call may include separate calls to multiple nodes, when multiple nodes are called separately, the remote call contains a same unique full-link call tracking identifier. Since the remote call will call multiple nodes, a call link will be formed relative to the remote call. Through the full-link call tracking identifier, the call relationship between each node formed when calling each node in the same remote call can be filtered out. Please continue to refer to Figure 2 , Figure 2For each node, a field set is used to describe the calling relationship of each node in this remote call. Figure 2 In the example, traceIdA is used to describe the global tracking ID corresponding to the complete call process of the application system in this remote call, and then combined with the spanId and parentSpanId corresponding to each node, the entire call link can be obtained through the association relationship between the three tracking identifiers, so as to subsequently build a link tree.
[0027] Since the access log of the application system contains remote call content, and the remote call content includes the full-link call tracking identifier corresponding to each remote call, the next-layer request tracking identifier of each layer in each remote call, and the previous-layer request tracking identifier of each layer in each remote call, after obtaining the access log of the application system, the full-link call tracking identifier corresponding to each remote call, the next-layer request tracking identifier of each layer in each remote call, and the previous-layer request tracking identifier of each layer in each remote call are extracted from the access log.
[0028] Furthermore, the full-link call tracking identifier, the next-layer request tracking identifier and the previous-layer request tracking identifier involved in each remote call are obtained, and the remote call link tree corresponding to each remote call is constructed according to the full-link call tracking identifier, the next-layer request tracking identifier and the previous-layer request tracking identifier, so as to realize the construction of the link tree corresponding to the remote call request according to the log content. Among them, the link tree uses a tree structure to describe the link of the remote call of the application system. Its essence is a tree structure. The tree is an important nonlinear data structure, which is a structure in which data elements (called nodes in the tree) are organized according to branching relationships. A tree is a finite set consisting of n (n>0) elements, where:
[0029] (1) Each element is called a node.
[0030] (2) There is a specific node, called the root node or root (Root in English);
[0031] (3) Except for the root node, the remaining nodes are divided into m (m>=0) non-intersecting finite sets, and each subset is a tree (called a subtree of the original tree)
[0032] In the embodiment of the present application, for the logs in the same traceId, the spanId and parentSpanId in the logs are used to establish a tree of request links. The content of each node in the tree is<system、interface> , corresponding to each node system name, interface name and other information. Please continue to refer to Figure 2The diagram shown is a specific remote call link tree diagram in the remote call deep identification method of the application system provided in the embodiment of the present application.
[0033] Furthermore, the step of constructing a remote call link tree corresponding to each remote call according to the full-link call tracking identifier, the next-layer request tracking identifier, and the previous-layer request tracking identifier includes:
[0034] Extracting log content containing the same full-link call tracking identifier through a preset extraction method, wherein the log content contains the full-link call tracking identifier, the next-layer request tracking identifier, and the previous-layer request tracking identifier involved in the same remote call;
[0035] A remote call link tree corresponding to the remote call is constructed according to the full-link call tracking identifier, the next-layer request tracking identifier and the previous-layer request tracking identifier involved in the same remote call.
[0036] Among them, the preset extraction methods include a log analysis tool method and a preset regular expression method.
[0037] Specifically, for the logs of each module collected in the log server, log analysis tools such as EventLogAnalyzer log management software or Graylog log analysis tools are used to extract the log content of the same TraceId. The log content of the same TraceId will be associated with a preset format, such as<system、interface> Alternatively, extract specific text sentences from the log text, sort the values therein and calculate the average, for example, this can be easily achieved using Python's re package, and can be combined with regular expressions for extraction. For example, after obtaining the log content from the log server, extract the log content of the same trace identifier traceId through log analysis tools or regular expressions, and the log content contains traceId, spanId, and parentSpanId, and the relationship between the interface and method involved in the remote call can be obtained.
[0038] S103: Count the maximum values of the path lengths from the root node to the leaf node in all the remote call link trees to obtain the remote call depth of the application system.
[0039] Specifically, each remote call of the application system is independent and has no correlation with each other. One remote call corresponds to one call depth, and the depth that best describes the remote call depth of the entire application system is the depth with the largest depth value among all remote calls of the application system. Now we need to obtain the maximum possible depth to describe the depth of the entire application system, so we need to obtain this maximum possible depth by counting the depth of each remote call. However, the access log generally includes the content of multiple independent remote calls. When analyzing the remote calls, it is necessary to analyze the depth of each remote call. Each remote call uses a remote call link tree. By obtaining multiple remote call link trees, the maximum depth of all remote call link trees is counted to obtain the remote call depth of the application system.
[0040] After constructing the remote call link tree corresponding to each remote call according to the full-link call tracking identifier, the next-layer request tracking identifier and the previous-layer request tracking identifier, the maximum value of the path length from the root node to the leaf node (or from the leaf node to the root node) of the tree structure can be obtained according to the tree structure, such as parameters such as the depth of the tree, the number of layers of the tree or the height of the tree. By counting the maximum value of the path length from the root node to the leaf node in all the remote call link trees, the remote call depth of the application system can be obtained, thereby realizing the calculation of the call depth of the method included in the remote call of the application system by collecting the Access log of the system, and being able to automatically and dynamically identify the system and method through which the method call passes according to the real-time access log, being able to dynamically identify the dependency and call depth of the application system, and being able to accurately obtain the call depth, thereby improving the efficiency of identifying the dependency and call depth of the application system, and enabling developers to limit the call depth of the method in the application system according to the call depth, thereby controlling the complexity of the system and improving the response time after the service-oriented system transformation.
[0041] When the embodiment of the present application realizes the remote call depth identification of the application system, since three tracking identifiers are set during the remote call process of the application system, and then after obtaining the access log containing the three tracking identifiers, a remote call link tree is constructed according to the three tracking identifiers, so that by counting the depth of the link tree, the correlation between the interface remote calls involved in the remote call is more accurately identified, thereby calculating the remote call depth of the application system, and being able to automatically and dynamically identify the system and method through which the remote call passes according to the real-time access log. Compared with the traditional technology of counting the remote call depth according to the remote call function in the computer program, the efficiency and accuracy of the remote call depth identification corresponding to the remote call of the application system can be improved.
[0042] In one embodiment, the step of counting the maximum path lengths from the root node to the leaf node in all the remote call link trees to obtain the remote call depth of the application system includes:
[0043] Counting the depths of all leaf nodes contained in each of the remote call link trees;
[0044] The maximum value obtained after deduplication of the depths of all leaf nodes of each remote call link tree is used as the remote call depth corresponding to the remote call link tree;
[0045] The maximum remote call depth in all the remote call link trees is used as the remote call depth of the application system.
[0046] Specifically, for the same TraceId, after constructing the link tree structure, the complete link of the remote call performed by the application system can be intuitively described. By calculating the depth of the current tree for the constructed remote call link tree, the depth of all leaf nodes contained in each remote call link tree is counted, and for all nodes in the tree, the value obtained after deduplication is the associated system of this interface. The maximum value obtained after deduplication of the depth of all leaf nodes of each remote call link tree is used as the remote call depth corresponding to the remote call link tree. The maximum remote call depth in all the remote call link trees is used as the remote call depth of the application system, which is the call depth of the application system.
[0047] Furthermore, in a tree structure, the depth of a node n is the length of the only path from the root node to the node n, where the root node has a depth of 1. For example, see Figure 2 , Figure 2 In the example, the depth of node A is 1, the depth of nodes B and C are 2, and the depth of nodes X, Y, and Z are 3, respectively.
[0048] Furthermore, the depth of a tree refers to the maximum depth of all nodes in the tree, that is, the maximum depth of all leaf nodes. Figure 2 , it can be seen that Figure 2 The depth of the tree is 3. For nodes X, Y, and Z, since the depths of these three nodes are the same, after removing duplicates, 3 can be obtained as the depth of the tree.
[0049] For further information, see Figure 2 ,like Figure 2As shown, when calculating the depth of the tree, the lengths of the paths XBA, YBA, ZBA, and CA can be calculated in sequence, and the value with the largest length is taken as the depth of the tree.<system、interface> , corresponding to the system name and interface name of each node, when calculating the depth of XBA, the content of the trace identifier of X is obtained as (traceIdA, spanIdX, parentSpanIdB). According to the above definitions of the trace identifiers traceId, spanId, and parentSpanId, according to traceIdA and parentSpanIdB, to find the trace identifier containing traceIdA and spanIdB, node B will be found. It can be known that the previous node of X is B. Similarly, it can be known that the previous node of B is A. Since the parentSpanId of A is parentSpanIdA, it can be known that A is the root node, and there are no other nodes above A. According to the count, it can be known that the path length of XBA is 3, that is, the depth of X is 3. Similarly, it can be known that the length of YBA and ZBA is also 3, and the length of the CA path is 2. It can be known that the depths of leaf nodes X, Y, Z and node C are 3, 3, 3 and 2 respectively. Remove the repeated node length 3 and take the maximum value of the node. It can be known that Figure 1 The depth of the tree shown is 3.
[0050] In addition to using the depth of the tree to describe the call depth of the link tree, the height of the tree or the number of layers of the tree can also be used to describe the call depth. Among them, the height of the node n of the tree is the maximum number of nodes contained in all paths from the n node to the leaf node. The height of the leaf node is 1, and the height of the nodes above increases in sequence. The number of layers of the tree is the root node as the first layer, and increases one by one to the next.
[0051] Since the depth of node n is the length of the only path from the root node to node n, the depth of the root node is 1. The depth of the tree is the maximum value of the depth of all nodes in the tree, that is, the maximum value of the depth of all leaf nodes, that is, the number of layers of the tree. The height of the tree is the maximum value of the height of all nodes in the tree, that is, the height of the root node, that is, the number of layers of the tree. Therefore, the maximum number of layers of nodes in the tree is called the depth or height of the tree, so when the cardinality is 1, the depth of the tree = the height of the tree = the maximum number of layers. It can be seen that in addition to being described by the depth of the tree, the system call depth can also be described by the number of layers or the height of the tree.
[0052] In one embodiment, after the step of counting the maximum path lengths from the root node to the leaf node in all the remote call link trees, the method further includes:
[0053] All remote call depths corresponding to the remote calls made by the application system within a preset time period are counted, and the maximum remote call depth is obtained as the remote call depth of the application system.
[0054] Specifically, in actual applications, each interface call corresponding to a traceId can only identify the system and method that a certain call passes through. It is necessary to conduct statistical analysis on the interface for a period of time to more accurately identify the associated system and call depth of the interface call, and to more accurately describe the dependency and call depth of the application system. By counting the multiple call depths corresponding to multiple remote calls made by the application system within a preset time period, taking the maximum depth as the system call depth, the remote call of the application system can be performed more fully, and the maximum remote call depth obtained can more accurately describe the remote call depth of the application system.
[0055] In one embodiment, before the step of obtaining the access log of the application system, the method further includes:
[0056] Collect access logs of application systems.
[0057] For further information, see Figure 3 , Figure 3 A schematic diagram of a sub-flow diagram of a remote call depth recognition method of an application system provided in an embodiment of the present application. Figure 3 As shown, in this embodiment, the step of collecting the access log of the application system includes:
[0058] S301. When starting a remote call, determine whether the call request corresponding to the remote call contains a preset full-link call tracking identifier; if the call request contains the preset full-link call tracking identifier, go to step S303.
[0059] Specifically, in order to identify the dependency and call depth of the application system, a trace identifier traceId is set in the call request every time the application system makes a remote call, which is used to track the call trajectory of the remote call. In order to determine whether the call request contains the trace identifier traceId, when the application system initiates the remote call, it first determines whether the call request corresponding to the remote call contains the trace identifier traceId. The trace identifier traceId is a field, and it can be determined whether the trace identifier traceId is contained in the corresponding call request by determining whether traceId has a value or whether the value assigned is the same as the previous value. If traceId has a value assigned and the value is different from the previous value assigned, determine whether the call request corresponding to the remote call contains the trace identifier traceId, that is, if the call request contains the preset full-link call trace identifier, initiate a remote call, and enter step S303. If traceId has no value assigned, that is, traceId is empty, or the value assigned is the same as the previous value assigned, that is, the value assigned is the value corresponding to the previous remote call, determine that the call request corresponding to the remote call does not contain the trace identifier traceId, and enter step S302.
[0060] S302: If the call request does not include the preset full-link call tracking identifier, generate a preset full-link call tracking identifier in the remote call request according to a preset generation method, and proceed to step S303;
[0061] S303: Initiate the remote call.
[0062] Specifically, if it is determined that the calling request contains the tracing identifier traceId, it indicates that the remote calling of the application system meets the requirements, and the remote calling is initiated; if it is determined that the calling request does not contain the tracing identifier traceId, the tracing identifier traceId is generated in the calling request, that is, an unused value is generated for traceId, so that the remote calling of the application system meets the requirements, and the remote calling is initiated.
[0063] When the application system initiates a remote call, the application system will generate an Access log containing the call information. Among them, the Access log is Accesslog, which is a log generated by WebService such as Apache or Nginx, corresponding to each request for a web page, and contains a large amount of information.
[0064] Furthermore, when the application system initiates a remote call, the Access log of the interface is printed locally. The content of the Access log includes not only the tracing identifier traceId, but also the system name, interface name, spanId, and parentSpanId in order to clarify the calling relationship between the upper and lower layers during the calling process. According to the above description of the technical solution, the Access log also includes the system name, interface name, spanId, and parentSpanId, wherein the definitions of the tracing identifiers traceId, spanId, and parentSpanId are as described above.
[0065] S304: Print the access log generated by the remote call and containing the call request, and collect the access log to a log server.
[0066] Among them, printing logs, that is, recording logs or outputting logs, can also be called printing logs because the Print method is used to generate logs. For example, there are many ways to implement logging in Java, such as the following methods: 1) The simplest way is system.println.out(error), which prints messages directly on the console. 2) Java.util.logging, after JDK1.4, provides a logging API that can write logs to files. 3) log4j, the most powerful way to record logs. You can configure the destination and format of the log by configuring .properties or .xml files. 4) Commons-logging, the most comprehensive and common logging method, is often used in combination with log4j.
[0067] Specifically, since the application system has more than one function, each function will correspond to different remote calls, that is, each remote call of the application system code will be different according to the actual application. The application system can use the collection module to collect the log data corresponding to the Access log generated by each remote call of the application system to the log server, so as to analyze all the multiple remote calls included in the Access log later, so as to judge the dependence and call depth of the application system as a whole.
[0068] It should be noted that the remote calling deep recognition method of the application system described in the above embodiments can recombine the technical features contained in different embodiments as needed to obtain a combined implementation plan, but all of them are within the scope of protection required by this application.
[0069] See also Figure 4 , Figure 4A schematic block diagram of a remote call depth recognition device for an application system provided in an embodiment of the present application. Corresponding to the remote call depth recognition method for an application system described above, an embodiment of the present application also provides a remote call depth recognition device for an application system. Figure 4 As shown, the remote call depth recognition device of the application system includes a unit for executing the remote call depth recognition method of the application system described above, and the remote call depth recognition device of the application system can be configured in a computer device. Figure 4 The remote calling depth recognition device 400 of the application system includes an acquisition unit 401, a construction unit 402 and a statistical unit 403.
[0070] Among them, the acquisition unit 401 is used to obtain the access log of the application system, the access log contains remote call content, and the remote call content contains the full-link call tracking identifier corresponding to each remote call, the next layer request tracking identifier of each layer in each remote call, and the previous layer request tracking identifier of each layer in each remote call;
[0071] A construction unit 402 is used to construct a remote call link tree corresponding to each remote call according to the full-link call tracking identifier, the next-layer request tracking identifier and the previous-layer request tracking identifier to obtain a plurality of remote call link trees;
[0072] The statistical unit 403 is used to count the maximum value of the path length from the root node to the leaf node in all the remote call link trees to obtain the remote call depth of the application system.
[0073] In one embodiment, the statistical unit 403 includes:
[0074] A first statistical subunit, used to count the depths of all leaf nodes contained in each of the remote call link trees;
[0075] A deduplication subunit, used to obtain the maximum value after deduplication of the depths of all leaf nodes of each remote call link tree as the remote call depth corresponding to the remote call link tree;
[0076] A subunit is obtained, which is used to take the maximum remote call depth in all the remote call link trees as the remote call depth of the application system.
[0077] In one embodiment, the statistical unit 403 further includes:
[0078] The second statistical subunit is used to count all remote call depths corresponding to the remote calls made by the application system within a preset time period, and take the maximum remote call depth as the remote call depth of the application system.
[0079] In one embodiment, the construction unit 402 includes:
[0080] An extraction subunit, used to extract log content containing the same full-link call tracking identifier through a preset extraction method, wherein the log content contains the full-link call tracking identifier, the next-layer request tracking identifier, and the previous-layer request tracking identifier involved in the same remote call;
[0081] A construction subunit is used to construct a remote call link tree corresponding to the remote call based on the full-link call tracking identifier, the next-layer request tracking identifier and the previous-layer request tracking identifier involved in the same remote call.
[0082] In one embodiment, the remote calling depth recognition device 400 of the application system further includes:
[0083] A collection unit, used to collect access logs of application systems;
[0084] The acquisition unit comprises:
[0085] A judgment subunit, used to judge whether a call request corresponding to the remote call contains a preset full-link call tracking identifier when a remote call is initiated;
[0086] A first initiating subunit, configured to initiate the remote call if the call request includes the preset full-link call tracking identifier;
[0087] A second initiating subunit is used to generate a preset full-link call tracing identifier in the remote call request according to a preset generation method if the call request does not contain the preset full-link call tracing identifier, and initiate the remote call;
[0088] The printing subunit is used to print the access log containing the call request generated by the remote call, and collect the access log to the log server.
[0089] It should be noted that technical personnel in the relevant field can clearly understand that the specific implementation process of the remote calling of the deep identification device and each unit of the above-mentioned application system can refer to the corresponding description in the aforementioned method embodiment, and for the convenience and conciseness of the description, it will not be repeated here.
[0090] At the same time, the division and connection method of each unit in the remote calling depth identification device of the above-mentioned application system is only for illustrative purposes. In other embodiments, the remote calling depth identification device of the application system can be divided into different units as needed, and the units in the remote calling depth identification device of the application system can also adopt different connection orders and methods to complete all or part of the functions of the remote calling depth identification device of the above-mentioned application system.
[0091] The remote calling depth recognition device of the above application system can be implemented in the form of a computer program. The computer program can be used in Figure 5 Runs on the computer device shown.
[0092] See also Figure 5 , Figure 5 1 is a schematic block diagram of a computer device provided in an embodiment of the present application. The computer device 500 may be a computer device such as a desktop computer or a server, or may be a component or part in other devices.
[0093] See also Figure 5 The computer device 500 includes a processor 502 , a memory and a network interface 505 connected via a system bus 501 , wherein the memory may include a non-volatile storage medium 503 and an internal memory 504 .
[0094] The non-volatile storage medium 503 can store an operating system 5031 and a computer program 5032. When the computer program 5032 is executed, the processor 502 can execute a remote call depth recognition method of the above application system.
[0095] The processor 502 is used to provide computing and control capabilities to support the operation of the entire computer device 500 .
[0096] The internal memory 504 provides an environment for the operation of the computer program 5032 in the non-volatile storage medium 503. When the computer program 5032 is executed by the processor 502, the processor 502 can execute a remote call depth recognition method of the above-mentioned application system.
[0097] The network interface 505 is used to communicate with other devices over the network. Figure 5 The structure shown in the figure is only a block diagram of a part of the structure related to the present application scheme, and does not constitute a limitation on the computer device 500 to which the present application scheme is applied. The specific computer device 500 may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components. For example, in some embodiments, the computer device may only include a memory and a processor. In such an embodiment, the structure and function of the memory and the processor are the same as those of the present application scheme. Figure 5 The embodiments shown are consistent and will not be described again here.
[0098] Among them, the processor 502 is used to run a computer program 5032 stored in a memory to implement the following steps: obtaining an access log of the application system, the access log containing remote call content, the remote call content containing the full-link call tracking identifier corresponding to each remote call, the next-layer request tracking identifier of each layer in each remote call, and the previous-layer request tracking identifier of each layer in each remote call; constructing a remote call link tree corresponding to each remote call according to the full-link call tracking identifier, the next-layer request tracking identifier, and the previous-layer request tracking identifier to obtain a plurality of the remote call link trees; counting the maximum path length from the root node to the leaf node in all the remote call link trees to obtain the remote call depth of the application system.
[0099] In one embodiment, when the processor 502 implements the step of counting the maximum path lengths from the root node to the leaf node in all the remote call link trees to obtain the remote call depth of the application system, the processor 502 specifically implements the following steps:
[0100] Count the depths of all leaf nodes contained in each of the remote call link trees; take the maximum value obtained after deduplication of the depths of all leaf nodes of each of the remote call link trees as the remote call depth corresponding to the remote call link tree; and take the maximum remote call depth in all the remote call link trees as the remote call depth of the application system.
[0101] In one embodiment, after implementing the step of counting the maximum path lengths from the root node to the leaf node in all the remote call link trees, the processor 502 further implements the following steps:
[0102] All remote call depths corresponding to the remote calls made by the application system within a preset time period are counted, and the maximum remote call depth is obtained as the remote call depth of the application system.
[0103] In one embodiment, when the processor 502 implements the step of constructing a remote call link tree corresponding to each remote call according to the full-link call tracking identifier, the next-layer request tracking identifier, and the previous-layer request tracking identifier, the processor 502 specifically implements the following steps:
[0104] Extracting log content containing the same full-link call tracking identifier through a preset extraction method, wherein the log content contains the full-link call tracking identifier, the next-layer request tracking identifier, and the previous-layer request tracking identifier involved in the same remote call;
[0105] A remote call link tree corresponding to the remote call is constructed according to the full-link call tracking identifier, the next-layer request tracking identifier and the previous-layer request tracking identifier involved in the same remote call.
[0106] In one embodiment, before implementing the step of obtaining the access log of the application system, the processor 502 further implements the following steps:
[0107] Collect access logs of application systems;
[0108] When implementing the step of collecting the access log of the application system, the processor 502 specifically implements the following steps:
[0109] When a remote call is initiated, determining whether the call request corresponding to the remote call contains a preset full-link call tracking identifier;
[0110] If the call request contains the preset full-link call tracking identifier, initiating the remote call;
[0111] If the call request does not include the preset full-link call tracking identifier, generate a preset full-link call tracking identifier in the remote call request according to a preset generation method, and initiate the remote call;
[0112] The access log generated by the remote call and containing the call request is printed, and the access log is collected to a log server.
[0113] It should be understood that in the embodiment of the present application, the processor 502 may be a central processing unit (CPU), and the processor 502 may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0114] Those skilled in the art will appreciate that all or part of the processes in the method for implementing the above embodiment can be completed by a computer program, which can be stored in a computer-readable storage medium. The computer program is executed by at least one processor in the computer system to implement the process steps of the embodiment of the above method.
[0115] Therefore, the present application also provides a computer-readable storage medium. The computer-readable storage medium may be a non-volatile computer-readable storage medium, and the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the processor executes the following steps:
[0116] A computer program product, when running on a computer, enables the computer to execute the steps of the remote calling depth recognition method of the application system described in the above embodiments.
[0117] The computer-readable storage medium may be an internal storage unit of the aforementioned device, such as a hard disk or memory of the device. The computer-readable storage medium may also be an external storage device of the device, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the device. Furthermore, the computer-readable storage medium may also include both an internal storage unit of the device and an external storage device.
[0118] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described equipment, devices and units can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0119] The storage medium is a physical, non-transient storage medium, for example, it can be a USB flash drive, a mobile hard disk, a read-only memory (ROM), a magnetic disk or an optical disk, etc., which can store computer programs.
[0120] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0121] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of each unit is only a logical function division, and there may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed.
[0122] The steps in the method of the embodiment of the present application can be adjusted in order, combined and deleted according to actual needs. The units in the device of the embodiment of the present application can be combined, divided and deleted according to actual needs. In addition, the functional units in the various embodiments of the present application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0123] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for an electronic device (which can be a personal computer, terminal, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application.
[0124] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in the present application, and these modifications or replacements should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.
Claims
1. A remote call depth recognition method for an application system, characterized in that: The method comprises: Obtaining an access log of the application system, wherein the access log contains remote call content, wherein the remote call content includes a full-link call tracking identifier corresponding to each remote call, a next-layer request tracking identifier for each layer in each remote call, and a previous-layer request tracking identifier for each layer in each remote call; Constructing a remote call link tree corresponding to each remote call according to the full-link call tracking identifier, the next-layer request tracking identifier, and the previous-layer request tracking identifier to obtain a plurality of remote call link trees; Counting the maximum value of the path length from the root node to the leaf node in all the remote call link trees to obtain the remote call depth of the application system; The step of counting the maximum path lengths from the root node to the leaf node in all the remote call link trees to obtain the remote call depth of the application system comprises: Counting the depths of all leaf nodes contained in each of the remote call link trees; The maximum value obtained after deduplication of the depths of all leaf nodes of each remote call link tree is used as the remote call depth corresponding to the remote call link tree; The maximum remote call depth in all the remote call link trees is used as the remote call depth of the application system; The step of constructing a remote call link tree corresponding to each remote call according to the full-link call tracking identifier, the next-layer request tracking identifier, and the previous-layer request tracking identifier comprises: Extracting log content containing the same full-link call tracking identifier through a preset extraction method, wherein the log content contains the full-link call tracking identifier, the next-layer request tracking identifier, and the previous-layer request tracking identifier involved in the same remote call; A remote call link tree corresponding to the remote call is constructed according to the full-link call tracking identifier, the next-layer request tracking identifier and the previous-layer request tracking identifier involved in the same remote call.
2. The remote call depth recognition method of the application system according to claim 1 is characterized in that: After the step of counting the maximum path lengths from the root node to the leaf node in all the remote call link trees, the method further includes: All remote call depths corresponding to the remote calls made by the application system within a preset time period are counted, and the maximum remote call depth is obtained as the remote call depth of the application system.
3. The remote call depth recognition method of the application system according to claim 1 is characterized in that: Before the step of obtaining the access log of the application system, the method further includes: Collect access logs of application systems; The step of collecting the access log of the application system includes: When a remote call is initiated, determining whether the call request corresponding to the remote call contains a preset full-link call tracking identifier; If the call request contains the preset full-link call tracking identifier, initiating the remote call; If the call request does not include the preset full-link call tracking identifier, generate a preset full-link call tracking identifier in the remote call request according to a preset generation method, and initiate the remote call; The access log generated by the remote call and containing the call request is printed, and the access log is collected to a log server.
4. A remote calling depth recognition device of an application system, characterized in that: include: An acquisition unit is used to acquire an access log of the application system, wherein the access log includes remote call content, and the remote call content includes a full-link call tracking identifier corresponding to each remote call, a next-layer request tracking identifier of each layer in each remote call, and a previous-layer request tracking identifier of each layer in each remote call; A construction unit, used to construct a remote call link tree corresponding to each remote call according to the full-link call tracking identifier, the next-layer request tracking identifier and the previous-layer request tracking identifier, so as to obtain a plurality of remote call link trees; A statistical unit, used for counting the maximum value of the path length from the root node to the leaf node in all the remote call link trees to obtain the remote call depth of the application system; The statistical unit comprises: A first statistical subunit, used to count the depths of all leaf nodes included in each of the remote call link trees; A deduplication subunit, used for obtaining the maximum value after deduplication of the depths of all leaf nodes of each remote call link tree as the remote call depth corresponding to the remote call link tree; Obtain a subunit, used for taking the maximum remote call depth in all the remote call link trees as the remote call depth of the application system; The building block comprises: An extraction subunit, used to extract log content containing the same full-link call tracking identifier through a preset extraction method, wherein the log content contains the full-link call tracking identifier, the next-layer request tracking identifier, and the previous-layer request tracking identifier involved in the same remote call; A construction subunit is used to construct a remote call link tree corresponding to the remote call based on the full-link call tracking identifier, the next-layer request tracking identifier and the previous-layer request tracking identifier involved in the same remote call.
5. The remote calling depth recognition device of the application system according to claim 4 is characterized in that: The statistical unit also includes: The second statistical subunit is used to count all remote call depths corresponding to the remote calls made by the application system within a preset time period, and take the maximum remote call depth as the remote call depth of the application system.
6. A computer device, characterized in that: The computer device comprises a memory and a processor connected to the memory; the memory is used to store a computer program; the processor is used to run the computer program to execute the steps of the method according to any one of claims 1 to 3.
7. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 3 can be implemented.
Citation Information
Patent Citations
JAVA vulnerability detection method and system based on a call chain
CN109829312A
A real-time calling chain tracking method based on micro-service
CN109921927A