Interface consistency method and device, equipment, storage medium and program product

By dividing interface access traffic and selecting service processing strategies based on interface type for verification, the accuracy and traffic switching problems of interface consistency verification in business system migration are solved, and smooth interface migration and efficient system maintenance are achieved.

CN119155204APending Publication Date: 2024-12-17MASHANG CONSUMER FINANCE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410956529.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-16
Publication Date
2024-12-17

AI Technical Summary

Technical Problem

During the migration of business systems, it is difficult to achieve smooth migration and accurate verification of interfaces, resulting in large workloads in system maintenance and upgrades, which is not conducive to real-time traffic switching and affecting user experience.

Method used

By dividing the access traffic of the interface into the first access traffic and the second access traffic, calling the first interface and the second interface to execute the service request, selecting a matching service processing strategy based on the interface type, obtaining response data and comparing it, ensuring that Consistency verification of interfaces.

Benefits of technology

Improve the accuracy of consistency verification before and after interface migration, ensure seamless connection of real-time traffic switching, reduce losses during system migration, and improve user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119155204A_ABST
    Figure CN119155204A_ABST
Patent Text Reader

Abstract

The invention discloses an interface consistency verification method and device, equipment, a storage medium and a program product, which are used for accurately verifying the consistency before and after interface migration so as to realize smooth migration from a second interface to a first interface. The interface consistency verification comprises the steps that access traffic of interfaces is divided into first access traffic and second access traffic, the interfaces comprise a first interface and a second interface, and the first interface is obtained by migrating the second interface; calling the first interface to execute a service requested by the first access flow to obtain first response data; based on a service processing strategy matched with the type of the second interface, executing a service requested by the second access flow to obtain second response data; and comparing the first response data with the second response data to obtain a consistency verification result of the first interface and the second interface.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to an interface consistency verification method, device, equipment, storage medium and program product. Background Art

[0002] At present, with the rapid development of business and the iterative update of requirements, the old business system is becoming worse and worse in terms of scalability and performance. In addition, the technology is updated and iterated quickly, and the old business system still uses traditional technology to process business, which greatly increases the workload of system maintenance and upgrade. In order to solve such problems, a new business system is needed to carry the business.

[0003] Before the new business system goes online, the interface of the old business system needs to be migrated to the new business system. In such a complex system migration process, to achieve smooth migration of the interface, it is necessary to accurately verify the consistency of the interface before and after migration. Summary of the invention

[0004] The purpose of the embodiments of the present application is to provide an interface consistency verification method, device, equipment, storage medium and program product for accurately verifying the consistency of the interface before and after migration to achieve smooth interface migration.

[0005] In order to achieve the above objectives, the present application embodiment adopts the following technical solutions:

[0006] In a first aspect, an embodiment of the present application provides an interface consistency verification method, including:

[0007] Dividing access traffic to an interface into first access traffic and second access traffic, the interface comprising a first interface and a second interface, the first interface being obtained by migrating the second interface;

[0008] Calling the first interface to execute the service requested by the first access traffic, and obtaining first response data;

[0009] Based on the service processing policy that matches the type of the second interface, execute the service requested by the second access traffic to obtain second response data;

[0010] The first response data and the second response data are compared to obtain a consistency check result between the first interface and the second interface.

[0011] In a second aspect, an embodiment of the present application provides an interface consistency verification device, including:

[0012] A traffic distribution unit, configured to divide access traffic to an interface into a first access traffic and a second access traffic, wherein the interface includes a first interface and a second interface, and the first interface is obtained by migrating the second interface;

[0013] A first response unit, configured to call the first interface to execute the service requested by the first access flow and obtain first response data;

[0014] A second response unit, configured to execute the service requested by the second access traffic based on a service processing policy that matches the type of the second interface, and obtain second response data;

[0015] A verification unit is used to compare the first response data with the second response data to obtain a consistency verification result between the first interface and the second interface.

[0016] In a third aspect, an embodiment of the present application provides an electronic device, including:

[0017] processor;

[0018] a memory for storing instructions executable by the processor;

[0019] The processor is configured to execute the instructions to implement the interface consistency verification method provided in the first aspect.

[0020] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium. When instructions in the storage medium are executed by a processor of an electronic device, the electronic device can execute the interface consistency verification method provided in the first aspect.

[0021] In a fifth aspect, an embodiment of the present application provides a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program, and the computer program is operable to cause a computer to execute part or all of the steps in the interface consistency verification method provided in the first aspect.

[0022] At least one of the above technical solutions adopted in the embodiments of the present application can achieve the following beneficial effects:

[0023] By diverting the access traffic of the interface to the first interface and the second interface for response, a comparative test of the first interface and the second interface can be implemented, and then the response data obtained by the two can be compared to verify the consistency of the first interface and the second interface. In addition, in the response process, considering that for different types of interfaces, the data that can reflect the correctness of their execution logic is different, the applicable consistency test methods are different, and for the second interface, if the test method is not properly selected, it is not conducive to real-time switching of traffic, that is, if there is a problem when the traffic cuts into the first interface, it is not conducive to switching back to the second interface, and seamless connection cannot be achieved, thereby reducing losses; for this reason, based on the type of the second interface, a matching business processing strategy is selected to execute the business requested by the second access traffic, and the obtained second response data can accurately reflect the correctness of its execution logic, thereby improving the accuracy of subsequent consistency verification of the first interface and the second interface, and can also effectively solve the problem of being not conducive to real-time switching of traffic. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0025] Figure 1 A flowchart of an interface consistency verification method provided for an embodiment of the present application;

[0026] Figure 2 A schematic diagram of a diversion process provided for an embodiment of the present application;

[0027] Figure 3 A flowchart of an interface consistency verification method provided for another embodiment of the present application;

[0028] Figure 4 A schematic diagram of a consistency check process provided for an embodiment of the present application;

[0029] Figure 5 A schematic diagram of the structure of an interface consistency verification device provided for one embodiment of the present application;

[0030] Figure 6 A schematic diagram of the structure of an electronic device provided for one embodiment of the present application. DETAILED DESCRIPTION

[0031] In order to make the purpose, technical solution and advantages of the present application clearer, the technical solution of the present application will be clearly and completely described below in combination with the specific embodiments of the present application and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application.

[0032] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or precedence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally represents that the objects associated with each other are in an "or" relationship.

[0033] Some concept descriptions:

[0034] Interface: The interface in the embodiment of the present application refers to a software class interface, specifically a reference type that defines a protocol. An interface specifies members that must be provided by a class or other interfaces that implement it.

[0035] Tracking: A term used in the field of data collection (especially user behavior data collection), which refers to the technology and implementation process for capturing, processing, and sending specific user behaviors or events, such as the number of times a user clicks on an icon, the length of time a user watches a video, and so on.

[0036] Diff: In the embodiment of the present application, the process of comparing the messages reported by the new and old business systems is called diff.

[0037] Message Queue (MQ): also known as message middleware, is a software that complies with the Java Message Service (JMS) specification and is used to deliver messages.

[0038] Software Development Kit (SDK): Generally, it is a collection of development tools used by software engineers to build application software for a specific software package, software framework, hardware platform, operating system, etc. A software development kit can simply provide some files of the application program interface for a programming language, but it may also include complex hardware that can communicate with an embedded system.

[0039] Artificial Intelligence (AI) component: A basic component for identifying message data provided by artificial intelligence.

[0040] Diff traffic: also known as control group traffic, is used to allocate to the old business system to perform control testing.

[0041] Link ID (TraceId): Uniformly generated by the gateway. The link ID will run through the entire execution process of the new and old business systems. When the new and old business systems report messages, they will carry the link ID, which is mainly used to make a unique distinction when comparing the messages reported by the new and old business systems. In other words, only the messages reported by the new and old business systems in the same link can be compared.

[0042] In order to accurately verify the consistency before and after the interface migration, so as to achieve smooth migration of the interface, the embodiment of the present application proposes an interface consistency verification method, which diverts the access traffic to the interface to the first interface and the second interface for response, and can realize the comparison test of the first interface and the second interface, and then compare the response data obtained by the two, so as to verify the consistency of the first port and the second interface. In addition, in the response process, considering that for different types of interfaces, the data that can reflect the correctness of their execution logic is different, the applicable consistency test methods are different, and for the second interface, if the test method is not properly selected, it is not conducive to the real-time switching of traffic, that is, if there is a problem when the traffic cuts into the first interface, it is not conducive to switching back to the second interface, and it is impossible to achieve seamless connection, and thus the loss cannot be reduced; for this reason, based on the type of the second interface, a matching business processing strategy is selected to execute the business requested by the second access traffic, and the obtained second response data can accurately reflect the correctness of its execution logic, thereby improving the accuracy of the subsequent consistency verification of the first interface and the second interface, and can also effectively solve the problem that is not conducive to the real-time switching of traffic.

[0043] It should be understood that the interface consistency verification method provided in the embodiment of the present application can be executed by an electronic device, specifically by a processor of the electronic device. The so-called electronic device here may include a terminal device, such as but not limited to a smart phone, a tablet computer, a laptop computer, a desktop computer, an intelligent voice interaction device, a smart home appliance, a smart watch, a vehicle terminal, an aircraft, etc.; or, the electronic device may also include a server, such as an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services.

[0044] The technical solutions provided by various embodiments of the present application are described in detail below in conjunction with the accompanying drawings.

[0045] Please refer to Figure 1, is a flow chart of an interface consistency verification method provided by an embodiment of the present application, the method comprising the following steps:

[0046] S102: Divide access traffic to the interface into first access traffic and second access traffic.

