Interface calling information determination method and device, equipment and storage medium
Patent Information
- Application Number
- CN202211732648.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-30
- Publication Date
- 2026-10-27
- Estimated Expiration
- 2042-12-30
AI Technical Summary
例如,开发人员在编写目标接口时,在目标接口调用中加入了子接口A1、子接口B1以及子接口C1,因此可以直接基于目标接口的调用代码中看出目标接口中的子调用,然而由于子接口A1中调用的二级子接口不是开发人员编写的因此,开发人员不能得知子接口A1中调用的二级子接口,进而无法基于目标接口中的调用链对目标接口进行优化,从而导致目标接口的响应时间过长
[0046]本公开提供的技术方案至少带来以下有益效果:该接口调用信息确定方法包括:从预先设置好的接口包路径中确定第一接口以及第二接口;获取上述第一接口的执行过程中包括的所有调用请求;响应于上述调用请求的调用对象为接口方法,在用于调用上述调用对象的调用请求中加入请求头项,上述请求头项包括调用上述调用对象的接口的接口标识,上述接口标识与调用上述调用对象的接口唯一对应;在接口包路径中的第二接口被调用时,响应于用于调用上述第二接口的请求头中有请求头项,确定与上述第二接口对应的父接口标识以及与上述第二接口唯一对应的接口标识;上述父接口标识包括上述请求头项中调用上述第二接口的接口的接口标识;基于与上述第一接口唯一对应的接口标识、与上述第二接口对应的父接口标识以及与上述第二接口唯一对应的接口标识,确定上述第一接口的调用信息,上述调用信息包括调用链,上述调用链用于指示上述第一接口的执行过程中包括的所有第二接口以及上述第二接口之间的调用关系。先获取第一接口执行过程中的调用请求,并对调用请求进行请求头项的添加处理,以通过请求头项对第一接口执行过程中包括的所有调用对象进行标记,从而基于请求头项识别被调用的第二接口与第一接口之间的调用关系,继而确定出第一接口的包括调用链的调用信息。
Smart Images

