Methods, apparatus and related equipment for aggregating interface information
By parsing and aggregating service access logs using a prefix tree, the problem of poor aggregation of RESTful API information is solved, achieving efficient API information management and storage, and improving query efficiency and storage space utilization.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- BEIJING QIYI CENTURY SCI & TECH CO LTD
- Filing Date
- 2026-03-27
- Publication Date
- 2026-06-30
AI Technical Summary
In existing technologies, the aggregation effect of RESTful API information is poor, requiring code rewriting and complex parsing, and making it impossible to efficiently store and manage large amounts of API data.
By parsing the service access logs, identifying the attribute characteristics of the interface information, aggregating the interface information using a prefix tree, generating a simplified interface information structure, counting the number of accesses and retaining high-frequency interface information, and generating a prefix tree to improve aggregation efficiency.
Without rewriting the service code for interface information, it achieves efficient aggregation of interface information, simplifies data storage and retrieval, improves query efficiency, saves storage space, and provides more valuable information feedback.
Smart Images

Figure CN122309707A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of cloud computing technology, and in particular to a method, apparatus, and related equipment for aggregating interface information. Background Technology
[0002] Services using the HTTP protocol define numerous interfaces for user access, and a significant portion of these interfaces are RESTful, such as ` / api / v2 / uid / xxx`. When monitoring metrics for services with RESTful interfaces, including interface dimensions generates a large amount of metric data. For example, the total data volume for `xxx` is substantial, making aggregation necessary for storage. Current technologies typically aggregate interface descriptions based on the interface information. For instance, if the interface information is ` / api / v2 / uid / xxx` and the interface description is `uid`, the aggregated structure would be ` / api / v2 / uid / {uid}`. However, this storage method usually requires code rewriting and parsing to obtain complete interface information, resulting in poor aggregation performance for interface information in current technologies. Summary of the Invention
[0003] To address the aforementioned technical problems, this invention provides a method, apparatus, and related equipment for aggregating interface information, which can effectively improve the aggregation effect of interface information.
[0004] To achieve the above objectives, the technical solution adopted in the embodiments of the present invention is as follows:
[0005] In a first aspect of the present invention, a method for aggregating interface information is provided, the method comprising:
[0006] The text content included in the service access log is parsed to obtain N first interface information, where N is a positive integer, and the N first interface information are used to represent the N path data corresponding to the service access log;
[0007] The N first interface information are identified respectively to obtain N identification information. The identification information is used to indicate the M strings included in the corresponding interface information. The strings are used to indicate an interface attribute feature corresponding to the corresponding first interface information. M is a positive integer.
[0008] Based on the N identification information, the identical strings included in any two first interface information that have the same string among the N first interface information are aggregated, and different strings are concatenated after the identical string to generate Y second interface information, where Y is a positive integer less than N.
[0009] Optionally, based on the N identification information, the step of aggregating the identical strings included in any two first interface information pieces with the same string among the N first interface information pieces, and concatenating different strings after the identical string to generate Y second interface information pieces, includes:
[0010] Based on the N identification information, the same strings included in any two first interface information with the same string in the N first interface information are aggregated, and different strings are concatenated after the same string to generate a prefix tree. The prefix tree includes M levels, and each level corresponds to an attribute of the first interface information.
[0011] Based on the prefix tree, the access counts of the N first interface information are counted sequentially to obtain the N access counts;
[0012] Based on the N access counts, Y second interface information is determined from the N first interface information. The Y second interface information are the top Y first interface information sorted in descending order of their corresponding access counts from the N first interface information.
[0013] Optionally, before aggregating the identical strings included in any two first interface information pieces with the same string from the N first interface information pieces based on the N identification information pieces, and concatenating different strings after the identical string to generate a prefix tree, the method further includes:
[0014] Based on the M types of strings, determine the level corresponding to the prefix tree. The level corresponding to the prefix tree is the same as the level corresponding to the target string among the M types of strings. The target string is the string with the most levels among the M types of strings.
[0015] The number of branches corresponding to the prefix tree is determined based on the M types of strings, where the number of branches corresponding to the prefix tree is M.
[0016] A preset prefix tree is generated based on the level and the number of branches of the prefix tree.
[0017] Optionally, the step of aggregating the identical strings included in any two first interface information pieces with the same string among the N first interface information pieces based on the N identification information pieces, and concatenating different strings after the identical string to generate a prefix tree, includes:
[0018] Based on the N identification information, the identical strings included in any two first interface information with the same string among the N first interface information are aggregated and filled into the first node of the preset prefix tree, and different strings are filled into the second node of the preset prefix tree to generate a prefix tree, wherein the second node is a node connected to the first node in the preset prefix tree.
[0019] Optionally, the step of generating the Y second interface information by sequentially counting the access counts of the N first interface information based on the prefix tree includes:
[0020] Based on the access log of the prefix tree, obtain the M access counts corresponding to the M strings;
[0021] Among the M types of strings, if the number of accesses corresponding to any one of the strings is less than or equal to a preset number of accesses, the string is deleted from the prefix tree, and the Y second interface information are generated.
[0022] Optionally, the M types of strings include strings corresponding to at least one of the following attributes: interface type, interface version, interface resource type, and user ID.
[0023] In a second aspect of the present invention, an interface information aggregation device is provided, the device comprising:
[0024] The parsing module is used to parse the text content included in the service access log to obtain N first interface information, where N is a positive integer, and the N first interface information are used to represent the N path data corresponding to the service access log;
[0025] The identification module is used to identify the N first interface information respectively to obtain N identification information. The identification information is used to indicate the M strings included in the corresponding interface information. The strings are used to indicate an interface attribute feature corresponding to the corresponding first interface information. M is a positive integer.
[0026] The aggregation module is used to aggregate the identical strings included in any two first interface information that have the same string among the N first interface information based on the N identification information, and to concatenate different strings after the identical string to generate Y second interface information, where Y is a positive integer less than N.
[0027] In a third aspect of the embodiments of this application, an electronic device is also provided, including a processor, a memory, and a program or instructions stored in the memory and executable on the processor, wherein the program or instructions, when executed by the processor, implement the steps of the method for aggregating interface information as described in any one of the first aspects.
[0028] In a fourth aspect of the embodiments of this application, a computer-readable storage medium is also provided, wherein a program or instructions are stored on the storage medium, and when the program or instructions are executed by a processor, the program or instructions implement the steps of the method for aggregating interface information as described in any one of the first aspects.
[0029] In a fifth aspect of this application, this application also provides a computer program product stored in a storage medium, which is executed by at least one processor to implement the steps of the interface information aggregation method as described in any one aspect of the first application.
[0030] This application provides a method, apparatus, and related equipment for aggregating interface information. The method includes: parsing the text content of a service access log to obtain N first interface information, where N is a positive integer, and the N first interface information are used to represent N path data corresponding to the service access log; identifying the N first interface information to obtain N identification information, where the identification information is used to indicate M strings included in the corresponding interface information, and the strings are used to indicate an interface attribute feature corresponding to the corresponding first interface information, where M is a positive integer; and aggregating the same strings included in any two first interface information with the same string from the N first interface information according to the N identification information, concatenating different strings after the same string to generate Y second interface information, where Y is a positive integer less than N. This application parses service access logs to obtain N first interface information. It then identifies each of these first interface information entries, determining the corresponding N identification information. Based on these N identification information, it aggregates any two first interface information entries containing the same string, concatenating different strings after the same string to obtain Y second interface information entries. This achieves the aggregation of N first interface information entries without requiring changes to the service code of the first interface information, effectively improving the aggregation effect of interface information. Attached Figure Description
[0031] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below.
[0032] Figure 1This is a flowchart illustrating the interface information aggregation method in an embodiment of this application.
[0033] Figure 2 This is a schematic diagram of the prefix tree structure in an embodiment of this application;
[0034] Figure 3 This is a schematic diagram of the structure of the interface information aggregation device in the embodiments of this application;
[0035] Figure 4 This is a schematic diagram of the structure of the electronic device in the embodiments of this application. Detailed Implementation
[0036] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0037] Before discussing the exemplary embodiments in more detail, it should be noted that some exemplary embodiments are described as processes or methods depicted as flowcharts. Although the flowcharts describe the steps as sequential processes, many of these steps can be performed in parallel, concurrently, or simultaneously. Furthermore, the order of the steps can be rearranged. A process can be terminated when its operation is complete, but it may also have additional steps not included in the figures. A process can correspond to a method, function, procedure, subroutine, subroutine, etc.
[0038] Furthermore, the terms "first," "second," etc., may be used herein to describe various directions, actions, steps, or elements, but these directions, actions, steps, or elements are not limited by these terms. These terms are only used to distinguish one direction, action, step, or element from another direction, action, step, or element. For example, without departing from the scope of this application, a first string may be referred to as a second string, and similarly, a second string may be referred to as a first string. Both the first string and the second string are order requests, but they are not the same order request. The terms "first," "second," etc., should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this application, "a plurality of" means at least two, such as two, three, etc., unless otherwise explicitly specified.
[0039] This application provides a method for aggregating interface information, such as... Figure 1 As shown, the method includes:
[0040] Step 101: Parse the text content included in the service access log to obtain N first interface information, where N is a positive integer, and the N first interface information are used to represent the N path data corresponding to the service access log.
[0041] In this embodiment, the service access log is a log file that records a user's access to a service or application. The service access log typically contains the following types of information: timestamp: records the time the request occurred; requester's IP address: identifies the user device that initiated the request; request method: such as GET, POST, etc., indicating the type of request the user made to the service; request URL: the address of the specific resource or service accessed by the user; user agent information: provides information such as the user's device and browser type.
[0042] By parsing the service access logs, we can obtain the actual interface path information of the current service, resulting in N primary interface information. These interface information are in RESTful style, for example: / api / v1 / uid / 1234, / api / v1 / uid / 2345, / api / v1 / uid / 32421, / api / v2 / uid / 23423, / api / v2 / uid / 9342322, / openapi / project / abc / get, / openapi / project / aaa / get, / openapi / project / bbb / get.
[0043] Step 102: Identify the N first interface information respectively to obtain N identification information. The identification information is used to indicate the M strings included in the corresponding interface information. The strings are used to indicate an interface attribute feature corresponding to the first interface information. M is a positive integer.
[0044] In this embodiment, N pieces of first interface information are identified, and M types of strings corresponding to the N pieces of first interface information are determined. Each type of string corresponds to an attribute of the first interface information. For example, the M types of strings include strings corresponding to at least one of the following attributes: interface type, interface version, interface resource type, and user ID. Other embodiments may include other different attributes, which will not be elaborated here. Specifically, api and openapi correspond to interface type, v1 and project correspond to interface version, uid corresponds to interface resource type, and xxxx corresponds to user ID.
[0045] It should be noted that the identification process in this embodiment involves parsing the interface information, or it can be done through a machine learning model to identify the interface information. No specific limitation is made in this embodiment.
[0046] Step 103: Based on the N identification information, aggregate the identical strings included in any two first interface information that have the same string among the N first interface information, and concatenate different strings after the identical string to generate Y second interface information, where Y is a positive integer less than N.
[0047] In this embodiment, the aggregation of identical strings involves finding the same strings appearing in the first interface information, aggregating these identical strings, and connecting different string branches after the identical strings. Aggregation means merging identical strings into one string to simplify data or summarize information. For example, if string A is 11 / 22 / 33 and string B is 11 / 2 / 3, then the 11 in string A and the 11 in string B are merged, resulting in the string "11" and two branches connecting to it: one branch is "22 / 33" and the other is "2 / 3".
[0048] Based on N identified identifiers, identical strings from the N first-level interface information are aggregated. For example, / api / v1 / uid / 1234 and / api / v1 / uid / 2345 can be aggregated into / api / v1 / uid / . Similarly, / openapi / project / abc / get and / openapi / project / aaa / get can be aggregated into / openapi / project / . Thus, by aggregating the N first-level interface information, Y second-level interface information are generated. By merging identical strings, queries can be performed sequentially based on string connections, resulting in higher query efficiency. Furthermore, this storage method saves storage space.
[0049] This application parses service access logs to obtain N first interface information. It then identifies each of these first interface information entries, determining the corresponding N identification information. Based on these N identification information, it aggregates any two first interface information entries containing the same string, concatenating different strings after the same string to obtain Y second interface information entries. This achieves the aggregation of N first interface information entries without requiring changes to the service code of the first interface information, effectively improving the aggregation effect of interface information.
[0050] In some feasible implementations, optionally, the step of aggregating the identical strings included in any two first interface information pieces with the same string among the N first interface information pieces based on the N identification information, and concatenating different strings after the identical string to generate Y second interface information pieces, includes:
[0051] Based on the N identification information, the same strings included in any two first interface information with the same string in the N first interface information are aggregated, and different strings are concatenated after the same string to generate a prefix tree. The prefix tree includes M levels, and each level corresponds to an attribute of the first interface information.
[0052] Based on the prefix tree, the access counts of the N first interface information are counted sequentially to obtain the N access counts;
[0053] Based on the N access counts, Y second interface information is determined from the N first interface information. The Y second interface information are the top Y first interface information sorted in descending order of their corresponding access counts from the N first interface information.
[0054] In this embodiment, the structural diagram of the prefix tree is as follows: Figure 2 As shown, a trie is a tree-like data structure primarily used to store dynamic sets or associative arrays. Tries are most commonly used for string processing, especially in applications such as dictionaries, auto-completion, and word frequency statistics. In this embodiment, when aggregating N pieces of first interface information, the information is written into M levels of the trie based on the interface path, segmented by / , where each level corresponds to an attribute of one type of first interface information. Figure 2 In the example, the prefix tree includes 4 levels (4 layers) and 8 branches (the final number of branch nodes). Specifically, it aggregates the same strings among M strings, such as merging api and openapi into one, concatenating uid after api, and concatenating project after oenapi, and so on, connecting different branches until the 4th level is completed, and each branch is eventually filled with data.
[0055] It should be noted that when writing to the prefix tree, it is also necessary to count the path access count of each child node. The path access count of each child node is used to determine which strings can be discarded and which can be retained. The strings that can be retained are then aggregated to ultimately obtain Y second interface information items. Specifically, for example, the access count is determined for each of the N first interface information items, resulting in N corresponding access counts. These N access counts are then sorted in descending order, and Y first interface information items are selected from them to be retained as second interface information. The specific value of Y can be set according to actual conditions and is not specifically limited in this embodiment.
[0056] By aggregating identical string information and retaining only those that appear frequently, a more concise and representative result set is generated. This process is commonly used in data analysis and information organization scenarios.
[0057] Optionally, before aggregating the identical strings included in any two first interface information pieces with the same string from the N first interface information pieces based on the N identification information pieces, and concatenating different strings after the identical string to generate a prefix tree, the method further includes:
[0058] Based on the M types of strings, determine the level corresponding to the prefix tree. The level corresponding to the prefix tree is the same as the level corresponding to the target string among the M types of strings. The target string is the string with the most levels among the M types of strings.
[0059] The number of branches corresponding to the prefix tree is determined based on the M types of strings, where the number of branches corresponding to the prefix tree is M.
[0060] A preset prefix tree is generated based on the level and the number of branches of the prefix tree.
[0061] In this embodiment, based on the M types of strings, the common prefixes and structures of these strings are first analyzed. In a prefix tree, the levels of the strings typically represent their depth or position. Each level corresponds to the position of a character: for example, the first level contains the first character of all strings. The second level contains the second character of all strings, and so on. By analyzing these strings, the hierarchical structure of the prefix tree can be determined; specifically, the hierarchical structure of the prefix tree corresponds to the M types of strings. After determining the hierarchical structure, the final number of branches needs to be determined based on the number of M types of strings, where the number of branches is the same as M. Thus, a preset prefix tree is generated using the levels corresponding to the prefix tree and the number of branches corresponding to the prefix tree.
[0062] For example, when there are 100 strings in M, the level of the prefix tree is determined by the string that contains the most levels among the 100 strings. For instance, if the most levels among the 100 strings are 5, then the level of the prefix tree is also 5. When there are 200 strings in M, the level of the prefix tree is determined by the string that contains the most levels among the 200 strings. For instance, if the most levels among the 200 strings are 6, then the level of the prefix tree is also 6.
[0063] Based on the established M levels, at least one child node is determined for each level, where the child node represents the characters that can be expanded within that level. It should be noted that the child nodes generated for each level correspond to different character combinations within that level. Due to the properties of prefix trees, each child node in a level can connect to multiple different child nodes to represent different branches of the string.
[0064] After generating the preset prefix tree, which includes multiple nodes, it is only necessary to aggregate the same strings of M types and fill the same strings with different strings, so that all the strings are filled into the preset prefix tree to generate the prefix tree.
[0065] By defining hierarchy, determining child nodes, and populating data, a well-structured and easily searchable prefix tree is constructed. The prefix tree design makes string processing more efficient, especially when operations such as searching, retrieving, and frequency statistics are required.
[0066] Optionally, the step of aggregating the identical strings included in any two first interface information pieces with the same string among the N first interface information pieces based on the N identification information pieces, and concatenating different strings after the identical string to generate a prefix tree, includes:
[0067] Based on the N identification information, the identical strings included in any two first interface information with the same string among the N first interface information are aggregated and filled into the first node of the preset prefix tree, and different strings are filled into the second node of the preset prefix tree to generate a prefix tree, wherein the second node is a node connected to the first node in the preset prefix tree.
[0068] In this embodiment, the preset prefix tree includes a first node and a second node. The first node is used to fill in the same string, for example, all nodes in the first level are first nodes. The first node is also used to fill in strings that cannot be clustered, such as nodes connected to the first node. The first node and the second node are used to determine the string corresponding to that node. Each first node represents one or more specific strings, and each second node represents one string.
[0069] By using the decoupling link of the prefix tree, when using interface information, these defined strings can be concatenated together in sequence to form a new string. This can be a simple string concatenation or a merging according to specific rules (such as delimiters, formatting, etc.). No specific limitation is made in this embodiment.
[0070] Optionally, the step of generating the Y second interface information by sequentially counting the access counts of the N first interface information based on the prefix tree includes:
[0071] Based on the access log of the prefix tree, obtain the M access counts corresponding to the M strings;
[0072] Among the M types of strings, if the number of accesses corresponding to any one of the strings is less than or equal to a preset number of accesses, the string is deleted from the prefix tree, and the Y second interface information are generated.
[0073] In this embodiment, the prefix tree is traversed according to the access log to determine the M access counts for each of the M strings. These M access counts determine whether each string is frequently accessed. Therefore, infrequently accessed strings can be deleted, further simplifying the prefix tree structure and reducing storage space.
[0074] For example, the Y second interface information generated by the above method can be as follows: / api / v1 / uid, / api / v2 / uid, and / openapi / project. By utilizing the statistically verified high-access-frequency nodes in the prefix tree, meaningful second interface information is generated, and nodes with low access frequency are deleted. This provides users with more accurate feedback, enhances user experience, and improves system responsiveness. This transforms raw statistical data into more valuable information, helping developers or business teams make better decisions. It not only improves the efficiency of data retrieval and management but also helps developers and operations personnel better understand user needs and usage patterns.
[0075] This application parses service access logs to obtain N first interface information. It then identifies each of these first interface information entries, determining the corresponding N identification information. Based on these N identification information, it aggregates any two first interface information entries containing the same string, concatenating different strings after the same string to obtain Y second interface information entries. This achieves the aggregation of N first interface information entries without requiring changes to the service code of the first interface information, effectively improving the aggregation effect of interface information.
[0076] This application provides an interface information aggregation device, such as... Figure 3 As shown, the interface information aggregation device 300 includes:
[0077] The parsing module 310 is used to parse the text content included in the service access log to obtain N first interface information, where N is a positive integer, and the N first interface information is used to represent the N path data corresponding to the service access log;
[0078] The identification module 320 is used to identify the N first interface information respectively to obtain N identification information. The identification information is used to indicate the M strings included in the corresponding interface information. The strings are used to indicate an interface attribute feature corresponding to the corresponding first interface information. M is a positive integer.
[0079] The aggregation module 330 is used to aggregate the same strings included in any two first interface information with the same string among the N first interface information according to the N identification information, and to concatenate different strings after the same string to generate Y second interface information, where Y is a positive integer less than N.
[0080] Optionally, the aggregation module 330 includes:
[0081] The first generation submodule is used to aggregate the same strings included in any two first interface information with the same string in the N first interface information according to the N identification information, and to concatenate different strings after the same string to generate a prefix tree, wherein the prefix tree includes M levels, and each level corresponds to an attribute of the first interface information.
[0082] The statistics submodule is used to count the number of accesses to the N first interface information based on the prefix tree, and obtain N access counts.
[0083] The second generation submodule is used to determine Y second interface information from the N first interface information based on the N access counts. The Y second interface information are the first Y first interface information sorted in descending order of their corresponding access counts from the N first interface information.
[0084] Optional, also includes:
[0085] The first determining submodule is used to determine the level corresponding to the prefix tree based on the M types of strings. The level corresponding to the prefix tree is the same as the level corresponding to the target string among the M types of strings. The target string is the string with the most levels among the M types of strings.
[0086] The second determining submodule is used to determine the number of branches corresponding to the prefix tree based on the M types of strings, wherein the number of branches corresponding to the prefix tree is M.
[0087] The third generation submodule is used to generate a preset prefix tree based on the level corresponding to the prefix tree and the number of branches corresponding to the prefix tree.
[0088] Optionally, the first generation submodule includes:
[0089] The generation unit is configured to, based on the N identification information, aggregate the identical strings included in any two first interface information with the same string from the N first interface information and fill them into the first node of the preset prefix tree, and fill the different strings into the second node of the preset prefix tree to generate a prefix tree, wherein the second node is a node in the preset prefix tree connected after the first node.
[0090] Optionally, the second generation submodule includes:
[0091] The acquisition unit is used to acquire the M access counts corresponding to the M strings based on the access log of the prefix tree;
[0092] The deletion unit is used to delete any one of the M strings from the prefix tree if the number of accesses corresponding to the string is less than or equal to a preset number of accesses, thereby generating the Y second interface information.
[0093] Optionally, the M types of strings include strings corresponding to at least one of the following attributes: interface type, interface version, interface resource type, and user ID.
[0094] This application parses service access logs to obtain N first interface information. It then identifies each of these first interface information entries, determining the corresponding N identification information. Based on these N identification information, it aggregates any two first interface information entries containing the same string, concatenating different strings after the same string to obtain Y second interface information entries. This achieves the aggregation of N first interface information entries without requiring changes to the service code of the first interface information, effectively improving the aggregation effect of interface information.
[0095] Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application, such as... Figure 4 As shown, the electronic device 400 includes a memory 410 and a processor 420. The number of processors 420 in the electronic device 400 can be one or more. Figure 4 Taking a processor 420 as an example; the memory 410 and processor 420 in the server can be connected via a bus or other means. Figure 4 Taking the example of a connection between China and Israel via a bus.
[0096] The memory 410, as a computer-readable storage medium, can be used to store software programs, computer-executable programs, and modules, such as the program instructions / modules corresponding to the member push method in the embodiments of this application. The processor 420 executes various functional applications and data processing of the server / terminal / server by running the software programs, instructions, and modules stored in the memory 410, thereby realizing the above-mentioned interface information aggregation method.
[0097] The processor 420 is used to run the computer program stored in the memory 410, and performs the following steps:
[0098] The text content included in the service access log is parsed to obtain N first interface information, where N is a positive integer, and the N first interface information are used to represent the N path data corresponding to the service access log;
[0099] The N first interface information are identified respectively to obtain N identification information. The identification information is used to indicate the M strings included in the corresponding interface information. The strings are used to indicate an interface attribute feature corresponding to the corresponding first interface information. M is a positive integer.
[0100] Based on the N identification information, the identical strings included in any two first interface information that have the same string among the N first interface information are aggregated, and different strings are concatenated after the identical string to generate Y second interface information, where Y is a positive integer less than N.
[0101] Optionally, based on the N identification information, the step of aggregating the identical strings included in any two first interface information pieces with the same string among the N first interface information pieces, and concatenating different strings after the identical string to generate Y second interface information pieces, includes:
[0102] Based on the N identification information, the same strings included in any two first interface information with the same string in the N first interface information are aggregated, and different strings are concatenated after the same string to generate a prefix tree. The prefix tree includes M levels, and each level corresponds to an attribute of the first interface information.
[0103] Based on the prefix tree, the access counts of the N first interface information are counted sequentially to obtain the N access counts;
[0104] Based on the N access counts, Y second interface information is determined from the N first interface information. The Y second interface information are the top Y first interface information sorted in descending order of their corresponding access counts from the N first interface information.
[0105] Optionally, before aggregating the identical strings included in any two first interface information pieces with the same string from the N first interface information pieces based on the N identification information pieces, and concatenating different strings after the identical string to generate a prefix tree, the method further includes:
[0106] Based on the M types of strings, determine the level corresponding to the prefix tree. The level corresponding to the prefix tree is the same as the level corresponding to the target string among the M types of strings. The target string is the string with the most levels among the M types of strings.
[0107] The number of branches corresponding to the prefix tree is determined based on the M types of strings, where the number of branches corresponding to the prefix tree is M.
[0108] A preset prefix tree is generated based on the level and the number of branches of the prefix tree.
[0109] Optionally, the step of aggregating the identical strings included in any two first interface information pieces with the same string among the N first interface information pieces based on the N identification information pieces, and concatenating different strings after the identical string to generate a prefix tree, includes:
[0110] Based on the N identification information, the identical strings included in any two first interface information with the same string among the N first interface information are aggregated and filled into the first node of the preset prefix tree, and different strings are filled into the second node of the preset prefix tree to generate a prefix tree, wherein the second node is a node connected to the first node in the preset prefix tree.
[0111] Optionally, the step of generating the Y second interface information by sequentially counting the access counts of the N first interface information based on the prefix tree includes:
[0112] Based on the access log of the prefix tree, obtain the M access counts corresponding to the M strings;
[0113] Among the M types of strings, if the number of accesses corresponding to any one of the strings is less than or equal to a preset number of accesses, the string is deleted from the prefix tree, and the Y second interface information are generated.
[0114] Optionally, the M types of strings include strings corresponding to at least one of the following attributes: interface type, interface version, interface resource type, and user ID.
[0115] This application parses service access logs to obtain N first interface information. It then identifies each of these first interface information entries, determining the corresponding N identification information. Based on these N identification information, it aggregates any two first interface information entries containing the same string, concatenating different strings after the same string to obtain Y second interface information entries. This achieves the aggregation of N first interface information entries without requiring changes to the service code of the first interface information, effectively improving the aggregation effect of interface information.
[0116] The computer-readable storage medium of this application embodiment can be any combination of one or more computer-readable media. The computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. For example, a computer-readable storage medium can be—but is 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 or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this document, a 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.
[0117] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying 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. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, capable of sending, propagating, or transmitting programs for use by or in connection with an instruction execution system, apparatus, or device.
[0118] The program code contained on the storage medium can be transmitted using any suitable medium, including—but not limited to—wireless, wired, optical fiber, RF, etc., or any suitable combination thereof.
[0119] Computer program code for performing the operations of this application can be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, and C++, and conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or terminal. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0120] This application also provides a computer program product, which is stored in a storage medium and executed by at least one processor to implement the various processes of the above-described interface information aggregation method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be described again here.
[0121] Note that the above are merely preferred embodiments and the technical principles employed in this application. Those skilled in the art will understand that this application is not limited to the specific embodiments described herein, and various obvious changes, readjustments, and substitutions can be made without departing from the scope of protection of this application. Therefore, although this application has been described in detail through the above embodiments, this application is not limited to the above embodiments, and may include many other equivalent embodiments without departing from the concept of this application, the scope of which is determined by the scope of the appended claims.
Claims
1. A method for aggregating interface information, characterized in that, The method includes: The text content included in the service access log is parsed to obtain N first interface information, where N is a positive integer, and the N first interface information are used to represent the N path data corresponding to the service access log; The N first interface information are identified respectively to obtain N identification information. The identification information is used to indicate the M strings included in the corresponding interface information. The strings are used to indicate an interface attribute feature corresponding to the corresponding first interface information. M is a positive integer. Based on the N identification information, the identical strings included in any two first interface information that have the same string among the N first interface information are aggregated, and different strings are concatenated after the identical string to generate Y second interface information, where Y is a positive integer less than N.
2. The method according to claim 1, characterized in that, The step involves aggregating the identical strings included in any two first interface information entries among the N first interface information entries based on the N identification information entries, and concatenating different strings after the identical strings to generate Y second interface information entries, including: Based on the N identification information, the same strings included in any two first interface information with the same string in the N first interface information are aggregated, and different strings are concatenated after the same string to generate a prefix tree. The prefix tree includes M levels, and each level corresponds to an attribute of the first interface information. Based on the prefix tree, the access counts of the N first interface information are counted sequentially to obtain the N access counts; Based on the N access counts, Y second interface information is determined from the N first interface information. The Y second interface information are the top Y first interface information sorted in descending order of their corresponding access counts from the N first interface information.
3. The method according to claim 2, characterized in that, The method further includes, before aggregating the identical strings included in any two first interface information pieces with the same string among the N first interface information pieces based on the N identification information pieces, and concatenating different strings after the identical string to generate a prefix tree, the method further includes: Based on the M types of strings, determine the level corresponding to the prefix tree. The level corresponding to the prefix tree is the same as the level corresponding to the target string among the M types of strings. The target string is the string with the most levels among the M types of strings. The number of branches corresponding to the prefix tree is determined based on the M types of strings, where the number of branches corresponding to the prefix tree is M. A preset prefix tree is generated based on the level and the number of branches of the prefix tree.
4. The method according to claim 3, characterized in that, The step of aggregating the identical strings included in any two first interface information entries among the N first interface information entries based on the N identification information entries, and concatenating different strings after the identical strings to generate a prefix tree, includes: Based on the N identification information, the identical strings included in any two first interface information with the same string among the N first interface information are aggregated and filled into the first node of the preset prefix tree, and different strings are filled into the second node of the preset prefix tree to generate a prefix tree, wherein the second node is a node connected to the first node in the preset prefix tree.
5. The method according to claim 2, characterized in that, The step of generating the Y second interface information by sequentially counting the access counts of the N first interface information based on the prefix tree includes: Based on the access log of the prefix tree, obtain the M access counts corresponding to the M strings; Among the M types of strings, if the number of accesses corresponding to any one of the strings is less than or equal to a preset number of accesses, the string is deleted from the prefix tree, and the Y second interface information are generated.
6. The method according to any one of claims 1-5, characterized in that, The M types of strings include strings corresponding to at least one of the following attributes: interface type, interface version, interface resource type, and user ID.
7. An interface information aggregation device, characterized in that, The device includes: The parsing module is used to parse the text content included in the service access log to obtain N first interface information, where N is a positive integer, and the N first interface information is used to represent the N path data corresponding to the service access log; The identification module is used to identify the N first interface information respectively to obtain N identification information. The identification information is used to indicate the M strings included in the corresponding interface information. The strings are used to indicate an interface attribute feature corresponding to the corresponding first interface information. M is a positive integer. The aggregation module is used to aggregate the identical strings included in any two first interface information that have the same string among the N first interface information based on the N identification information, and to concatenate different strings after the identical string to generate Y second interface information, where Y is a positive integer less than N.
8. An electronic device, characterized in that, It includes a processor, a memory, and a program or instructions stored in the memory and executable on the processor, wherein the program or instructions, when executed by the processor, implement the steps of the method for aggregating interface information as claimed in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, The readable storage medium stores a program or instructions that, when executed by a processor, implement the steps of the method for aggregating interface information as described in any one of claims 1 to 6.
10. A computer program product, characterized in that, The computer program product is stored in a storage medium, and the computer program product is executed by at least one processor to implement the steps in the method for aggregating interface information as described in any one of claims 1 to 6.