[0047] The access traffic includes multiple access requests, which are used to request to execute corresponding services through the interface. The interface includes a first interface and a second interface. The first interface is obtained by migrating the second interface. Migrating the second interface means migrating the second interface from one business system (old business system) to another business system (new business system), and the interface in the migrated business system is called the first interface.

[0048] The first access traffic is used for execution by the first interface. The second access traffic is used for execution by the second interface, also known as Diff traffic or control group traffic. By dividing the access traffic into the first access traffic and the second access traffic, the first interface and the second interface can be tested against each other.

[0049] In the related art, the aspect-oriented programming (AOP) technology in the spring framework is usually used to implement the division of access traffic based on the surround notification method, that is, the access traffic is first forwarded to the business system to which the first interface belongs, and the access traffic is divided into two groups in the business system, and one of the access traffic is forwarded to the second interface. However, under this diversion method, the business system to which the first interface belongs receives a large amount of access traffic, and the access traffic divided to the second interface needs to be forwarded twice, which will affect the response time to the access traffic and seriously affect the user experience when the concurrency is large.

[0050] In view of this, if Figure 2 As shown, in the above S102, the access traffic is intercepted by the gateway, and the access traffic is divided into the first access traffic and the second access traffic in the gateway. Accordingly, after S102, the interface consistency verification method provided in the embodiment of the present application may also include the following steps: forwarding the first access traffic to the first interface through the gateway, and forwarding the second access traffic to the second interface.

[0051] In the above implementation, by intercepting access traffic through the gateway and diverting the access traffic, it is possible to avoid concentrating high-concurrency access traffic on the business system to which the first interface belongs, and reduce the secondary forwarding of part of the access traffic, thereby saving the impact time on the interface and improving user experience.

[0052] In actual applications, after completing the division of the access traffic, the gateway can also distinguish the first access traffic from the second access traffic by adding corresponding tags to the access traffic. For example, the tag of the first access traffic is diff=0, and the tag of the second access traffic is diff=1.

[0053] In addition, when the processing link of the first access traffic is the same as the processing link of the second access traffic, the gateway also marks the same TraceId for the first access traffic and the second access traffic, that is, adds the same TraceId to the request header (Header) of the first access traffic and the request header of the second access traffic, so as to subsequently compare the response data of the first interface and the response data of the second interface in the same processing link.

[0054] In the above S102, the access traffic is divided into the first access traffic and the second access traffic in various ways, which can be selected according to actual needs, and the embodiment of the present application does not limit this.

[0055] In one embodiment, based on the diversion ratio, the access traffic is randomly grouped to obtain the first access traffic and the second access traffic. For example, if the diversion ratio is 0, all access traffic is determined as the first access traffic; if the diversion ratio is 1, all access traffic is determined as the second access traffic; if the diversion ratio is a value between 0 and 1, the access traffic is randomly divided into the first access traffic and the second access traffic according to the value. It can be seen that this method is simple to implement.

[0056] In another embodiment, a hash operation is performed on the user identification included in the access traffic to obtain a hash value; based on the hash value and the diversion ratio, the access traffic is divided into a first access traffic and a second access traffic.

[0057] For example, for each access request in the access traffic, a hash operation is performed on the user identifier contained in the access request to obtain a hash value of the access request; then, the diversion range is determined based on the diversion ratio, and for each access request, the hash value of the access request is mapped; if the mapped hash value is within the diversion range, the access request is added to the first access traffic; otherwise, the access request is added to the second access traffic.

[0058] In the above implementation, the access traffic is divided based on the hash operation and the diversion ratio, which can ensure the uniformity of the first access traffic and the second access traffic, and the diversion efficiency is high.

[0059] In actual applications, the diversion ratio can be configured through the background management interface according to actual needs. For example, the ratio of the first access traffic to the second access traffic is 1:9, which is not limited in the embodiment of the present application.

[0060] S104, calling the first interface to execute the service requested by the first access traffic, and obtaining first response data.

[0061] Specifically, the first interface may be called to execute the service requested by the first access traffic, obtain execution result data, and encapsulate the execution result data to obtain first response data.

[0062] As an example, Figure 3 As shown, if the type of the first interface is a read interface, the first interface is called to execute the service requested by the first access flow, and the execution result data is encapsulated to obtain the first response data. In practical applications, the service requested by the first access flow may include, for example, but is not limited to, at least one of the following business operations: querying a database, consuming a message queue, etc. In addition, when encapsulating, the read data and the request parameters contained in the first access flow may be encapsulated together to obtain the first response data, so that the consistency of the first interface and the second interface can be more accurately verified later.

[0063] As another example, Figure 3 As shown, if the type of the first interface is a write interface, the first interface is called to execute the service requested by the first access flow, and the execution result data is encapsulated to obtain the first response data. In actual applications, the data write service may include, for example, but is not limited to, at least one of the following business operations: writing data to a database, sending data to a message queue, reporting business point data, calling a downstream interface to write data, etc. In addition, when encapsulating, the data write result and the request parameters contained in the first access flow may be encapsulated together to obtain the first response data, so that the consistency of the first interface and the second interface can be more accurately verified later.

