Customized Code Compatibility Analysis System and Method Based on Microservice Call Chain

By generating a unique tracking identifier and injecting a call chain acquisition logic portal in the SaaS platform, the compatibility problem between the custom code and the standard API after the change is solved, and the compatibility code scope is quickly identified and positioned, and the quality of product iterative research and development is improved.

CN114168421BActive Publication Date: 2025-07-11SHANGHAI ZHENYUN INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111502755.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-09
Publication Date
2025-07-11
Estimated Expiration
2041-12-09

AI Technical Summary

Technical Problem

In the SaaS platform, the compatibility issues after the change of custom code and standard API are difficult to accurately identify in the early development stage, resulting in a large number of baseline tests and potential business logic exceptions in the later stage.

Method used

The distributed link identification generator generates a unique tracking identifier in the unified gateway. The probe unit injects the call chain acquisition logical portal in the class loading stage. The data collection report client collects the call node and relationship information, and cleanses and restores the call chain information collection service unit, and finally generates a compatibility checklist on the R&D management platform.

Benefits of technology

Quickly locate the compatibility code range caused by changes in standard APIs, improve product iteration R&D quality, and reduce business logic abnormalities found later.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114168421B_ABST
    Figure CN114168421B_ABST
Patent Text Reader

Abstract

Customized code compatibility analysis system and method based on microservice call chain. A unique tracking identifier is generated at the unified gateway by a distributed link identifier generator; a probe unit injects the call chain collection logic entry into the target method during the class loading phase; a data collection and reporting client collects call node and call relationship information and reports it; a call chain information collection service unit collects and cleans call chain data and restores the call chain; a call chain information application unit is used for customized code compatibility analysis, provides call retrieval and visualization, and generates a compatibility inspection list on the R & D management platform. The present invention non-intrusively injects probes into the business system to collect call node and call relationship information; by restoring the call chain, analyzes and identifies the call link containing the call node and persists it; the present invention can quickly locate the compatibility code scope caused by the change of the standard API, so that developers can accurately locate and quickly solve the problem.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a customized code compatibility analysis system and method based on a microservice call chain, belonging to the technical field of data processing. Background Art

[0002] With the continuous upgrading of the industrial Internet and the increasing maturity of the SaaS (Software-as-a-service) technology field, more and more enterprise information systems adopt the SaaS model. Although the SaaS model solves the standard needs of certain customers, the personalized needs of different customers vary greatly. To solve the customization problem, domestic and foreign SaaS manufacturers such as Kingdee, UFIDA, and Salesforce generally adopt a microservice technology architecture to build their own personalized configuration platforms.

[0003] Currently, each SaaS manufacturer usually realizes the personalized needs of customers through the following technical methods:

[0004] (1) Build an aPaaS platform for the business model, and dynamically generate the interface layout and field components based on the model metadata configuration. The unified API at the backend realizes the data persistence logic.

[0005] (2) Introduce a business rule engine, and define the business logic rules in advance in the form of graphical configuration or scripts. Preset the data points in the standard product code, and execute the business logic according to the business configuration rules during program operation.

[0006] (3) Personalize the standard code, and implement the customization logic by embedding personalized hard-coded code in the standard product code. Dynamically judge the tenant code during operation, and call the corresponding customized code segment.

[0007] Some companies also adopt the method of independent microservices for tenants. Although this method similar to private cloud isolates the mutual influence between the standard API and the personalized logic to a certain extent, it causes waste of cloud resources and brings more difficulties to development and deployment.

[0008] Although the above several personalized technical solutions have, to a certain extent, addressed the needs of customization, they have also brought some potential quality risks to the product. When the product's standard API changes (such as the interface name or parameters change), the customer's personalized code has inevitable compatibility issues due to the limitations of various technical solutions. For example, the rule engine often uses weakly typed scripting technology, and API change errors are often only discovered during actual runtime. While the hard-coded approach can detect type errors during compilation, it cannot sense changes in internal logic and only discovers logical compatibility issues during runtime. For a large-scale SaaS cloud system, the customer's personalized code is scattered in the internal code structures of numerous microservices, and a change in one interface can trigger a chain reaction in multiple microservices. Such risks are difficult to detect thoroughly during the early development stage, bringing a huge workload to daily code inspections and often relying on a large number of baseline tests to cover in the later stage. Summary of the Invention