Figure CN116048976B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of computer software testing technology, and particularly to a method, apparatus, device, and storage medium for determining interface call information. Background Technology
[0002] When evaluating the performance of an API request, the API response time is a key metric. For example, when a user opens an application, the login API is triggered first to complete the login process. If the login API response time is slow, such as exceeding 10 seconds, the user may open another application due to the long wait. Therefore, API response time is a critical performance indicator.
[0003] The response time of an interface refers to the processing time during the execution of its internal logic. Generally, interfaces with simpler internal logic have faster response times than those with more complex internal logic. Since more complex interfaces typically involve calls to multiple sub-interfaces, their response time is significantly influenced by the response times of these other sub-interfaces. Developers of the target interface can understand which sub-interfaces are called during the development process, but they cannot directly obtain information about which sub-interfaces within those sub-interfaces call their own sub-interfaces. For example, if a developer adds sub-interfaces A1, B1, and C1 to the target interface's calls, they can directly identify the sub-calls based on the interface's call code. However, since the sub-interfaces called by sub-interface A1 are not written by the developer, they cannot know these sub-interfaces and therefore cannot optimize the target interface based on the call chain, leading to excessively long response times. Summary of the Invention
[0004] This disclosure provides a method, apparatus, device, and storage medium for determining interface call information. The method is used to first obtain the call request during the execution of a first interface, and then add a request header to the call request to mark all the call objects included in the execution of the first interface through the request header. Based on the request header, the method identifies the call relationship between the called second interface and the first interface, and then determines the call information of the first interface, including the call chain.
[0005] To achieve the above objectives, the present disclosure adopts the following technical solution:
[0006] Firstly, a method for determining interface call information is provided, the method including:
[0007] Determine the first interface and the second interface from the pre-set interface package path;
[0008] Obtain all call requests included in the execution process of the aforementioned first interface;
[0009] In response to the above call request, if the calling object is an interface method, a request header is added to the call request used to call the above calling object. The request header includes the interface identifier of the interface that calls the above calling object. The interface identifier uniquely corresponds to the interface that calls the above calling object.
[0010] When the second interface in the interface package path is called, in response to the request header for calling the second interface containing a request header item, the parent interface identifier corresponding to the second interface and the interface identifier uniquely corresponding to the second interface are determined; the parent interface identifier includes the interface identifier of the interface that calls the second interface in the request header item.
[0011] Based on the interface identifier uniquely corresponding to the first interface, the parent interface identifier corresponding to the second interface, and the interface identifier uniquely corresponding to the second interface, the call information of the first interface is determined. The call information includes a call chain, which is used to indicate all second interfaces included in the execution of the first interface and the call relationship between the second interfaces.
[0012] In conjunction with the first aspect mentioned above, in one possible implementation, determining the first interface and the second interface from a pre-set interface package path includes:
[0013] Display a first display interface, which includes the interface information input area of the first interface.
[0014] In response to the user's input operation in the interface information input area of the first interface, the interface corresponding to the input operation is determined from the pre-set interface packet path as the first interface;
[0015] The interfaces in the above interface package path other than the first interface are designated as the second interface.
[0016] In conjunction with the first aspect described above, in one possible implementation, the method further includes:
[0017] Obtain the first method name of the aforementioned first interface, and randomly generate a first random number;
[0018] The first random number is concatenated with the first method name to obtain an interface identifier that uniquely corresponds to the first interface.
[0019] In conjunction with the first aspect above, in one possible implementation, determining the parent interface identifier corresponding to the second interface and the interface identifier uniquely corresponding to the second interface includes:
[0020] Based on the interface identifier of the interface that calls the second interface in the above request header, the parent interface identifier corresponding to the second interface is determined.
[0021] Obtain the second method name of the aforementioned second interface, and randomly generate a second random number;
[0022] The second random number is concatenated with the second method name to obtain an interface identifier that uniquely corresponds to the second interface.
[0023] In conjunction with the first aspect above, in one possible implementation, the aforementioned call information also includes call parameters, which are used to indicate the response time for each second interface to be called.
[0024] Secondly, an interface call information determining device is provided, the device comprising:
[0025] The interface determination module is used to determine the first interface and the second interface from a pre-set interface packet path;
[0026] The call request acquisition module is used to acquire all call requests included in the execution process of the first interface mentioned above;
[0027] The request header addition module is used to add request headers to the call request for calling the above call object, which is an interface method, in response to the above call request. The request headers include the interface identifier of the interface that calls the above call object. The interface identifier uniquely corresponds to the interface that calls the above call object.
[0028] The request header processing module is used to determine the parent interface identifier corresponding to the second interface and the interface identifier uniquely corresponding to the second interface when the second interface in the interface package path is called, in response to the request header for calling the second interface containing a request header item; the parent interface identifier includes the interface identifier of the interface that calls the second interface in the request header item.
[0029] The call information determination module is used to determine the call information of the first interface based on the interface identifier uniquely corresponding to the first interface, the parent interface identifier corresponding to the second interface, and the interface identifier uniquely corresponding to the second interface. The call information includes a call chain, which is used to indicate all second interfaces included in the execution of the first interface and the call relationship between the second interfaces.
[0030] In conjunction with the second aspect above, in one possible implementation, the interface determination module includes:
[0031] The first display unit is used to display a first display interface, the first display interface including the interface information input area of the first interface;
[0032] The first interface determination unit is used to respond to the user's input operation based on the interface information input area of the first interface and determine the interface corresponding to the input operation as the first interface from the pre-set interface packet path;
[0033] The second interface determination unit is used to determine the interfaces in the interface packet path other than the first interface as the second interface.
[0034] In conjunction with the second aspect above, in one possible implementation, the device further includes:
[0035] The first interface data acquisition module is used to acquire the first method name of the first interface and randomly generate a first random number.
[0036] The first interface identifier determination module is used to concatenate the first random number with the first method name to obtain an interface identifier that uniquely corresponds to the first interface.
[0037] In conjunction with the second aspect above, in one possible implementation, the request header processing module includes:
[0038] The parent interface identifier unit is used to determine the parent interface identifier corresponding to the second interface based on the interface identifier of the interface that calls the second interface in the above request header.
[0039] The second interface data acquisition unit is used to acquire the second method name of the second interface and randomly generate a second random number.
[0040] The second interface identifier determination unit is used to concatenate the second random number with the second method name to obtain an interface identifier that uniquely corresponds to the second interface.
[0041] In conjunction with the second aspect above, in one possible implementation, the aforementioned call information also includes call parameters, which are used to indicate the response time for each second interface to be called.
[0042] Thirdly, an interface call information determination device is provided, the interface call information determination device comprising: a processor and a memory; wherein the memory is used to store computer execution instructions, and when the interface call information determination device is running, the processor executes the computer execution instructions stored in the memory, so that the interface call information determination device performs the interface call information determination method as described in the first aspect and any possible implementation thereof.
[0043] Fourthly, this disclosure provides a computer-readable storage medium storing instructions that, when executed by a processor of an interface call information determining device, enable the interface call information determining device to perform the interface call information determining method as described in the first aspect and any possible implementation thereof.
[0044] In this disclosure, the name of the device determined by the aforementioned interface call information does not constitute a limitation on the device or functional module itself. In actual implementation, these devices or functional modules may appear under other names. As long as the functions of each device or functional module are similar to those of this disclosure, they fall within the scope of the claims of this disclosure and their equivalents.
[0045] These or other aspects of this disclosure will become more readily apparent in the following description.
[0046] The technical solution provided in this disclosure brings at least the following beneficial effects: The method for determining interface call information includes: determining a first interface and a second interface from a pre-set interface package path; obtaining all call requests included in the execution process of the first interface; in response to the call object of the call request being an interface method, adding a request header to the call request for calling the call object, the request header including an interface identifier of the interface calling the call object, the interface identifier uniquely corresponding to the interface calling the call object; when the second interface in the interface package path is called, in response to the request header for calling the second interface containing a request header, determining the parent interface identifier corresponding to the second interface and the interface identifier uniquely corresponding to the second interface; the parent interface identifier including the interface identifier of the interface calling the second interface in the request header; based on the interface identifier uniquely corresponding to the first interface, the parent interface identifier corresponding to the second interface, and the interface identifier uniquely corresponding to the second interface, determining the call information of the first interface, the call information including a call chain, the call chain being used to indicate all second interfaces included in the execution process of the first interface and the call relationships between the second interfaces. First, obtain the call requests during the execution of the first interface, and add request headers to the call requests to mark all the calling objects included in the execution of the first interface. Then, based on the request headers, identify the call relationship between the called second interface and the first interface, and then determine the call information of the first interface including the call chain. Attached Figure Description
[0047] Figure 1 This is a schematic diagram illustrating the internal call relationship of a target interface provided in this disclosure;
[0048] Figure 2A flowchart illustrating a method for determining interface call information provided in this disclosure;
[0049] Figure 3 This is another flowchart illustrating a method for determining interface call information provided in this disclosure;
[0050] Figure 4 This is a schematic diagram of the structure of an interface call information determination device provided in this disclosure;
[0051] Figure 5 This is a schematic diagram of the hardware structure of a device for determining interface call information, as provided in this disclosure. Detailed Implementation
[0052] The method, apparatus, and storage medium for determining interface call information provided in the embodiments of this disclosure will now be described in detail with reference to the accompanying drawings.
[0053] In this article, the term "and / or" is merely a description of the relationship between related objects, indicating that there can be three relationships. For example, A and / or B can represent three situations: A exists alone, A and B exist simultaneously, and B exists alone.
[0054] The terms “first” and “second” in this disclosure and its accompanying drawings are used to distinguish different objects or to distinguish different treatments of the same object, rather than to describe a particular order of objects.
[0055] Furthermore, the terms “comprising” and “having”, and any variations thereof, used in the description of this disclosure are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not limited to the steps or units listed, but may optionally include other steps or units not listed, or may optionally include other steps or units inherent to such process, method, product, or apparatus.
[0056] It should be noted that in this disclosure, the terms "exemplary" or "for example" are used to indicate that something is an example, illustration, or description. Any embodiment or design described as "exemplary" or "for example" in this disclosure should not be construed as being more preferred or advantageous than other embodiments or designs. Specifically, the use of terms such as "exemplary" or "for example" is intended to present the relevant concepts in a concrete manner.
[0057] The response time of an interface is the processing time during the execution of its internal logic. Generally speaking, interfaces with simpler internal logic have faster response times than those with more complex internal logic. Since more complex interfaces often involve calls to multiple other sub-interfaces, their response time is significantly affected by the response times of those other sub-interfaces. Please refer to [link / reference]. Figure 1 ,from Figure 1 As can be seen, when the target interface is called, during its execution, calls to interfaces A1, B1, and C1 occur internally. When interface A1 is called, its execution then calls interface C2, which in turn calls interface E1. Similarly, interface B1 calls interface D1, and interface C1 calls interface D2, which in turn calls interface E2. Therefore, when the target interface is called, a series of sub-interface calls occur internally, which in turn call second-level sub-interfaces, and so on, leading to tertiary-level sub-interface calls. For interfaces with complex call relationships, a series of call chains typically emerge, where the interface execution calls multiple sub-interfaces, and the execution of each sub-interface calls other sub-interfaces.
[0058] Developers of the target interface can understand which sub-interfaces the target interface calls through its development process, but they cannot directly obtain which second-level sub-interfaces are called by those sub-interfaces. For example, when writing the target interface, developers added sub-interfaces A1, B1, and C1 to the target interface calls. Therefore, they can directly see the sub-calls in the target interface's call code. However, since the second-level sub-interfaces called by sub-interface A1 were not written by the developers, they cannot know which second-level sub-interfaces are called by sub-interface A1. Consequently, they cannot optimize the target interface based on the call chain, resulting in excessively long response times for the target interface.
[0059] To address the technical problem of being unable to accurately determine API call information, this application provides a method for determining API call information. Please refer to [link / reference needed]. Figure 2 The above method includes the following steps (steps S110-S150):
[0060] Step S110: Determine the first interface and the second interface from the pre-set interface packet path.
[0061] The pre-configured interface package path contains the interface package path corresponding to the service to be tested. Generally, the pre-configured interface package path can be obtained from the cluster management platform. Each service cluster has its own cluster management platform, such as Kubernetes, which contains this information for each service. This information can be obtained through the API provided by the cluster management platform.
[0062] The first interface is the interface specified by the user that requires information about its invocation, while the second interface is all other interfaces besides the first interface. For example, if the interface package path of the service being tested includes a total of 5 interfaces: interface A1, interface A2, interface A3, interface A4, and interface A5, then after the user determines that interfaces A1 and A3 are the first interfaces, interfaces A2, A4, and A5 are the second interfaces.
[0063] For details, please refer to Figure 3 When determining the first interface and the second interface from the pre-set interface package path, the following steps can be used (steps S111-S113):
[0064] Step S111: Display the first display interface, which includes the interface information input area of the first interface.
[0065] Step S112: In response to the user's input operation based on the interface information input area of the first interface, determine the interface corresponding to the input operation from the pre-set interface packet path as the first interface.
[0066] Step S113: Determine the interfaces in the above interface package path other than the first interface as the second interface.
[0067] The interface information for the first interface can include at least the server address, application name, classpath, and interface method name. The server address, application name, classpath, and interface method name can uniquely identify an interface. After the user inputs the interface information for the first interface, the interface corresponding to the user's input can be identified as the first interface.
[0068] Step S120: Obtain all call requests included in the execution process of the first interface mentioned above.
[0069] When obtaining all call requests included in the execution of the first interface, this can be achieved by monitoring the first interface. Specifically, the monitoring logic for the first interface A is as follows: during the execution of the first interface A, whenever a sub-method is called, the call request used to call that sub-method is obtained. The called sub-method can be the first sub-method directly called during the execution of the first interface, or it can be a multi-level sub-method indirectly called during the execution of the first interface.
[0070] Step S130: In response to the above call request, if the calling object is an interface method, add a request header to the call request used to call the above calling object.
[0071] The above request header includes the interface identifier of the interface that calls the above-mentioned object, and the interface identifier uniquely corresponds to the interface that calls the above-mentioned object.
[0072] If the sub-method is an interface B, then before interface B is requested, a request header item is added to the request header of the H5pServletRequest request scope parameter of interface B. The key of this request header item is identityId, and the value is the unique interface identifier corresponding to the first interface A. For example, if the unique identifier of the first interface A is dhuhiubbDI892KKokogouterBaseInfo, then the request header item added to the request scope of the request for the sub-method called on the first interface A, i.e., interface B, is: id entityId:dhuhiubbDI892KKokogouterBaseInfo.
[0073] Understandably, if the first interface is A, the execution of the first interface includes a call request to interface B, and interface B includes a call request to interface C. That is, the execution of the first interface A includes call requests to both interface B and interface C. In this case, in step 130, request headers are added to the call requests for interface B and interface C, respectively. These request headers include the interface identifier of the first interface A. If interface D is the second interface but is not called by the first interface A, but is called during the execution of the first interface E, then the call request for interface D includes the interface identifier corresponding to the first interface E. Similarly, if interface D is called during the execution of the second interface F, then the call request for interface D includes the interface identifier corresponding to the second interface F. In other words, as long as the calling object of the call request is an interface method, a request header is added to the call request for that calling object, and this request header includes the interface identifier corresponding to the interface calling the calling object.
[0074] Step S140: When the second interface in the interface package path is called, in response to the request header field in the request header used to call the second interface, determine the parent interface identifier corresponding to the second interface and the interface identifier uniquely corresponding to the second interface.
[0075] The aforementioned parent interface identifier includes the interface identifier of the interface that calls the aforementioned second interface in the aforementioned request header.
[0076] Step S150: Based on the interface identifier that uniquely corresponds to the first interface, the parent interface identifier that corresponds to the second interface, and the interface identifier that uniquely corresponds to the second interface, determine the call information of the first interface.
[0077] The aforementioned call information includes a call chain, which is used to indicate all the second interfaces included in the execution of the first interface and the call relationships between the second interfaces.
[0078] When the second interface in the interface package path is called, you can try to obtain the value of the request header item with the key "identityId" in the request header of the H5pServletRequest request parameter of the second interface. If you can obtain it, assign the value of "identityId" to the variable "fartherIdentityId". It should be noted that if the request header containing the value of "identityId" is found when calling the second interface, it means that the second interface is a sub-interface in the execution process of some interface. This is because in the previous step, when the first interface was executing and calling the sub-interface, the interface identifier "identityId" of the interface calling the second interface was set as a request header item in the sub-interface's request. Therefore, if the request header cannot be obtained, i.e., the value of "identityId" cannot be obtained, it means that the second interface is not a sub-interface of any interface.
[0079] In one possible implementation, the above method further includes the following steps, through which the interface identifier uniquely corresponding to the first interface can be obtained:
[0080] Step 1: Obtain the first method name of the first interface mentioned above, and randomly generate the first random number.
[0081] Step 2: Concatenate the first random number with the first method name to obtain an interface identifier that uniquely corresponds to the first interface.
[0082] After obtaining the first method name of the first interface, a first random number is generated. This first random number is then concatenated with the first method name, and the concatenated result is used as the unique interface identifier corresponding to the first interface. For example, assuming the first interface is / actops-bussiness / v0 / open / outerVipArea, the corresponding first method name is outerBaseInfo(), and the randomly generated first random number is dhuhiubbDI892KKokog, then the unique identifier of the target interface is dhuhiubbDI892KKokogouterBaseInfo. There is no limitation on the number of bits in the random number, nor is there a limitation on how the first random number and the first method name are concatenated; here, the random number comes first in the concatenation, but it can also be placed after the first method name.
[0083] The following steps can be used to determine the parent interface identifier corresponding to the second interface and the interface identifier that uniquely corresponds to the second interface:
[0084] Step 1: Determine the parent interface identifier corresponding to the second interface based on the interface identifier of the interface that calls the second interface in the above request header.
[0085] Step 2: Obtain the second method name of the second interface mentioned above, and randomly generate a second random number.
[0086] Step 3: Concatenate the second random number with the second method name to obtain an interface identifier that uniquely corresponds to the second interface.
[0087] The parent interface identifier is the interface identifier of the interface that calls the second interface mentioned above, as shown in the request header. In other words, the specific interface calling the second interface can be determined through the parent interface identifier. When the second interface is called, the request header added to the corresponding request already includes the interface identifier of the interface calling the second interface. Therefore, the interface identifier of the interface calling the second interface in the request header can be directly used as the parent interface identifier corresponding to the second interface. As in the previous example, we attempt to retrieve the value of the request header with the key "identityId" in the request header of the H5pServletRequest request field parameter of the second interface. If the value is retrieved, the value of "identityId" is assigned to the variable `fartherIdentityId`, that is, assigned to the variable representing the parent interface identifier.
[0088] Obtain the second method name of the second interface, then generate a second random number, concatenate the second random number with the second method name, and use the concatenated result as the interface identifier that uniquely corresponds to the second interface.
[0089] As one implementation method, after obtaining the interface identifier that uniquely corresponds to the second interface, the interface identifier is assigned to the variable myIdentityId.
[0090] Here, step S130 is further explained in conjunction with the above implementation method. During the execution of the second interface, there may be calls to sub-interfaces. If calls to other sub-interfaces occur within the second interface, these are called calls to second-level sub-interfaces. Similarly, the request header item `identityId` needs to be added to the call request for the second-level sub-interface, and the value of this item is the value of `myIdentityId` corresponding to the second interface, i.e., the unique interface identifier corresponding to the second interface. Likewise, if a call to a third-level sub-interface occurs during the execution of the second-level sub-interface, the request header item `identityId` needs to be added to the call request for the third-level sub-interface, and the value of this item is the value of `myIdentityId` corresponding to the second-level sub-interface, i.e., the unique interface identifier corresponding to the second interface. This ensures that all interface call requests during the execution of the first interface will have a request header item added, and the interface identifier in the request header item is the interface identifier of the previous level caller. Therefore, by using the unique interface identifier corresponding to the first interface, the parent interface identifier corresponding to the second interface, and the unique interface identifier corresponding to the second interface, it is possible to identify which of these second interfaces are in the same call chain, and thus determine the call information of the first interface.
[0091] In conjunction with the first aspect above, in one possible implementation, the aforementioned call information also includes call parameters, which are used to indicate the response time for each second interface to be called.
[0092] When obtaining the call parameters, a timestamp can be obtained before each second interface is called, and then another timestamp can be obtained after the second interface is completed. The difference between the two timestamps can be used to obtain the response time of the second interface being called.
[0093] When a tester initiates a business process, it triggers a call to the first interface and simultaneously monitors the second interface. After the business process completes, the cache stores the call data of the first interface involved in this call. Subsequent analysis of this information allows the tester to determine the call chain of the target interface. Since the cache already stores the interface identifiers of the first and second interfaces, as well as the parent interface identifier, querying the parent interface identifier `fartherIdentityId` (which has the same `identityId` value as the first interface) from the second interface reveals all the sub-interfaces included in the call chain of the first interface. Then, querying the two second interfaces whose parent interface identifier `fartherIdentityId` has the same value as the interface identifier `myIdentityId` further determines the call relationship between the two second interfaces. From this, the call information of the first interface—the call chain and call parameters—can be deduced. Testers can directly see the response time of each sub-interface within the first interface and the call chain involving multiple sub-interfaces through this call information. Based on this information, testers can clearly identify which sub-interfaces are causing the slow response time of the target interface.
[0094] As can be seen, the above mainly describes the technical solutions provided by the embodiments of this disclosure from a methodological perspective. To achieve the above functions, it includes corresponding hardware structures and / or software modules for executing each function. Those skilled in the art should readily recognize that, in conjunction with the modules and algorithm steps of the various examples described in the embodiments disclosed herein, the embodiments of this disclosure can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed in hardware or by computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this disclosure.
[0095] This embodiment of the disclosure can divide the interface call information determining device into functional modules according to the above method example. For example, each function can be divided into a separate functional module, or two or more functions can be integrated into one processing module. The integrated module can be implemented in hardware or as a software functional module. Optionally, the module division in this embodiment of the disclosure is illustrative and only represents one logical functional division. In actual implementation, there may be other division methods.
[0096] like Figure 4 As shown, an interface call information determination device 400 provided in an embodiment of this disclosure includes:
[0097] The interface determination module 410 is used to determine the first interface and the second interface from a pre-set interface packet path;
[0098] The call request acquisition module 420 is used to acquire all call requests included in the execution process of the first interface mentioned above;
[0099] The request header addition module 430 is used to add a request header to the call request for calling the above call object, which is an interface method, in response to the above call request. The request header includes the interface identifier of the interface that calls the above call object. The interface identifier uniquely corresponds to the interface that calls the above call object.
[0100] The request header processing module 440 is used to determine the parent interface identifier corresponding to the second interface and the interface identifier uniquely corresponding to the second interface when the second interface in the interface package path is called, in response to the request header for calling the second interface containing a request header item; the parent interface identifier includes the interface identifier for calling the second interface in the request header item.
[0101] The call information determination module 450 is used to determine the call information of the first interface based on the interface identifier uniquely corresponding to the first interface, the parent interface identifier corresponding to the second interface, and the interface identifier uniquely corresponding to the second interface. The call information includes a call chain, which is used to indicate all second interfaces included in the execution of the first interface and the call relationship between the second interfaces.
[0102] Optionally, in one possible implementation, the interface determination module mentioned above includes:
[0103] The first display unit is used to display a first display interface, the first display interface including the interface information input area of the first interface;
[0104] The first interface determination unit is used to respond to the user's input operation based on the interface information input area of the first interface and determine the interface corresponding to the input operation as the first interface from the pre-set interface packet path;
[0105] The second interface determination unit is used to determine the interfaces in the interface packet path other than the first interface as the second interface.
[0106] Optionally, in one possible implementation, the above-mentioned apparatus further includes:
[0107] The first interface data acquisition module is used to acquire the first method name of the first interface and randomly generate a first random number.
[0108] The first interface identifier determination module is used to concatenate the first random number with the first method name to obtain an interface identifier that uniquely corresponds to the first interface.
[0109] Optionally, in one possible implementation, the above request header processing module includes:
[0110] The parent interface identifier unit is used to determine the parent interface identifier corresponding to the second interface based on the interface identifier that calls the second interface in the request header.
[0111] The second interface data acquisition unit is used to acquire the second method name of the second interface and randomly generate a second random number.
[0112] The second interface identifier determination unit is used to concatenate the second random number with the second method name to obtain an interface identifier that uniquely corresponds to the second interface.
[0113] Optionally, in one possible implementation, the above-mentioned call information also includes call parameters, which are used to indicate the response time of each second interface being called.
[0114] This disclosure provides an interface call information determination device for executing the method required by any device in the aforementioned data integrity determination system. This interface call information determination device may be the interface call information determination device described in this disclosure, or a module within an interface call information determination apparatus; it may also be a chip within an interface call information determination device, or other apparatus for executing the interface call information determination method; this disclosure does not limit its scope.
[0115] When implemented in hardware, the interface call information in this application embodiment determines the specific implementation method of the device, as follows: Figure 5 As shown, Figure 5 This is a schematic diagram of an interface call information determining device provided in an embodiment of the present disclosure. The interface call information determining device 500 includes at least one processor 501, a communication line 502, and at least one communication interface 504, and may also include a memory 503. The processor 501, memory 503, and communication interface 504 are connected to each other via the communication line 502.
[0116] The processor 501 may be a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement embodiments of the present disclosure, such as one or more digital signal processors (DSPs), or one or more field-programmable gate arrays (FPGAs).
[0117] Communication line 502 may include a path for transmitting information between the aforementioned components.
[0118] The communication interface 504 is used to communicate with other devices or communication networks. It can use any transceiver-like device, such as Ethernet, radio access network (RAN), wireless local area network (WLAN), etc.
[0119] The memory 503 may be a read-only memory (ROM) or other type of static storage device capable of storing static information and instructions, random access memory (RAM) or other type of dynamic storage device capable of storing information and instructions, or electrically erasable programmable read-only memory (EEPROM), compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical discs, laser discs, optical discs, digital universal optical discs, Blu-ray discs, etc.), magnetic disk storage media or other magnetic storage devices, or any other medium capable of including or storing desired program code in the form of instructions or data structures and accessible by a computer, but not limited thereto.
[0120] In one possible design, the memory 503 can exist independently of the processor 501, meaning the memory 503 can be an external memory of the processor 501. In this case, the memory 503 can be connected to the processor 501 via a communication line 502 to store execution instructions or application code, and its execution is controlled by the processor 501 to implement the interface call information determination method provided in the following embodiments of this disclosure. In another possible design, the memory 503 can also be integrated with the processor 501, meaning the memory 503 can be an internal memory of the processor 501. For example, the memory 503 can be a cache, used to temporarily store some data and instruction information.
[0121] As one possible implementation, processor 501 may include one or more CPUs, for example Figure 5 CPU0 and CPU1 in the example. As another possible implementation, the interface call information determines that device 500 may include multiple processors, such as... Figure 5 The processors 501 and 507 are included. Alternatively, the interface call information determining device 500 may also include an output device 505 and an input device 506.
[0122] Through the above description of the implementation methods, those skilled in the art will clearly understand that, for the sake of convenience and brevity, only the division of the above functional modules is used as an example. In practical applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the network node can be divided into different functional modules to complete all or part of the functions described above. The specific working process of the system, modules, and network nodes described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0123] This disclosure also provides a computer-readable storage medium storing instructions that, when executed by a computer, perform each step of the method flow shown in the above method embodiments.
[0124] The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of computer-readable storage media (a non-exhaustive list) include: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), registers, hard disks, optical fibers, compact disc read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing, or any other form of computer-readable storage medium in the art. An exemplary storage medium is coupled to a processor, enabling the processor to read information from and write information to the storage medium. Of course, the storage medium may also be a component of the processor. The processor and the storage medium may reside in an application-specific integrated circuit (ASIC). In this embodiment of the disclosure, the computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
[0125] Embodiments of this disclosure provide a chip including a processor and a communication interface. The communication interface and the processor are coupled, and the processor is used to run computer programs or instructions to implement the interface call information determination method as described in the above method embodiments. Since the apparatus, device, computer-readable storage medium, and computer program product in the embodiments of this disclosure can be applied to the above methods, the technical effects obtained can also be referred to the above method embodiments, and the embodiments of this disclosure will not be repeated here.
[0126] In the several embodiments provided in this application, it should be understood that the disclosed systems, devices, and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative; for instance, the division of the units described above is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.
[0127] The units described above as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0128] In addition, the functional units in the various embodiments of this 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.
[0129] The above are merely specific embodiments of this disclosure, but the scope of protection of this disclosure is not limited thereto. Any changes or substitutions within the technical scope disclosed in this disclosure should be included within the scope of protection of this disclosure. Therefore, the scope of protection of this disclosure should be determined by the scope of the claims.
Claims
1. A method for determining interface call information, characterized in that, The method includes: Determine the first interface and the second interface from the pre-set interface package path; Obtain all call requests included in the execution process of the first interface; In response to the call request, if the calling object is an interface method, a request header is added to the call request for calling the calling object. The request header includes an interface identifier for calling the interface of the calling object, and the interface identifier uniquely corresponds to the interface for calling the calling object. When the second interface in the interface package path is called, in response to the request header field in the request header used to call the second interface, the parent interface identifier corresponding to the second interface and the interface identifier uniquely corresponding to the second interface are determined; the parent interface identifier includes the interface identifier of the interface that calls the second interface in the request header field; Based on the interface identifier uniquely corresponding to the first interface, the parent interface identifier corresponding to the second interface, and the interface identifier uniquely corresponding to the second interface, the call information of the first interface is determined. The call information includes a call chain, which is used to indicate all second interfaces included in the execution of the first interface and the call relationship between the second interfaces. The method further includes: Obtain the first method name of the first interface and randomly generate a first random number; The first random number is concatenated with the first method name to obtain an interface identifier that uniquely corresponds to the first interface. The process of determining the parent interface identifier corresponding to the second interface and the interface identifier uniquely corresponding to the second interface includes: The parent interface identifier corresponding to the second interface is determined based on the interface identifier of the interface that calls the second interface in the request header; Obtain the second method name of the second interface and randomly generate a second random number; The second random number is concatenated with the second method name to obtain an interface identifier that uniquely corresponds to the second interface.
2. The method according to claim 1, characterized in that, The first and second interfaces are determined from the pre-set interface package paths, including: Display a first display interface, the first display interface including the interface information input area of the first interface; In response to a user's input operation based on the interface information input area of the first interface, the interface corresponding to the input operation is determined from the pre-set interface packet path as the first interface; The interfaces in the interface package path other than the first interface are designated as the second interface.
3. The method according to claim 1, characterized in that, The call information also includes call parameters, which are used to indicate the response time for each second interface to be called.
4. An interface call information determination device, characterized in that, The device includes: The interface determination module is used to determine the first interface and the second interface from a pre-set interface packet path; The call request acquisition module is used to acquire all call requests included in the execution process of the first interface; The request header addition module is used to add a request header to the call request for calling the call object when the calling object is an interface method. The request header includes an interface identifier for calling the interface of the call object, and the interface identifier uniquely corresponds to the interface for calling the call object. The request header processing module is used to determine the parent interface identifier corresponding to the second interface and the interface identifier uniquely corresponding to the second interface when the second interface in the interface package path is called, in response to the request header for calling the second interface containing a request header item; the parent interface identifier includes the interface identifier of the interface that calls the second interface in the request header item. The call information determination module is used to determine the call information of the first interface based on the interface identifier uniquely corresponding to the first interface, the parent interface identifier corresponding to the second interface, and the interface identifier uniquely corresponding to the second interface. The call information includes a call chain, which is used to indicate all second interfaces included in the execution of the first interface and the call relationship between the second interfaces. The device further includes: The first interface data acquisition module is used to acquire the first method name of the first interface and randomly generate a first random number; The first interface identifier determination module is used to concatenate the first random number with the first method name to obtain an interface identifier that uniquely corresponds to the first interface. The process of determining the parent interface identifier corresponding to the second interface and the interface identifier uniquely corresponding to the second interface includes: The parent interface identifier corresponding to the second interface is determined based on the interface identifier of the interface that calls the second interface in the request header; The second interface data acquisition module is used to acquire the second method name of the second interface and randomly generate a second random number; The second interface identifier determination module is used to concatenate the second random number with the second method name to obtain an interface identifier that uniquely corresponds to the second interface.
5. The apparatus according to claim 4, characterized in that, The interface determination module includes: The first display unit is used to display a first display interface, the first display interface including the interface information input area of the first interface; The first interface determination unit is used to determine the interface corresponding to the input operation as the first interface from a pre-set interface packet path in response to the user's input operation based on the interface information input area of the first interface; The second interface determination unit is used to determine the interfaces in the interface packet path other than the first interface as the second interface.
6. A device for determining interface call information, characterized in that, include: A processor and a memory; wherein the memory is used to store computer execution instructions, and when the interface call information determining device is running, the processor executes the computer execution instructions stored in the memory to cause the interface call information determining device to perform the interface call information determining method according to any one of claims 1-3.
7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores instructions that, when executed by the processor of the interface call information determining device, cause the interface call information determining device to perform the interface call information determining method according to any one of claims 1-3.
Citation Information
Patent Citations
Interface calling link generation method and device, equipment and readable storage medium
CN113360300A