[0064] As another example, considering that the write interface may lack a return value, it is impossible to accurately evaluate the correctness of the actual execution logic of the interface through the data writing result, and there are many factors that affect the correctness of the execution logic of the write interface, such as the process data and result data involved in each business operation in the business execution process. Based on this, if the type of the first interface is a write interface, the first interface is called to execute the data writing service requested by the first access traffic, and the execution process data (hereinafter referred to as the first process sub-data) and execution result data (hereinafter referred to as the first result sub-data) of each business operation included in the data writing service are obtained; the first process sub-data and the first result sub-data of each business operation are encapsulated to obtain the first response data.

[0065] More specifically, in order to facilitate more accurate verification of the consistency between the first interface and the second interface later, during the encapsulation process, for each business operation, the first process sub-data and the first result sub-data of the business operation can be encapsulated into a message in a unified format to obtain the first response sub-data of the business operation; then, based on the above data, the first response sub-data of all business operations included in the write request are obtained to obtain the first response data.

[0066] For example, the first response sub-data of all business operations are spliced ​​according to the execution order of the business operations to obtain the first response data. Alternatively, after adding the operation identifier of the business operation to the first response sub-data of each business operation, the first response data of all business operations are spliced ​​according to the execution order of the business operations to obtain the first response data. In this way, when the consistency check is performed on the first interface and the second interface, the consistency of the first interface and the second interface can be accurately evaluated by checking whether the execution process and execution result of each business operation of the first interface and the second interface are consistent.

[0067] S106: Execute the service requested by the second access traffic based on the service processing policy that matches the type of the second interface, and obtain second response data.

[0068] The service processing policy refers to the way to respond to the second access traffic. Different types of second interfaces match different service processing policies.

[0069] Since the data that can reflect the correctness of the execution logic of different types of second interfaces are different, the applicable consistency test methods are different. In addition, for the second interface, if the test method is not selected properly, it is not conducive to real-time switching of traffic, that is, if there is a problem when the traffic cuts into the first interface, it is not conducive to switching back to the second interface, and seamless connection cannot be achieved, thereby reducing losses. For this reason, based on the type of the second interface, a matching business processing strategy is selected to respond to the second access traffic. The second response data obtained can accurately reflect the correctness of its execution logic, thereby improving the accuracy of subsequent consistency checks on the first interface and the second interface, and can also effectively solve the problem of being not conducive to real-time switching of traffic.

[0070] As an example, considering that the data reading service (i.e., the query service) has no impact on the downstream or the executor, and will not generate dirty data and inconsistency problems, and the data reading result can reflect the correctness of the execution logic of the data reading service. To this end, if the type of the second interface is a read interface, based on the response result of the second interface, the correctness of the execution logic of the second interface can be accurately evaluated, and then the business processing strategy can be determined to include: calling the second interface to execute the business requested by the second access traffic.

[0071] Specifically, Figure 3 As shown, the above S106 includes the following steps: if the type of the second interface is a read interface, calling the second interface to execute the service requested by the second access flow to obtain execution result data; encapsulating the execution result data to obtain second response data.

[0072] In practical applications, the service requested by the second access traffic may include, for example, but is not limited to, at least one of the following read and write operations: querying a database, consuming a message queue, etc. In addition, when encapsulating, the execution result data and the request parameters included in the second access traffic may be encapsulated together to obtain the second response data, so that the consistency of the first interface and the second interface can be more accurately verified later.

[0073] As another example, considering that the write interface may lack a return value, it is impossible to accurately evaluate the correctness of the actual execution logic of the interface through the execution results of the business, and the write business has a certain impact on the downstream or the executor, which may cause dirty data and inconsistency problems. For this reason, if the type of the second interface is a write interface, the matching business processing strategy includes: using the response process of similar historical access traffic to simulate the response process of the second access traffic, without actually executing the business requested by the second access traffic.

[0074] Specifically, Figure 3 As shown, the above S106 includes the following steps: if the type of the second interface is a write interface, then from the historical response record of the second interface, the historical process data and the historical execution result data of the historical access traffic that meet the screening conditions are obtained; the historical process data and the historical execution result data are encapsulated to obtain the second response data. Among them, the screening conditions include: the historical access traffic and the second access traffic contain similar request parameters, and the historical access traffic and the second access traffic request the same service.

[0075] More specifically, the business requested by the second access traffic includes multiple business operations, such as but not limited to: writing data to a database, sending data to a message queue, reporting business tracking data, calling a downstream interface to write data, etc. In this case, in order to facilitate more accurate verification of the consistency of the first interface and the second interface later, the above-mentioned historical process data includes process sub-data of multiple business operations, and the above-mentioned historical execution result data includes result sub-data of multiple business operations. Accordingly, the historical process data and the historical result data are encapsulated to obtain second response data, including: for each business operation, the operation identifier, process sub-data and result sub-data of the business operation are encapsulated to obtain the response sub-data of the business operation; based on the response sub-data of multiple business operations, the second response sub-data is obtained.