[0009] Therefore, the present invention provides a customerized code compatibility analysis system and method based on a microservice call chain, which can quickly locate the compatibility code scope caused by standard API changes, so that developers can accurately locate and quickly resolve the issues.

[0010] To achieve the above object, the present invention provides the following technical solutions: A customerized code compatibility analysis system based on a microservice call chain, including:

[0011] A distributed link identifier generator, which is used to generate a unique trace identifier at the unified gateway;

[0012] A probe unit, which injects call chain collection logic entries into target methods during the class loading phase;

[0013] A data collection and reporting client, which is used to collect call node and call relationship information and report them;

[0014] A call chain information collection service unit, which is used to collect and clean call chain data and restore the call chain;

[0015] A call chain information application unit, which is used to perform customerized code compatibility analysis, provide call retrieval and visualization, and generate a compatibility inspection list on the R & D management platform.

[0016] As a preferred solution of the customerized code compatibility analysis system based on a microservice call chain, the distributed link identifier generator transmits the unique trace identifier between different microservices and between different threads in the same process through the call chain trace.

[0017] As an optimal solution of the customized code compatibility analysis system based on the microservice call chain, it further includes a message unit, and the data collection and reporting client asynchronously reports the collected call nodes and call relationship information to the call chain information collection service unit through the message unit.

[0018] As an optimal solution of the customized code compatibility analysis system based on the microservice call chain, it further includes a relational database. The call chain information collection service unit persists the restored call chain information into the relational database, providing data support for compatibility analysis through the relational database.

[0019] As an optimal solution of the customized code compatibility analysis system based on the microservice call chain, it further includes a KV in-memory database, which is used by the data collection and reporting client and the call chain information collection service unit to check for duplicate call chain information.

[0020] The present invention also provides a customized code compatibility analysis method based on the microservice call chain. Using the above-mentioned customized code compatibility analysis system based on the microservice call chain, it includes basic data preparation, call data collection, call data processing, and compatibility analysis.

[0021] As an optimal solution of the customized code compatibility analysis method based on the microservice call chain, the basic data preparation includes:

[0022] (11) When a user request arrives at the business service, obtain or generate a unique distributed link tracking identifier.

[0023] (12) Obtain the current tenant information, service information, version information, and menu information of the user request.

[0024] As an optimal solution of the customized code compatibility analysis method based on the microservice call chain, the call data collection includes:

[0025] (21) Record the class name and target method information being executed, and record one target method as one call node.

[0026] (22) According to the original call tree, describe the call nodes and the called nodes through call pairs.

[0027] (23) Determine whether the call chain has been processed. If it has been processed, discard it; if not, report it to the call chain information collection service unit.

[0028] (24) Asynchronously report the call chain to the call chain information collection service unit.

[0029] As an optimal solution of the customized code compatibility analysis method based on the microservice call chain, the call data processing includes:

[0030] (31) Determine whether the call chain has been processed. If it has been processed, discard it; if not, process the call chain.

[0031] (32) Restore the original call tree according to the call pair composed of the calling node and the called node.

[0032] (33) Persist the processed call chain information.

[0033] (34) Mark that the call chain has been processed.

[0034] As an optimal solution of the customized code compatibility analysis method based on the microservice call chain, the compatibility analysis includes:

[0035] (41) Query all call chains containing the calling node according to the class name and the target method name of the calling node.

[0036] (42) Mark the requirements for the calling node according to the class name and the target method name of the calling node, and generate a compatibility checklist for the requirements mark.

