Interface usage amount statistical method and device, storage medium and electronic equipment
By embedding the usage statistics acquisition end in the interface Jar package, the problem of the inability to quickly count the impact range when interface logic changes in microservice technology is solved, and the rapid and effective statistics of the usage of interface parameters is achieved, and the refinement of service governance is improved.
Patent Information
- Application Number
- CN202311451529.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-02
- Publication Date
- 2025-05-06
AI Technical Summary
In microservice technology, when the interface logic is changed, it is impossible to quickly and effectively count which callers are affected, or to adjust the interface method logic based on the usage of the outgoing parameters, and it is impossible to know the usage of the specific parameters.
By embedding the usage statistics acquisition end in the interface Jar package, using annotation information to collect data, obtain the interface usage collection data, and send it to the usage statistics analysis party, and generate an interface report for the interface provider to query.
It realizes rapid and effective statistics on the usage of parameters in the interface, and obtains the usage of each parameter in the interface in real time, so that the interface provider can quickly understand the changes in parameters, reduce the impact of interface changes, and improve the refinement of service governance.
Smart Images

Figure CN119938726A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of data processing, and in particular to an interface usage statistics method, an interface usage statistics device, a storage medium, and an electronic device. Background Art
[0002] With the rapid development of internet technology, the application of microservices is becoming increasingly widespread. Java services typically interact with each other by importing Jar packages and calling the service provider's RPC interface. However, as businesses expand and microservice applications increase, the number of interface callers also increases.
[0003] If the interface logic changes, such as deleting certain fields from the interface output parameters, it is impossible to know which callers are affected; or if the interface method logic is adjusted and optimized based on the usage of the output parameters, it is impossible to know the usage of the specific parameters. Therefore, how to quickly and effectively count the usage of the parameters in the interface is particularly important.
[0004] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present disclosure, and therefore may include information that does not constitute prior art known to ordinary technicians in the field. Summary of the Invention
[0005] The purpose of the present disclosure is to provide an interface usage statistics method, an interface usage statistics device, a storage medium and an electronic device, aiming to solve the problem of quickly and effectively performing parameter usage statistics in an interface.
[0006] Other features and advantages of the present disclosure will become apparent from the following detailed description, or may be learned in part by practice of the present disclosure.
[0007] According to one aspect of an embodiment of the present disclosure, a method for interface usage statistics is provided, which is applied to an interface caller, and the method comprises: introducing an interface Jar package configured by an interface provider; wherein the interface Jar package comprises annotation information and a usage statistics collection terminal; when the interface provider calls the interface through the interface caller, the usage statistics collection terminal collects data based on the annotation information to obtain interface usage collection data; wherein the interface usage collection data comprises usage data of each attribute field in the output parameter and / or input parameter of the interface; and the interface usage collection data is sent to a usage statistics analysis party, so that the usage statistics analysis party generates an interface report based on the interface usage collection data for query by the interface provider.
[0008] According to some embodiments of the present disclosure, based on the aforementioned solution, the introduction of the interface Jar package configured by the interface provider includes: obtaining the interface Jar package in the form of interface Maven dependency; and configuring interface information based on the interface Jar package to complete the introduction of the interface Jar package.
[0009] According to some embodiments of the present disclosure, based on the aforementioned scheme, the usage statistics collection end performs data collection based on the annotation information to obtain interface usage collection data, including: extracting collection parameters of the interface to be monitored based on the annotation information, and a method for obtaining the collection parameters; asynchronously collecting the interface usage collection data through the usage statistics collection end according to the method for obtaining the collection parameters.
[0010] According to some embodiments of the present disclosure, based on the aforementioned solution, sending the interface usage collection data to the usage statistics analysis party includes: sending the interface usage collection data to the usage statistics analysis party via the User Datagram Protocol UDP.
[0011] According to a second aspect of an embodiment of the present disclosure, an interface usage statistics method is provided for application to a usage statistics analysis party, the method comprising: obtaining interface usage collection data sent by an interface caller; wherein the interface usage collection data comprises usage data of each attribute field in the output parameters and / or input parameters of the interface; parsing the interface usage collection data to obtain usage monitoring data of a usage monitoring object; and generating an interface report based on the usage monitoring data of each usage monitoring object for query by an interface provider.
[0012] According to some embodiments of the present disclosure, based on the aforementioned scheme, the parsing of the interface usage collection data to obtain the usage monitoring data of the usage monitoring object includes: obtaining interface basic information; wherein, the interface basic information is pre-configured according to the interface information of the interface registration center; determining the usage monitoring object based on the interface basic information and the interface usage collection data; and determining the usage monitoring data of the usage monitoring object based on the interface usage collection data.
[0013] According to some embodiments of the present disclosure, based on the aforementioned scheme, the method also includes: pre-configuring the interface basic information based on the interface registration center, and the pre-configuration of the interface basic information based on the interface registration center includes: obtaining the interface information configured by the interface provider in the interface registration center; and configuring the interface basic information accordingly based on the interface information.
[0014] According to some embodiments of the present disclosure, based on the aforementioned scheme, the generation of an interface report based on the usage monitoring data of each usage monitoring object includes: obtaining preset query conditions; wherein the query conditions include a preset time period and a target usage monitoring object; extracting the usage monitoring data of the target usage monitoring object within the preset time period from the usage monitoring data of each usage monitoring object to generate an interface report corresponding to the query conditions.
[0015] According to a third aspect of an embodiment of the present disclosure, an interface usage statistics device is provided, comprising: an introduction module for introducing an interface Jar package configured by an interface provider; wherein the interface Jar package includes annotation information and a usage statistics collection end; a collection module for, when the interface provider calls the interface through the interface caller, the usage statistics collection end performs data collection based on the annotation information to obtain interface usage collection data; wherein the interface usage collection data includes usage data of each attribute field in the output parameter and / or input parameter of the interface; a sending module for sending the interface usage collection data to a usage statistics analysis party, so that the usage statistics analysis party generates an interface report for query by the interface provider based on the interface usage collection data.
[0016] According to a fourth aspect of an embodiment of the present disclosure, an interface usage statistics device is provided, comprising: an acquisition module for acquiring interface usage collection data sent by an interface caller; wherein the interface usage collection data includes usage data of each attribute field in the output parameter and / or input parameter of the interface; a parsing module for parsing the interface usage collection data to obtain usage monitoring data of a usage monitoring object; and a statistics module for generating an interface report based on the usage monitoring data of each usage monitoring object for query by an interface provider.
[0017] According to a fifth aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided, on which a computer program is stored. When the program is executed by a processor, the interface usage statistics method in the above embodiment is implemented.
[0018] According to the fifth aspect of the embodiments of the present disclosure, an electronic device is provided, characterized in that it includes: one or more processors; a storage device for storing one or more programs, when the one or more programs are executed by the one or more processors, the one or more processors implement the interface usage statistics method as in the above-mentioned embodiment.
[0019] The exemplary embodiments of the present disclosure may have some or all of the following beneficial effects:
[0020] In the technical solutions provided by some embodiments of the present disclosure, by embedding a usage statistics collection terminal in an interface Jar package, it is possible to obtain interface usage data through the usage statistics collection terminal when calling the interface, and then send the interface usage data to the usage statistics analysis party for generating interface reports, completing interface usage statistics for query by the interface provider. On the one hand, by collecting interface usage and generating interface reports, the usage of each parameter in the interface can be obtained in real time, which facilitates the interface provider to quickly understand the parameter changes. The interface provider can directly analyze and evaluate the impact of the data without the interface caller's feedback, thereby facilitating the execution of subsequent operations such as interface downgrade and method offline, reducing the impact of interface changes; on the other hand, the usage data of each attribute field in the interface output parameter and input parameter is collected, which is more detailed than the granularity of simple interface usage statistics, and can make service governance more refined; on the other hand, the usage statistics collection terminal is already merged when packaging the interface Jar package, which can achieve non-intrusive data collection for the interface provider and caller, and fast access to multiple systems and multiple interfaces, greatly improving development efficiency.
[0021] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] The accompanying drawings are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the specification, are used to explain the principles of the present disclosure. Obviously, the drawings described below are only some embodiments of the present disclosure, and those skilled in the art can derive other drawings based on these drawings without inventive effort. In the drawings:
[0023] Figure 1 A schematic diagram schematically illustrates a flow chart of a method for counting interface usage in an exemplary embodiment of the present disclosure;
[0024] Figure 2 A system architecture diagram schematically illustrates a method for counting interface usage in an exemplary embodiment of the present disclosure;
[0025] Figure 3 A schematic diagram schematically illustrates a flow chart of another method for counting interface usage in an exemplary embodiment of the present disclosure;
[0026] Figure 4 A schematic diagram schematically illustrates a flow chart of a method for analyzing usage collection data in an exemplary embodiment of the present disclosure;
[0027] Figure 5 A schematic diagram schematically illustrates a process flow for collecting and analyzing interface usage in an exemplary embodiment of the present disclosure;
[0028] Figure 6 The following is a schematic diagram showing the composition of an interface usage statistics device in an exemplary embodiment of the present disclosure;
[0029] Figure 7 A schematic diagram schematically illustrates the composition of another device for counting interface usage in an exemplary embodiment of the present disclosure;
[0030] Figure 8 A schematic diagram schematically illustrates a computer-readable storage medium in an exemplary embodiment of the present disclosure;
[0031] Figure 9 The following schematically shows a structural diagram of a computer system of an electronic device in an exemplary embodiment of the present disclosure. DETAILED DESCRIPTION
[0032] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in many forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete and will fully convey the concepts of the example embodiments to those skilled in the art.
[0033] In addition, the described features, structures or characteristics may be combined in any suitable manner in one or more embodiments. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present disclosure. However, those skilled in the art will appreciate that the technical solutions of the present disclosure can be practiced without one or more of the specific details, or other methods, components, devices, steps, etc. can be adopted. In other cases, well-known methods, devices, implementations or operations are not shown or described in detail to avoid blurring various aspects of the present disclosure.
[0034] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically separate entities. That is, these functional entities may be implemented in software, in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.
[0035] The flowcharts shown in the accompanying drawings are for illustrative purposes only and do not necessarily include all contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps may be decomposed, while others may be combined or partially combined. Therefore, the actual execution order may vary depending on the actual situation.
[0036] With the rapid development of internet technology, the application of microservices is becoming increasingly widespread. Java services typically interact with each other by importing Jar packages and calling the service provider's RPC interface. However, as businesses expand and microservice applications increase, the number of interface callers also increases.
[0037] The impact of changes to interface method output parameters is often notified to each caller via email or other means to assess whether a certain method is called and whether a certain field is used. Specifically, if the business logic changes, it is impossible to obtain the usage of the various attribute fields in the interface output parameters involved in the business, and it is impossible to accurately assess the scope of impact and notify the callers. Using email and other methods is time-consuming, and the impact assessment often depends on the caller, which poses a greater risk. In addition, during service governance, it is impossible to obtain the usage of the various attribute fields in the interface method output parameters, and it is impossible to downgrade the interface based on its usage value. The user experience is often reduced by downgrading the entire method. At the same time, as the business changes, some methods in the interface need to be offline, but it is impossible to obtain the usage of the methods by each caller.
[0038] Therefore, in order to make up for the shortcomings of the existing technology and facilitate real-time and effective statistics of interface usage, the present invention develops a common component for monitoring, statistical analysis of the usage of various attribute fields of general interface output parameters to refine service governance monitoring and analysis. By configuring the attributes and collection methods of the collection parameters, the usage of the output parameters is asynchronously collected when the interface is called, and reported to the server through UDP messages, stored and analyzed, so as to achieve non-intrusion to the provider and caller of the interface, and rapid access to multiple systems and multiple interfaces, thereby reducing the impact range assessment costs caused by interface changes, configurable settings, and reducing unnecessary statistics.
[0039] The implementation details of the technical solution of the embodiment of the present disclosure are described in detail below.
[0040] Figure 1 The following schematically illustrates a flow chart of an interface usage statistics method in an exemplary embodiment of the present disclosure, which is applied to the interface caller. Figure 1 As shown, the interface usage statistics method includes steps S101 to S103:
[0041] Step S101: importing the interface Jar package configured by the interface provider; wherein the interface Jar package includes annotation information and a usage statistics collection terminal;
[0042] Step S102: When the interface provider calls the interface through the interface caller, the usage statistics collection terminal collects data based on the annotation information to obtain interface usage collection data; wherein the interface usage collection data includes usage data of each attribute field in the output parameter and / or input parameter of the interface;
[0043] Step S103: sending the interface usage collection data to a usage statistics analysis party, so that the usage statistics analysis party generates an interface report based on the interface usage collection data for query by the interface provider.
[0044] In the technical solutions provided by some embodiments of the present disclosure, by embedding a usage statistics collection terminal in an interface Jar package, it is possible to obtain interface usage data through the usage statistics collection terminal when calling the interface, and then send the interface usage data to the usage statistics analysis party for generating interface reports, completing interface usage statistics for query by the interface provider. On the one hand, by collecting interface usage and generating interface reports, the usage of each parameter in the interface can be obtained in real time, which facilitates the interface provider to quickly understand the parameter changes. The interface provider can directly analyze and evaluate the impact of the data without the interface caller's feedback, thereby facilitating the execution of subsequent operations such as interface downgrade and method offline, reducing the impact of interface changes; on the other hand, the usage data of each attribute field in the interface output parameter and input parameter is collected, which is more detailed than the granularity of simple interface usage statistics, and can make service governance more refined; on the other hand, the usage statistics collection terminal is already merged when packaging the interface Jar package, which can achieve non-intrusive data collection for the interface provider and caller, and fast access to multiple systems and multiple interfaces, greatly improving development efficiency.
[0045] The following describes in more detail the steps of the interface usage statistics method in this example implementation with reference to the accompanying drawings and embodiments.
[0046] Figure 2 The system architecture diagram of an interface usage statistics method in an exemplary embodiment of the present disclosure is schematically shown. Figure 2 As shown, the system of the interface usage statistics method includes an interface registration center 201, an interface caller 202, an interface provider 203, and a usage statistics analysis unit 204. The interface caller 202 includes a usage statistics collection terminal 2021, and the usage statistics analysis unit 204 includes a usage statistics management terminal 2041, a usage statistics service terminal 2042, and a data storage module 2043.
[0047] It should be noted that the method provided in this disclosure improves upon the existing microservices infrastructure. In existing microservices, interface providers register interfaces through an interface registration center, and interface callers then call pre-registered interfaces. This means that the interface registration center 201, interface callers 202, and interface providers 203 are all existing architectures. However, this disclosure introduces a new usage statistics and analysis method 204, which performs statistical analysis on the interface usage data collected by interface callers 203. The specific process will be explained in detail later.
[0048] In step S101, the interface Jar package configured by the interface provider is introduced; wherein the interface Jar package includes annotation information and a usage statistics collection terminal.
[0049] In one embodiment of the present disclosure, the configured interface Jar package is directly introduced in step S101 , and the interface Jar package may be pre-packaged by the interface provider.
[0050] Specifically, the interface provider annotates the collection parameters and get methods of the monitored interface (@RespMonitor), and packages them together with the usage statistics collection client into a JAR file. Specifically, the provider includes the collection client's Maven dependency in the project's POM file within the interface definition. Once the interface is developed, it is packaged into a JAR file using the Maven package command and uploaded to the Maven repository.
[0051] In one embodiment of the present disclosure, the introducing the interface Jar package configured by the interface provider includes: obtaining the interface Jar package in the form of interface Maven dependency; and configuring interface information based on the interface Jar package to complete the introduction of the interface Jar package.
[0052] Mave is a Java-based project management and integration tool that abstracts the project development and management process into a Project Object Model (POM). Developers only need to perform some simple configuration, and Mave will automatically complete the project's compilation, testing, packaging, release, and deployment.
[0053] To use an interface, the caller must import the interface JAR package through Maven. When calling the interface in a program, configure interface information such as the alias, caller system name, and caller application name.
[0054] In step S102, when the interface provider calls the interface through the interface caller, the usage statistics collection end collects data based on the annotation information to obtain interface usage collection data.
[0055] In one embodiment of the present disclosure, when calling the interface, the usage statistics collection end in step S102 performs data collection based on the annotation information to obtain interface usage collection data, including: extracting the collection parameters of the interface to be monitored based on the annotation information, and the method for obtaining the collection parameters; asynchronously collecting the interface usage collection data through the usage statistics collection end according to the method for obtaining the collection parameters.
[0056] Specifically, when packaging the interface Jar package, annotation information has been marked in advance. The annotation information includes the collection parameters of the interface to be monitored and the get method of the collection parameters. In this way, when the interface is called, the get method of the collection parameters marked with annotations will be recorded by the usage statistics collection end thread, and asynchronous data collection will be performed to obtain the interface usage collection data.
[0057] It should be noted that the collected interface usage data includes the usage data of each attribute field in the interface's output parameters and each attribute field in the input parameters. Compared with simple interface usage statistics, the data granularity is more detailed, thereby refining service governance.
[0058] In step S103, the interface usage collection data is sent to a usage statistics analysis party, so that the usage statistics analysis party generates an interface report based on the interface usage collection data for query by the interface provider.
[0059] In one embodiment of the present disclosure, sending the interface usage collection data to the usage statistics analysis party includes: sending the interface usage collection data to the usage statistics analysis party via the User Datagram Protocol UDP.
[0060] Specifically, refer to Figure 2 As shown, the usage statistics collection end can automatically send a UDP (User Datagram Protocol) message to the usage statistics server end of the usage statistics analysis party.
[0061] At this point, the interface caller has completed rapid access, greatly reducing the cost of implementing usage data monitoring.
[0062] Figure 3 The flowchart of another interface usage statistics method in the exemplary embodiment of the present disclosure is schematically shown, which is applied to the usage statistics analysis. Figure 3 As shown, the interface usage statistics method includes steps S301 to S303:
[0063] Step S301: Acquire interface usage data sent by the interface caller; wherein the interface usage data includes usage data of each attribute field in the output parameter and / or input parameter of the interface;
[0064] Step S302: parsing the interface usage collection data to obtain usage monitoring data of the usage monitoring object;
[0065] Step S303: Generate an interface report based on the usage monitoring data of each usage monitoring object for query by an interface provider.
[0066] Specifically, in step S302, Figure 4 A schematic diagram of a method for analyzing usage data collection in an exemplary embodiment of the present disclosure is shown schematically. Figure 4 As shown, the method for analyzing usage data collection specifically includes the following steps:
[0067] Step S401, obtaining basic interface information; wherein the basic interface information is pre-configured according to the interface information of the interface registration center;
[0068] Specifically, the interface provider registers the interface with the interface registration center and configures the basic interface information of the usage statistics and analysis provider based on the interface information in the interface registration center. The basic interface information includes the input parameters, output parameters, and attribute dictionary of the interface.
[0069] It should be noted that the reference Figure 2 As shown, the configuration interface basic information may be completed by the usage statistics management terminal 2041 of the usage statistics analysis party 204 .
[0070] Step S402: determining a usage monitoring object based on the interface basic information and the interface usage collection data;
[0071] Specifically, after receiving the interface usage collection data, the interface usage collection data is combined with the interface basic information read by the usage statistics management terminal to be completed and assembled into a usage monitoring object.
[0072] Step S403: determining usage monitoring data of the usage monitoring object according to the interface usage collection data.
[0073] Specifically, after the usage monitoring object is determined, the usage monitoring data corresponding to the usage monitoring object is extracted from the received interface usage collection data.
[0074] It should be noted that the reference Figure 2 As shown, steps S401 to S403 may be completed by the usage statistics server 2042 of the usage statistics analyzer 204 .
[0075] In one embodiment of the present disclosure, after extracting the usage monitoring data corresponding to the usage monitoring object, it can be stored in ES (Elastic Search) (refer to Figure 2 2043) and provides query services to the usage statistics management terminal for statistical analysis. Elastic Search is a Lucene-based search server. It provides a distributed, multi-user, full-text search engine based on a RESTful web interface.
[0076] In step S303, an interface report is generated based on the usage monitoring data of each usage monitoring object for query by an interface provider.
[0077] In one embodiment of the present disclosure, the generation of an interface report based on the usage monitoring data of each usage monitoring object includes: obtaining preset query conditions; wherein the query conditions include a preset time period and a target usage monitoring object; extracting the usage monitoring data of the target usage monitoring object within the preset time period from the usage monitoring data of each usage monitoring object to generate an interface report corresponding to the query conditions.
[0078] Specifically, you can query the call volume of a certain interface in a certain period of time and the usage of the input and output parameter attributes involved in the interface method according to conditions, such as the usage of various attributes of the output parameters of a certain interface method by different applications in a certain period of time.
[0079] Therefore, the query conditions can be configured according to the needs, including querying the usage monitoring data of the target usage monitoring object within a preset time period, and then extracting the data from the data storage module.
[0080] In one embodiment of the present disclosure, the interface report is shown in Table 1:
[0081] Table 1 Interface report
[0082] Field Name type describe Id Integer Primary key ID TraceId String Interface method call tracking ID InterfaceName String Interface Name MethodName String Interface method name Type int Collection type: 0: method, 1: input parameter, 2: output parameter paramClass String Parameter attribute class name Param int(11) Parameter attribute name Count int(11) Usage CreateTime Date Collection time
[0083] It should be noted that the reference Figure 2 As shown, step S303 can be completed by the usage statistics management terminal 2041 of the usage statistics analysis party 204. The usage statistics management terminal can control whether to start data collection, processing, storage, and analysis to reduce unnecessary waste of computing and storage resources.
[0084] Figure 5 Schematically shows a flow chart of interface usage collection and analysis in an exemplary embodiment of the present disclosure, with reference to Figure 5 As shown, the interface usage collection and analysis specifically includes the following steps:
[0085] Step S501: The interface caller introduces interface dependency;
[0086] To use the interface, the caller must import the interface client JAR package through Maven. Then, when calling the interface in the program, they must configure interface-related information, such as the alias, token, and caller application.
[0087] Step S502: the interface caller calls the interface;
[0088] During program execution, the interface caller invokes the interface, and the interface service provider returns the result based on the business logic. The caller processes the interface output parameters into the required information and calls the get method for the desired attribute field. The usage statistics collection terminal intercepts the get method based on the @RespMonitor annotation on the output parameter attributes. It asynchronously assembles the information based on its aspects and sends the collected information via UDP.
[0089] Step S503: the usage statistics server receives and stores the information;
[0090] The usage statistics server receives the UDP message, completes the message with the management terminal configuration information, assembles it into a statistical object (i.e., usage monitoring object), and stores it in ES (Elastic Search).
[0091] Step S504: analyzing and collecting the usage statistics management report results;
[0092] The usage statistics management terminal performs statistical analysis on the data in ES by application, interface, output parameter fields and other dimensions.
[0093] Based on the above method, a refined service governance monitoring and analysis platform is provided. When the interface publishes the client Jar package, the data collection terminal is also packaged. When the interface is called, the caller collects data through the interface usage monitoring collection terminal and sends UDP messages to the server for data reception, cleaning, and storage. The server performs a unified analysis of the output parameters and attributes of each system and interface on the stored data. On the one hand, this simplifies the implementation cost of data collection and quickly completes the integration of the usage monitoring component. On the other hand, it is non-invasive to the interface caller and provider, greatly improving development efficiency.
[0094] Figure 6 The following schematically shows the composition of an interface usage statistics device in an exemplary embodiment of the present disclosure. Figure 6 As shown, the interface usage statistics device 600 may include an introduction module 601, a collection module 602, and a sending module 603.
[0095] The import module 601 is used to import the interface Jar package configured by the interface provider; wherein the interface Jar package includes annotation information and a usage statistics collection terminal;
[0096] The collection module 602 is configured to collect data based on the annotation information when the interface provider calls the interface through the interface caller, and obtain interface usage data; wherein the interface usage data includes usage data of each attribute field in the output parameter and / or input parameter of the interface;
[0097] The sending module 603 is used to send the interface usage collection data to the usage statistics analysis party, so that the usage statistics analysis party generates an interface report based on the interface usage collection data for query by the interface provider.
[0098] According to an exemplary embodiment of the present disclosure, the introduction module 601 is used to obtain the interface Jar package in the form of interface Maven dependency; and configure interface information based on the interface Jar package to complete the introduction of the interface Jar package.
[0099] According to an exemplary embodiment of the present disclosure, the acquisition module 602 is used to extract the acquisition parameters of the interface to be monitored based on the annotation information, as well as the method for obtaining the acquisition parameters; according to the method for obtaining the acquisition parameters, the interface usage collection data is asynchronously collected through the usage statistics collection end.
[0100] According to an exemplary embodiment of the present disclosure, the sending module 603 is configured to send the interface usage collection data to the usage statistics analysis party via the User Datagram Protocol (UDP).
[0101] The specific details of each module in the above-mentioned interface usage statistics device 600 have been described in detail in the corresponding interface usage statistics method, so they are not repeated here.
[0102] Figure 7 A schematic diagram showing the composition of another interface usage statistics device in an exemplary embodiment of the present disclosure is shown as follows: Figure 7 As shown, the interface usage statistics device 700 may include an acquisition module 701, a parsing module 702, and a statistics module 703.
[0103] The acquisition module 701 is used to acquire the interface usage collection data sent by the interface caller; wherein the interface usage collection data includes the usage data of each attribute field in the output parameter and / or input parameter of the interface;
[0104] An analysis module 702 is configured to analyze the interface usage collection data to obtain usage monitoring data of a usage monitoring object;
[0105] The statistics module 703 is used to generate an interface report based on the usage monitoring data of each usage monitoring object for query by the interface provider.
[0106] According to an exemplary embodiment of the present disclosure, the parsing module 702 is used to obtain basic interface information; wherein, the basic interface information is pre-configured according to the interface information of the interface registration center; the usage monitoring object is determined based on the interface basic information and the interface usage collection data; and the usage monitoring data of the usage monitoring object is determined based on the interface usage collection data.
[0107] According to an exemplary embodiment of the present disclosure, the statistical module 703 is used to obtain preset query conditions; wherein, the query conditions include a preset time period and a target usage monitoring object; the usage monitoring data of the target usage monitoring object within the preset time period is extracted from the usage monitoring data of each usage monitoring object to generate an interface report corresponding to the query conditions.
[0108] The specific details of each module in the above-mentioned interface usage statistics device 700 have been described in detail in the corresponding interface usage statistics method, so they are not repeated here.
[0109] It should be noted that although several modules or units of the device for action execution are mentioned in the detailed description above, this division is not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of two or more modules or units described above can be concretized in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided into multiple modules or units to be concretized.
[0110] In an exemplary embodiment of the present disclosure, a storage medium capable of implementing the above method is also provided. Figure 8 A schematic diagram schematically illustrates a computer-readable storage medium in an exemplary embodiment of the present disclosure, as shown in FIG. Figure 8 As shown, a program product 800 for implementing the above method according to an embodiment of the present disclosure is described. The program product 800 may be a portable compact disc read-only memory (CD-ROM) and include program code, and may be run on a terminal device, such as a mobile phone. However, the program product of the present disclosure is not limited thereto. In this document, a readable storage medium may be any tangible medium containing or storing a program, which may be used by or in conjunction with an instruction execution system, apparatus, or device.
[0111] In an exemplary embodiment of the present disclosure, an electronic device capable of implementing the above method is also provided. Figure 9The following schematically shows a structural diagram of a computer system of an electronic device in an exemplary embodiment of the present disclosure.
[0112] It should be noted that Figure 9 The computer system 900 of the electronic device shown is only an example and should not limit the functions and scope of use of the embodiments of the present disclosure.
[0113] like Figure 9 As shown, the computer system 900 includes a central processing unit (CPU) 901, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 902 or the program loaded from the storage part 908 to the random access memory (RAM) 903. Various programs and data required for system operation are also stored in the RAM 903. The CPU 901, ROM 902 and RAM 903 are connected to each other via a bus 904. An input / output (I / O) interface 905 is also connected to the bus 904.
[0114] The following components are connected to the I / O interface 905: an input section 906 including a keyboard, a mouse, and the like; an output section 907 including devices such as a cathode ray tube (CRT), a liquid crystal display (LCD), and a speaker; a storage section 908 including a hard disk and the like; and a communication section 909 including a network interface card such as a LAN (Local Area Network) card or a modem. The communication section 909 performs communication processing via a network such as the Internet. A drive 910 is also connected to the I / O interface 905 as needed. Removable media 911, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, and the like, are installed in the drive 910 as needed, so that computer programs read therefrom can be installed into the storage section 908 as needed.
[0115] In particular, according to an embodiment of the present disclosure, the process described below with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network via the communication section 909, and / or installed from a removable medium 911. When the computer program is executed by the central processing unit (CPU) 901, various functions defined in the system of the present disclosure are executed.
[0116] It should be noted that the computer-readable medium shown in the embodiments of the present disclosure may be a computer-readable signal medium or a computer-readable storage medium or any combination of the two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or component, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, which carries a computer-readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer-readable medium may be transmitted using any suitable medium, including but not limited to wireless, wired, or any suitable combination thereof.
[0117] The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, program segment, or a part of code, and the above-mentioned module, program segment, or a part of code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in an order different from that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart, can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0118] The units involved in the embodiments described in this disclosure may be implemented in software or hardware, and the units described may also be provided in a processor. In some cases, the names of these units do not constitute limitations on the units themselves.
[0119] As another aspect, the present disclosure further provides a computer-readable medium, which may be included in the electronic device described in the above embodiments, or may exist independently and not incorporated into the electronic device. The computer-readable medium carries one or more programs, and when executed by the electronic device, the electronic device implements the methods described in the above embodiments.
[0120] It should be noted that although several modules or units of the device for action execution are mentioned in the detailed description above, this division is not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of two or more modules or units described above can be concretized in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided into multiple modules or units to be concretized.
[0121] Through the description of the above embodiments, it is easy for those skilled in the art to understand that the example embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solution according to the embodiments of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a touch terminal, or a network device, etc.) to execute the method according to the embodiments of the present disclosure.
[0122] Other embodiments of the present disclosure will readily occur to those skilled in the art after considering the specification and practicing the invention disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art not disclosed herein.
[0123] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes can be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A method for counting interface usage, characterized in that: Applied to the interface caller, the method includes: Introduce the interface Jar package configured by the interface provider; wherein the interface Jar package includes annotation information and a usage statistics collection terminal; When the interface provider calls the interface through the interface caller, the usage statistics collection end collects data based on the annotation information to obtain interface usage collection data; wherein the interface usage collection data includes usage data of each attribute field in the output parameter and / or input parameter of the interface; The interface usage collection data is sent to the usage statistics analysis party, so that the usage statistics analysis party generates an interface report based on the interface usage collection data for query by the interface provider.
2. The interface usage statistics method according to claim 1, characterized in that: The interface Jar package configured by the interface provider includes: Obtain the interface Jar package in the form of interface Maven dependency; Interface information is configured based on the interface Jar package to complete the introduction of the interface Jar package.
3. The interface usage statistics method according to claim 1, characterized in that: The usage statistics collection terminal collects data based on the annotation information to obtain interface usage collection data, including: Extracting the acquisition parameters of the interface to be monitored based on the annotation information, and a method for obtaining the acquisition parameters; The interface usage collection data is asynchronously collected through the usage statistics collection end according to the method for obtaining the collection parameters.
4. The interface usage statistics method according to claim 1, characterized in that: The step of sending the interface usage collection data to the usage statistics and analysis party includes: The interface usage collection data is sent to the usage statistics analysis party via the User Datagram Protocol UDP.
5. A method for counting interface usage, characterized in that: Applied to the usage statistics analysis method, the method includes: Acquire the interface usage collection data sent by the interface caller; wherein the interface usage collection data includes the usage data of each attribute field in the output parameter and / or input parameter of the interface; Parsing the interface usage collection data to obtain usage monitoring data of the usage monitoring object; An interface report is generated based on the usage monitoring data of each usage monitoring object for query by the interface provider.
6. The interface usage statistics method according to claim 5, characterized in that: The step of parsing the interface usage collection data to obtain usage monitoring data of the usage monitoring object includes: Obtaining basic interface information; wherein the basic interface information is pre-configured according to the interface information of the interface registration center; Determine a usage monitoring object according to the interface basic information and the interface usage collection data; The usage monitoring data of the usage monitoring object is determined according to the interface usage collection data.
7. The interface usage statistics method according to claim 5, characterized in that: The generating of the interface report based on the usage monitoring data of each usage monitoring object includes: Obtaining preset query conditions; wherein the query conditions include a preset time period and a target usage monitoring object; The usage monitoring data of the target usage monitoring object within the preset time period is extracted from the usage monitoring data of each usage monitoring object to generate an interface report corresponding to the query condition.
8. An interface usage statistics device, characterized in that: include: An import module is used to import the interface Jar package configured by the interface provider; wherein the interface Jar package includes annotation information and a usage statistics collection terminal; A collection module, used for, when the interface provider calls the interface through the interface caller, the usage statistics collection end performs data collection based on the annotation information to obtain interface usage collection data; wherein, the interface usage collection data includes usage data of each attribute field in the output parameter and / or input parameter of the interface; The sending module is used to send the interface usage collection data to the usage statistics analysis party, so that the usage statistics analysis party generates an interface report based on the interface usage collection data for the interface provider to query.
9. An interface usage statistics device, characterized in that: include: An acquisition module is used to acquire the interface usage collection data sent by the interface caller; wherein the interface usage collection data includes the usage data of each attribute field in the output parameter and / or input parameter of the interface; A parsing module, used for parsing the interface usage collection data to obtain usage monitoring data of the usage monitoring object; The statistics module is used to generate an interface report based on the usage monitoring data of each usage monitoring object for query by the interface provider.
10. A computer-readable storage medium having a computer program stored thereon, wherein when the program is executed by a processor, the method for counting the interface usage according to any one of claims 1 to 7 is implemented.
11. An electronic device, characterized in that: include: one or more processors; A storage device for storing one or more programs, which, when executed by the one or more processors, enables the one or more processors to implement the interface usage statistics method as described in any one of claims 1 to 7.