[0076] It is worth noting that, in order to distinguish the response sub-data obtained by the second interface from the first response sub-data obtained by the first interface, the response sub-data obtained by the second interface is also referred to as the second response sub-data.

[0077] For example, for each business operation, the operation identifier, process sub-data and result sub-data of the business operation are encapsulated in a unified message format to obtain the second response sub-data of the business operation; then, the second response sub-data of all business operations are spliced ​​in the execution order of the business operations to obtain the second response data.

[0078] It is understandable that there are many factors that affect the correctness of the execution logic of the write interface, such as the process data and result data involved in each business operation during the business execution process. In the above method, by encapsulating the process sub-data and result sub-data of each business operation into the second response sub-data of the response, and then deriving the second response data based on the second response sub-data of all business operations, when the consistency check is performed on the first interface and the second interface, the consistency of the two interfaces can be accurately evaluated by checking whether the execution process and execution results of each business operation of the two interfaces are consistent, and the idempotence of all business operations can be guaranteed.

[0079] S108, comparing the first response data with the second response data to obtain a consistency check result between the first interface and the second interface.

[0080] The consistency check result is used to indicate whether the first interface and the second interface are consistent. Specifically, the first response data and the second response data may be compared, and if the similarity between the two exceeds a preset similarity threshold, it may be determined that the first interface and the second interface are consistent.

[0081] In one embodiment, if the first response data is obtained based on the response sub-data of multiple business operations included in the business requested by the first access traffic, and the second response data is obtained based on the response sub-data of multiple business operations included in the business requested by the second access traffic, then the above S108 includes: based on the operation identifier included in the first response sub-data in the first response data, determining the second response sub-data in the second response data, the second response sub-data and the first response sub-data containing the same operation identifier; performing a consistency comparison on the first response sub-data and the second response sub-data to obtain a comparison result; based on the comparison result, determining the consistency verification result of the first interface and the second interface.

[0082] For example, the response data in the first response data is traversed, the traversed response data is used as the first response data, the second response data containing the same operation identifier is determined from the second response data, and the first response data and the second response data are compared for consistency to obtain a comparison result. If all the response sub-data in the second response data have consistent response sub-data in the first response data, it is determined that the first interface is consistent with the second interface.

[0083] In the above implementation, the response sub-data of the first interface and the second interface for the same business operation are compared for consistency, and the comparison results of the response sub-data of all business operations are combined to perform a consistency check on the first interface and the second interface. The impact of all business operations on the correctness of the execution logic of the interface is comprehensively considered, and the resulting consistency check result is more accurate.

[0084] In another embodiment, considering that both the first response data and the second response data are text data, in order to more quickly and accurately identify the similarity between the two, the above S108 includes the following steps: performing text feature extraction on the first response data to obtain a first text feature; performing text feature extraction on the second response data to obtain a second text feature; inputting the first text feature and the second text feature into a text recognition model for comparison to obtain the similarity between the first response data and the second response data; and determining the consistency between the first interface and the second interface based on the similarity.

[0085] The text recognition model is obtained by training based on the first sample text feature, the second sample text feature and the similarity label between the two. The first sample text feature is obtained by extracting the text feature of the first sample response data, and the first sample response data is obtained by responding to the first sample access traffic based on the first sample interface. The second sample text feature is obtained by extracting the text feature of the second sample response data, and the second sample response data is obtained by responding to the second sample access traffic based on the second sample interface. The first sample interface refers to the sample interface of the new business system, and the second sample interface refers to the sample interface of the old business system.

[0086] For example, after the first text feature and the second text feature are input into the text recognition model, the text recognition model embeds the first text feature to obtain a first representation vector, and embeds the second text feature to obtain a second representation vector; then, the text recognition model calculates the distance between the first representation vector and the second representation vector, such as cosine distance, Euclidean distance, etc., and uses the distance as the similarity between the first response data and the second response data; if the similarity is greater than or equal to a preset similarity threshold, it is determined that the first interface and the second interface have passed the consistency check; if the similarity is less than the preset similarity threshold, it is determined that the first interface and the second interface have not passed the consistency check.

[0087] In another embodiment of the present application, after the above S108, the above interface consistency verification method may further include the following steps: if the consistency verification result is failed, determining the difference data between the first response data and the second response data, and generating prompt information based on the difference data.

[0088] In practical applications, the above S108 and the generation process of prompt information can be implemented through SDK components and AI components. Figure 4 As shown, the first response data and the second response data are reported to the SDK component, the SDK component parses the first response data and the second response data to obtain two response sub-data of the same business operation, and then submits the two response sub-data to the AI ​​component for similarity identification. After receiving the two response sub-data, the AI ​​component extracts text features from the two response sub-data respectively, and embeds the extracted text features to obtain the corresponding representation vector, and then determines the similarity of the two response sub-data by calculating the distance between the two representation vectors; if the similarity of the response sub-data of all business operations is greater than or equal to the preset similarity threshold, the consistency check result of the first interface and the second interface is determined to be passed.