[0037] The present invention has the following advantages: A unique tracking identifier is generated at the unified gateway by the distributed link identifier generator; the probe unit injects the call chain collection logic entry into the target method during the class loading phase; the data collection and reporting client collects the calling node and call relationship information and reports it; the call chain information collection service unit collects and cleans the call chain data and restores the call chain; the call chain information application unit is used for customized code compatibility analysis, provides call retrieval and visualization, and generates a compatibility checklist on the R & D management platform. The present invention non-intrusively injects into the business system through the probe to collect the calling node and call relationship information; by restoring the call chain, analyzes and identifies the call link containing the calling node, persists it, and accumulatively improves the relational database; on the basis of the relational database, develops and implements a retrieval standard method to obtain the relevant call link, which can be flexibly displayed; can generate a compatibility checklist, providing a basis for testing compatibility and verifying the online memo; uses the present invention to solve the technical problem that after the SaaS platform is customized, the customized logic cannot perceive the change of the standard logic, resulting in abnormal business logic, and can quickly locate the compatibility code range caused by the change of the standard API (including the customer's function menu, microservice code distribution list, etc.), so that developers can accurately locate and quickly solve it, greatly improving the quality of product iterative R & D. Description of the Drawings

[0038] To more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the drawings in the following description are only exemplary, and for those of ordinary skill in the art, without creative efforts, other implementation drawings can also be obtained based on the provided drawings.

[0039] The structures, proportions, sizes, etc. illustrated in this specification are only used to cooperate with the content disclosed in the specification for those familiar with this technology to understand and read, and are not used to limit the limiting conditions for the implementation of the present invention. Therefore, they do not have substantial technical significance. Any modification of the structure, change in the proportional relationship, or adjustment of the size, without affecting the effects that the present invention can produce and the purposes that can be achieved, should still fall within the scope covered by the technical content disclosed in the present invention.

[0040] Figure 1 Schematic diagram of the customized code compatibility analysis system based on the microservice call chain provided in the embodiment of the present invention;

[0041] Figure 2 Schematic diagram of the persistence of call chain information in the method for analyzing the compatibility of customized code based on the microservice call chain provided in the embodiment of the present invention;

[0042] Figure 3 Schematic diagram of the call pair description in the method for analyzing the compatibility of customized code based on the microservice call chain provided in the embodiment of the present invention;

[0043] Figure 4 Schematic diagram of the call tree restoration in the method for analyzing the compatibility of customized code based on the microservice call chain provided in the embodiment of the present invention. Specific embodiments

[0044] The following specific embodiments illustrate the embodiments of the present invention. Those familiar with this technology can easily understand other advantages and effects of the present invention from the content disclosed in this specification. Obviously, the described embodiments are part of the embodiments of the present invention, not all of them. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts belong to the scope protected by the present invention.

[0045] Embodiment 1

[0046] See Figure 1 , Embodiment 1 of the present invention provides a customized code compatibility analysis system based on the microservice call chain, including:

[0047] A distributed link identifier generator 1, which is used to generate a unique tracking identifier at the unified gateway;

[0048] The probe unit 2 injects the call chain collection logic entry into the target method during the class loading phase;

[0049] The data collection and reporting client 3 is used to collect call nodes, call relationship information and report them;

[0050] The call chain information collection service unit 4 is used to collect and clean call chain data and restore the call chain;

[0051] The call chain information application unit 5 is used to perform customized code compatibility analysis, provide call retrieval and visualization, and generate a compatibility check list on the R & D management platform.

[0052] In this embodiment, the distributed link identifier generator 1 passes a unique tracking identifier between different microservices and between different threads of the same process through the call chain trace.

[0053] Specifically, the distributed link identifier generator 1 generates a unique tracking identifier (TraceID) at the unified gateway, and reliably passes the unique tracking identifier along the call chain trace of the microservice between different microservices and between different threads of the same process. The unique tracking identifier can be called once in the microservice system.

[0054] Specifically, a complete microservice system contains multiple microservice units, and there are mutual calls between the microservice subsystems, thus forming a call chain. The call chain can record the components, microservices, total request duration and the duration spent by each component experienced from the client request being sent to being responded.

[0055] Specifically, the link tracing frameworks for tracking the call process of microservices include Zipkin, Pinpoint, SkyWalking, and CAT.

[0056] Among them, Zipkin is an open-source call chain analysis tool by Twitter and has been widely used based on spring cloud sleuth. Its characteristics are lightweight and simple to use and deploy.

[0057] Pinpoint is a call chain analysis based on bytecode injection and an application monitoring analysis tool. It supports multiple plugins, has a powerful UI function, and has no code intrusion at the access end.

[0058] SkyWalking is a locally open-source call chain analysis based on bytecode injection and an application monitoring analysis tool. It supports multiple plugins, has a relatively powerful UI function, has no code intrusion at the access end, and has joined the Apache incubator.

[0059] CAT is a monitoring platform tool for call chain analysis, application monitoring analysis, log collection, monitoring and alarming, etc. based on coding and configuration, which is open-sourced by Dianping.

[0060] Specifically, Java provides a technology that relies on Java agent to modify the bytecode of the target method to achieve non-invasive data embedding. The collector that uses this Java agent method is called a probe. When the application starts or during runtime using the attach(pid) method, the probe package can be imported into the application to complete the implantation of data embedding.

[0061] In the probe unit 2, the non-invasive method can achieve seamless hot upgrade. Users do not need to understand the underlying principles and can use the complete monitoring service. At present, many open-source monitoring products have provided rich Java probe libraries, which, as providers of monitoring services, further reduce the development cost.

[0062] In this embodiment, it also includes a message unit 6. The data collection and reporting client 3 asynchronously reports the collected call nodes and call relationship information to the call chain information collection service unit 4 through the message unit 6.

[0063] Specifically, the message unit 6 integrates a message system. Open-source message systems that can be adopted include ActiveMQ. ActivateMQ is an open-source message system provided by Apache and is completely implemented in Java, which can well support the JMS specification proposed by J2EE.

[0064] Among them, JMS is a set of Java application programming interfaces that provide a series of services such as message creation, sending, receiving, and reading. It is a vendor-independent API that can communicate well with message components from different manufacturers. The message types supported by JMS include simple text, serializable objects, key-value pairs, byte streams, streams, and messages without a payload, etc. The message sending is asynchronous. After the message sender sends the message, it does not need to wait for the message receiver to respond immediately, which improves the efficiency of distributed system collaboration.

[0065] In this embodiment, it also includes a relational database 7. The call chain information collection service unit 4 persists the restored call chain information into the relational database 7 to provide data support for compatibility analysis through the relational database 7.

[0066] Specifically, the relational database 7 uses a relational model to organize data and stores data in the form of rows and columns for easy understanding by users. The relational model can be understood as a two-dimensional table model, and a relational database is a data organization composed of two-dimensional tables and the relationships between them.

[0067] SeeFigure 2 For call chain information data persistence, it is to convert the data model in memory into a storage model and convert the storage model into the data model in memory. The data model can be any data structure or object model, and the storage model can be a relational model, XML, binary stream, etc.

[0068] In this embodiment, it further includes a KV in-memory database 8, which is used by the data collection and reporting client and the call chain information collection service unit to check for duplicate call chain information.

[0069] Specifically, the KV in-memory database 8 is used to collect the data collection and reporting client 3 and the data collection and reporting client 3 to check for duplicate call chain information, preventing duplicate collection and processing.

[0070] Among them, the KV in-memory database 8 refers to a Key-Value database, which is a database that stores data in key-value pairs. Similar to a map in Java, the entire database can be understood as a large map, and each key will correspond to a unique value. The KV in-memory database 8 has a fast query speed, can store a large amount of data, and supports high concurrency, and is very suitable for querying through the primary key.

[0071] In summary, the present invention generates a unique tracking identifier at the unified gateway through a distributed link identifier generator; the probe unit injects the call chain collection logic entry into the target method during the class loading phase; the data collection and reporting client collects call nodes and call relationship information and reports them; the call chain information collection service unit collects and cleans call chain data and restores the call chain; the call chain information application unit is used for custom code compatibility analysis, provides call retrieval and visualization, and generates a compatibility check list on the R & D management platform. The present invention non-intrusively injects into the business system through the probe to collect call nodes and call relationship information; through call chain restoration, analyzes and identifies the call link containing the call node, persists it, and accumulatively improves the relational database; on the basis of the relational database, develops and implements a retrieval standard method to obtain relevant call links, which can be flexibly displayed according to the tenant and menu dimensions; can generate a compatibility check list to provide a basis for testing compatibility and online memo verification; uses the present invention to solve the technical problem that after the SaaS platform is customized, the customized logic cannot perceive the standard logic change, resulting in business logic exceptions, and can quickly locate the compatibility code range caused by the standard API change (including the customer's function menu, microservice code distribution list, etc.), so that developers can accurately locate and quickly solve it, greatly improving the quality of product iteration and R & D.

[0072] Embodiment 2

[0073] See Figure 3 and Figure 4, Embodiment 2 of the present invention further provides a method for analyzing the compatibility of customized code based on a microservice call chain, which adopts the microservice call chain-based customized code compatibility analysis system in Embodiment 1 or any possible implementation manner thereof, including basic data preparation, call data collection, call data processing, and compatibility analysis.

[0074] Specifically, the basic data preparation includes:

[0075] (11) When a user request arrives at the business service, obtain or generate a unique tracking identifier for the distributed link;

[0076] (12) Obtain the current tenant information, service information, version information, and menu information of the user request.

[0077] Specifically, the call data collection includes:

[0078] (21) Record the class name and target method information being executed, and record one target method as one call node;

[0079] (22) According to the original call tree, describe the call node and the called node through a call pair;

[0080] (23) Determine whether the call chain has been processed. If it has been processed, discard it. If it has not been processed, report it to the call chain information collection service unit;

[0081] (24) Asynchronously report the call chain to the call chain information collection service unit.

[0082] Specifically, the call data processing includes:

[0083] (31) Determine whether the call chain has been processed. If it has been processed, discard it. If it has not been processed, perform call chain processing;

[0084] (32) Restore the original call tree according to the call pair composed of the call node and the called node;

[0085] (33) Persist the processed call chain information;

[0086] (34) Mark that the call chain has been processed.

[0087] Specifically, the compatibility analysis includes:

[0088] (41) Query all call chains containing the call node according to the class name and target method name of the call node; it can analyze the customized nodes affected by the upstream and downstream after the standard node is modified.

[0089] (42)Mark the call node with a requirement tag according to the class name of the call node and the target method name, generate a compatibility checklist for the requirement tag, and provide a basis for testing the affected customized nodes.

[0090] It should be noted that the above-mentioned customized code compatibility analysis method based on the microservice call chain depends on the customized code compatibility analysis system based on the microservice call chain in Embodiment 1. The specific implementation details are the same as those in Embodiment 1 and will not be elaborated here.

[0091] Embodiment 3

[0092] Embodiment 3 of the present invention provides a non-transitory computer-readable storage medium. Program codes of a customized code compatibility analysis method based on the microservice call chain are stored in the computer-readable storage medium. The program codes include instructions for executing the customized code compatibility analysis method based on the microservice call chain in Embodiment 2 or any possible implementation manner thereof.

[0093] The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or a data center integrating one or more available media. The available medium can be a magnetic medium (for example, a floppy disk, a hard disk, a magnetic tape), an optical medium (for example, a DVD), or a semiconductor medium (for example, a solid-state disk (SSD)).

[0094] Embodiment 4

[0095] Embodiment 4 of the present invention provides an electronic device, including: a memory and a processor;

[0096] The processor and the memory communicate with each other through a bus; the memory stores program instructions executable by the processor, and the processor can execute the customized code compatibility analysis method based on the microservice call chain in Embodiment 2 or any possible implementation manner thereof by calling the program instructions.

[0097] Specifically, the processor can be implemented by hardware or by software. When implemented by hardware, the processor can be a logic circuit, an integrated circuit, etc.; when implemented by software, the processor can be a general-purpose processor, which is implemented by reading software codes stored in the memory. The memory can be integrated in the processor or can exist independently outside the processor.

[0098] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the processes or functions described in the embodiments of the present invention are generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from a website, computer, server, or data center to another website, computer, server, or data center via wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.) means.

[0099] Obviously, those skilled in the art should understand that the above-mentioned modules or steps of the present invention can be implemented by a general-purpose computing device. They can be concentrated on a single computing device or distributed over a network composed of multiple computing devices. Optionally, they can be implemented by program code executable by the computing device, so that they can be stored in a storage device and executed by the computing device. And in some cases, the steps shown or described can be executed in a different order than here, or they can be made into individual integrated circuit modules respectively, or multiple modules or steps among them can be made into a single integrated circuit module to implement. In this way, the present invention is not limited to any specific combination of hardware and software.

[0100] Although the present invention has been described in detail above with general descriptions and specific embodiments, on the basis of the present invention, some modifications or improvements can be made, which are obvious to those skilled in the art. Therefore, these modifications or improvements made without departing from the spirit of the present invention all fall within the scope of protection required by the present invention.

Claims

1. A method for analyzing the compatibility of customized code based on a microservice call chain. The microservice call chain-based customized code compatibility analysis system adopted includes: Distributed Link Identification Generator, which is used to generate a unique tracking identifier at the unified gateway and reliably transmit the unique tracking identifier between different microservices and between different threads in the same process along the microservice call chain trajectory; Probe Unit, which injects the call chain collection logic entry into the target method during the class loading phase; Data Collection and Reporting Client, which is used to collect call node and call relationship information and report it; Call Chain Information Collection Service Unit, which is used to collect and clean call chain data and restore the call chain; Call Chain Information Application Unit, which is used to perform customerized code compatibility analysis, provide call retrieval and visualization, and generate a compatibility check list on the R & D management platform. It is characterized in that the method includes basic data preparation, call data collection, call data processing and compatibility analysis; The basic data preparation includes: (11) When a user request arrives at the business service, obtain or generate a unique tracking identifier for the distributed link; (12) Obtain the current tenant information, service information, version information and menu information of the user request; The call data collection includes: (21) Record the class name and target method information being executed, and record one target method as one call node; (22) According to the original call tree, describe the call node and the called node through a call pair; (23) Determine whether the call chain has been processed. If it has been processed, discard it. If it has not been processed, report it to the call chain information collection service unit; (24) Asynchronously report the call chain to the call chain information collection service unit; The call data processing includes: (31) Determine whether the call chain has been processed. If it has been processed, discard it. If it has not been processed, perform call chain processing; (32) Restore the original call tree according to the call pair composed of the call node and the called node; (33) Persist the processed call chain information; (34) Mark that the call chain has been processed; The compatibility analysis includes: (41) Query all call chains containing the call node according to the class name and target method name of the call node; (42) Mark the call node with a requirement tag according to the class name and target method name of the call node, and generate a compatibility check list for the requirement tag.

2. The method for analyzing the compatibility of customized code based on the microservice call chain according to claim 1, wherein It also includes a message unit, and the data collection and reporting client asynchronously reports the collected call node and call relationship information to the call chain information collection service unit through the message unit.

3. The method for analyzing the compatibility of customized codes based on a microservice call chain according to claim 1, wherein It also includes a relational database, and the call chain information collection service unit persists the restored call chain information into the relational database, and provides data support for compatibility analysis through the relational database.

4. The method for analyzing the compatibility of customized codes based on a microservice call chain according to claim 1, wherein It also includes a KV in-memory database, which is used for the data collection and reporting client and the call chain information collection service unit to check for duplicate call chain information.

Citation Information

Patent Citations

  • Distributed system call relationship visualization method and device

    CN111008105A

  • Word vector model-based micro-service interface division evaluation method

    CN113760778A