[0089] If the similarity of the response sub-data of at least one business operation is less than the preset similarity threshold, the AI ​​component determines that the consistency check result of the first interface and the second interface is not passed, and outputs the difference data between the two corresponding sub-data whose similarity is less than the preset similarity threshold, and pushes prompt information to the development platform based on the difference data, so that developers can promptly check the problems in the interface migration process. Of course, regardless of whether the consistency check result is passed or not, a verification log can be generated and sent to the developer so that the developer can perform operation and maintenance to ensure the stability and smooth migration of the interface migration process, as well as the consistency of the first interface and the second interface.

[0090] The prompt information can be in various forms, such as text, voice, etc., which are not limited in the embodiments of the present application. If the prompt information in voice form is to be output, the AI ​​component can also use the speech synthesis model to convert the difference data between the first response data and the second response data into a voice signal, and then push the voice information to the developer.

[0091] In the above method, the capabilities provided by SDK components and AI components are used to decouple the recognition and comparison logic of response data from the original logic, which improves the maintainability and readability of the code and speeds up the recognition and comparison of response data.

[0092] In another embodiment of the present application, after the above S108, the above interface consistency verification method may further include the following steps: if the consistency verification result is passed, the second interface is offline after a specified period of time.

[0093] The specified duration can be set according to actual needs, and the embodiments of the present application do not limit this.

[0094] When the first interface and the second interface pass the consistency check, after a specified period of time, the first interface has entered a stable operating state. At this time, the second interface is taken offline so that all subsequent access traffic to the interface is cut into the second interface. This can ensure the stable connection between the first interface and the second interface and minimize the loss incurred during the interface migration process.

[0095] The interface consistency verification method provided by one or more embodiments of the present application can divert the access traffic of the interface to the first interface and the second interface for response, realize the comparison test of the first interface and the second interface, and then compare the response data obtained by the two, so as to verify the consistency of the first interface and the second interface. In addition, in the response process, considering that for different types of interfaces, the data that can reflect the correctness of their execution logic is different, the applicable consistency test methods are different, and for the second interface, if the test method is not properly selected, it is not conducive to the real-time switching of traffic, that is, if there is a problem when the traffic cuts into the first interface, it is not conducive to switching back to the second interface, and it is impossible to achieve seamless connection, and thus the loss cannot be reduced; for this reason, based on the type of the second interface, a matching business processing strategy is selected to execute the business requested by the second access traffic, and the obtained second response data can accurately reflect the correctness of its execution logic, thereby improving the accuracy of the subsequent consistency verification of the first interface and the second interface, and can also effectively solve the problem of being not conducive to real-time switching of traffic.

[0096] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0097] Based on the same inventive concept, the present application embodiment also provides an interface consistency verification device. Figure 5 , is a schematic diagram of the structure of an interface consistency verification device 500 provided in an embodiment of the present application, the device 500 includes:

[0098] The traffic distribution unit 510 is used to divide the access traffic to the interface into a first access traffic and a second access traffic, wherein the interface includes a first interface and a second interface, and the first interface is obtained by migrating the second interface.

[0099] The first response unit 520 is configured to call the first interface to execute the service requested by the first access traffic and obtain first response data.

[0100] The second response unit 530 is configured to execute the service requested by the second access traffic based on the service processing policy that matches the type of the second interface, and obtain second response data.

[0101] The verification unit 540 is used to compare the first response data with the second response data to obtain a consistency verification result between the first interface and the second interface.

[0102] In another embodiment, the second response unit is used to:

[0103] If the type of the second interface is a read interface, calling the second interface to execute the service requested by the second access flow to obtain execution result data;

[0104] The execution result data is encapsulated to obtain second response data.

[0105] In another embodiment, the second response unit is used to:

[0106] If the type of the second interface is a write interface, obtaining historical process data and historical execution result data of historical access traffic that meets the screening conditions from the historical response records of the second interface; wherein the screening conditions include: the historical access traffic and the second access traffic contain similar request parameters, and the historical access traffic and the second access traffic request the same service;

[0107] The historical process data and the historical execution result data are encapsulated to obtain second response data.

[0108] In another embodiment, the service requested by the second access traffic includes multiple service operations, the historical process data includes process sub-data of the multiple service operations, and the historical execution result data includes result sub-data of the multiple service operations;

[0109] When the second response unit encapsulates the historical process data and the historical execution result data to obtain the second response data, the second response unit performs the following steps:

[0110] For each business operation, encapsulate the operation identifier, process sub-data and result sub-data of the business operation to obtain the response sub-data of the business operation;

[0111] Based on the response sub-data of the multiple business operations, second response data is obtained.

[0112] In another embodiment, the verification unit is used to:

[0113] determining, based on the operation identifier included in the first response sub-data in the first response data, second response sub-data in the second response data, wherein the second response sub-data and the first response sub-data include the same operation identifier;

[0114] Performing consistency comparison on the first response sub-data and the second response sub-data to obtain a comparison result;

[0115] Based on the comparison result, a consistency check result of the first interface and the second interface is determined.

[0116] In another embodiment, the verification unit is used to:

[0117] Performing text feature extraction on the first response data to obtain a first text feature;

[0118] Performing text feature extraction on the second response data to obtain a second text feature;

[0119] Inputting the first text feature and the second text feature into a text recognition model for recognition, and obtaining a similarity between the first response data and the second response data;

[0120] Based on the similarity, a consistency check result of the first interface and the second interface is determined.

[0121] In another embodiment, the interface consistency checking device further includes:

[0122] A generating unit is used to determine difference data between the first response data and the second response data if the consistency check result is failed, and generate prompt information based on the difference data.

[0123] In another embodiment, the interface consistency checking device further includes:

[0124] An offline unit is used to offline the second interface after a specified period of time if the consistency check result is passed.

[0125] In another embodiment, the diversion unit is used to:

[0126] Performing a hash operation on the user identifier contained in the access traffic to obtain a hash value;

[0127] Based on the hash value and the diversion ratio, the access traffic is divided into the first access traffic and the second access traffic.

[0128] In another embodiment, the interface consistency checking device further includes:

[0129] An interception unit, used for intercepting the access traffic through a gateway;

[0130] A forwarding unit, configured to forward the first access traffic to the first interface through the gateway, and forward the second access traffic to the second interface.

[0131] Obviously, the interface consistency checking device 500 provided in the embodiment of the present application can be used as the above Figure 1 The interface consistency verification method shown in the figure is executed by the subject, so that the interface consistency verification device can be implemented in Figure 1 The functions realized are as follows. Since the principles are the same, they will not be described in detail.

[0132] Figure 6 This is a schematic diagram of the structure of an electronic device according to an embodiment of the present application. Figure 6 At the hardware level, the electronic device includes a processor, and optionally also includes an internal bus, a network interface, and a memory. The memory may include a memory, such as a high-speed random access memory (RAM), and may also include a non-volatile memory (non-volatile memory), such as at least one disk storage. Of course, the electronic device may also include hardware required for other services.

[0133] The processor, network interface and memory can be interconnected through an internal bus, which can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 6 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0134] The memory is used to store the program. Specifically, the program may include a program code, and the program code includes a computer operation instruction. The memory may include a memory and a non-volatile memory, and provides instructions and data to the processor.

[0135] The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it, forming an interface consistency check device at the logical level. The processor executes the program stored in the memory and is specifically used to perform the following operations:

[0136] Dividing access traffic to an interface into first access traffic and second access traffic, the interface comprising a first interface and a second interface, the first interface being obtained by migrating the second interface;

[0137] Calling the first interface to execute the service requested by the first access traffic, and obtaining first response data;

[0138] Based on the service processing policy that matches the type of the second interface, execute the service requested by the second access traffic to obtain second response data;

[0139] The first response data and the second response data are compared to obtain a consistency check result between the first interface and the second interface.

[0140] The above application Figure 1The method performed by the interface consistency check device disclosed in the illustrated embodiment can be applied to a processor or implemented by a processor. The processor may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware in the processor or an instruction in the form of software. The above processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present application can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the embodiments of the present application can be directly embodied as a hardware decoding processor for execution, or a combination of hardware and software modules in the decoding processor for execution. The software module can be located in a storage medium mature in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory, and the processor reads the information in the memory and completes the steps of the above method in combination with its hardware.

[0141] The electronic device may also perform Figure 1 The method and the interface consistency checking device are implemented in Figures 1 to 4 The functions of the illustrated embodiment will not be described in detail in the embodiments of the present application.

[0142] Of course, in addition to software implementation methods, the electronic device of the present application does not exclude other implementation methods, such as logic devices or a combination of software and hardware, etc. That is to say, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.

[0143] The embodiment of the present application also provides a computer-readable storage medium, which stores one or more programs, wherein the one or more programs include instructions, which, when executed by a portable electronic device including a plurality of application programs, enable the portable electronic device to execute Figure 1 The method of the embodiment shown is specifically used to perform the following operations:

[0144] Dividing access traffic to an interface into first access traffic and second access traffic, the interface comprising a first interface and a second interface, the first interface being obtained by migrating the second interface;

[0145] Calling the first interface to execute the service requested by the first access traffic, and obtaining first response data;

[0146] Based on the service processing policy that matches the type of the second interface, execute the service requested by the second access traffic to obtain second response data;

[0147] The first response data and the second response data are compared to obtain a consistency check result between the first interface and the second interface.

[0148] An embodiment of the present application also provides a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program, and the computer program is operable to cause a computer to execute some or all of the steps in the interface consistency verification method provided in the embodiment of the present application.

[0149] In short, the above description is only a preferred embodiment of the present application and is not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.

[0150] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.

[0151] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.

[0152] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0153] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

Claims

1. An interface consistency method, characterized in that: include: Dividing access traffic to an interface into first access traffic and second access traffic, the interface comprising a first interface and a second interface, the first interface being obtained by migrating the second interface; Calling the first interface to execute the service requested by the first access traffic, and obtaining first response data; Based on the service processing policy that matches the type of the second interface, execute the service requested by the second access traffic to obtain second response data; The first response data and the second response data are compared to obtain a consistency check result between the first interface and the second interface.

2. The method according to claim 1, characterized in that The service processing policy based on the matching of the type of the second interface, executing the service requested by the second access traffic, and obtaining the second response data, includes: If the type of the second interface is a read interface, calling the second interface to execute the service requested by the second access flow to obtain execution result data; The execution result data is encapsulated to obtain second response data.

3. The method according to claim 1, characterized in that: The service processing policy based on the matching of the type of the second interface, executing the service requested by the second access traffic, and obtaining the second response data, includes: If the type of the second interface is a write interface, obtaining historical process data and historical execution result data of historical access traffic that meets the screening conditions from the historical response records of the second interface; wherein the screening conditions include: the historical access traffic and the second access traffic contain similar request parameters, and the historical access traffic and the second access traffic request the same service; The historical process data and the historical execution result data are encapsulated to obtain second response data.

4. The method according to claim 3, characterized in that: The service requested by the second access traffic includes a plurality of service operations, the historical process data includes process sub-data of the plurality of service operations, and the historical execution result data includes result sub-data of the plurality of service operations; The encapsulating the historical process data and the historical execution result data to obtain second response data includes: For each business operation, encapsulate the operation identifier, process sub-data and result sub-data of the business operation to obtain the response sub-data of the business operation; Based on the response sub-data of the multiple business operations, second response data is obtained.

5. The method according to claim 4, characterized in that The comparing the first response data with the second response data to obtain a consistency check result between the first interface and the second interface includes: determining, based on the operation identifier included in the first response sub-data in the first response data, second response sub-data in the second response data, wherein the second response sub-data and the first response sub-data include the same operation identifier; Performing consistency comparison on the first response sub-data and the second response sub-data to obtain a comparison result; Based on the comparison result, a consistency check result of the first interface and the second interface is determined.

6. The method according to claim 1, characterized in that The comparing the first response data with the second response data to obtain a consistency check result between the first interface and the second interface includes: Performing text feature extraction on the first response data to obtain a first text feature; Performing text feature extraction on the second response data to obtain a second text feature; Inputting the first text feature and the second text feature into a text recognition model for comparison, and obtaining a similarity between the first response data and the second response data; Based on the similarity, a consistency check result of the first interface and the second interface is determined.

7. The method according to claim 1, characterized in that After comparing the first response data with the second response data to obtain a consistency check result between the first interface and the second interface, the method further includes: If the consistency check result is failed, determining difference data between the first response data and the second response data; Prompt information is generated based on the difference data.

8. The method according to claim 1, characterized in that After comparing the first response data with the second response data to obtain a consistency check result between the first interface and the second interface, the method further includes: If the consistency check result is passed, the second interface is offline after a specified period of time.

9. The method according to claim 1, characterized in that: The dividing the access traffic to the interface into the first access traffic and the second access traffic includes: Performing a hash operation on the user identifier contained in the access traffic to obtain a hash value; Based on the hash value and the diversion ratio, the access traffic is divided into the first access traffic and the second access traffic.

10. The method according to any one of claims 1 to 9, characterized in that Before dividing the access traffic to the interface into the first access traffic and the second access traffic, the method further includes: Intercepting the access traffic through a gateway; After dividing the access traffic to the interface into the first access traffic and the second access traffic, the method further includes: The first access traffic is forwarded to the first interface through the gateway, and the second access traffic is forwarded to the second interface.

11. An interface consistency verification device, characterized in that: include: A traffic distribution unit, configured to divide access traffic to an interface into a first access traffic and a second access traffic, wherein the interface includes a first interface and a second interface, and the first interface is obtained by migrating the second interface; A first response unit, configured to call the first interface to execute the service requested by the first access flow and obtain first response data; A second response unit, configured to execute the service requested by the second access traffic based on a service processing policy that matches the type of the second interface, and obtain second response data; A verification unit is used to compare the first response data with the second response data to obtain a consistency verification result between the first interface and the second interface.

12. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the interface consistency verification method as described in any one of claims 1 to 10.

13. A computer-readable storage medium, characterized in that: When the instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the interface consistency verification method as described in any one of claims 1 to 10.

14. A computer program product, characterized in that The computer program product comprises a non-transitory computer-readable storage medium storing a computer program, wherein the computer program is operable to cause a computer to execute part or all of the steps in the interface consistency checking method according to any one of claims 1 to 10.