Gray release coverage rate detection method and device, equipment, storage medium and product
By obtaining and comparing jar packages for grayscale environments and production environments in the pipeline, performing code link analysis and log collection, the automation problem of grayscale release coverage detection is solved, and the accuracy and efficiency of detection is improved.
Patent Information
- Application Number
- CN202410944144.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-15
- Publication Date
- 2024-11-12
AI Technical Summary
In the grayscale release environment, the lack of automated coverage detection methods leads to insufficient verification and the inaccurate detection of grayscale release coverage.
By obtaining grayscale jar packages in the grayscale environment during pipeline execution, comparing jar packages with production environments, performing code link analysis, and collecting log information to automatically detect grayscale publishing coverage.
Automatic detection of grayscale environment and formal environment change codes is realized, accurate evaluation of grayscale release coverage, and improved production quality and environmental stability.
Smart Images

Figure CN118939535A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of grayscale release technology, and in particular to a grayscale release coverage detection method, device, equipment, storage medium and product. Background Art
[0002] With the advent of the In Cloud era, it has become increasingly important to improve the quality of production environment and ensure the stable operation of the production environment. Most systems in the industry have built a mature grayscale release system, such as the grayscale release of the OAM platform, the blue-green release used by the CMS operation platform, and the grayscale management system developed by W+. However, production problems caused by the online production link are common. After the grayscale environment is released, whether there are functional defects and whether the verification has passed mainly depends on the feedback of the verification personnel. When the verification is not sufficient, the verification results obtained are often incomplete. Therefore, how to automatically detect the changed code between the grayscale environment and the formal environment, and then accurately detect the grayscale release coverage, has become a problem that needs to be solved urgently. Summary of the invention
[0003] The main purpose of this application is to provide a grayscale release coverage detection method, device, equipment, storage medium and product, aiming to solve the technical problem of how to automatically detect the changed code between the grayscale environment and the formal environment, and then accurately detect the grayscale release coverage.
[0004] To achieve the above objectives, the present application provides a grayscale release coverage detection method, which comprises the following steps:
[0005] During the pipeline execution, obtain the grayscale jar package in the grayscale environment;
[0006] Compare the grayscale jar package with the production jar package in the production environment to obtain a code change file;
[0007] Performing code link analysis on the code change file, and determining the affected object according to the link analysis result;
[0008] Logs are collected for the affected objects, and the grayscale release coverage is detected based on the collected log information.
[0009] Optionally, the step of performing code link analysis on the code change file and determining the affected object according to the link analysis result specifically includes:
[0010] Perform code analysis on the grayscale jar package based on static program analysis generated by bytecode to obtain code analysis results;
[0011] Traversing the changed code in the code change file, and judging whether the grayscale jar package deletes the code according to the traversal result;
[0012] A call analysis is performed according to the judgment result, and an affected object is determined according to the call analysis result and the code analysis result.
[0013] Optionally, the step of performing call analysis according to the judgment result, and determining the affected object according to the call analysis result and the code analysis result specifically includes:
[0014] When the result of the judgment is that the grayscale jar package deletes the code, searching the target code corresponding to the deleted code from the production jar package, and determining the method to which the target code belongs;
[0015] When the result of the judgment is that the grayscale jar package has not deleted the code, determining the method to which the changed code in the code change file belongs;
[0016] The method is subjected to call analysis based on the grayscale jar package, and the affected object is determined according to the call analysis result and the code analysis result.
[0017] Optionally, the step of collecting logs of the affected object and detecting the grayscale release coverage rate according to the collected log information specifically includes:
[0018] Determine discarded objects based on historical log information corresponding to each object;
[0019] Eliminate the discarded object from the affected objects to obtain the target object;
[0020] Logs are collected for the target object, and the grayscale release coverage is detected based on the collected log information.
[0021] Optionally, the step of determining discarded objects according to historical log information corresponding to each object specifically includes:
[0022] Determine the object access volume based on the historical log information corresponding to each object;
[0023] Determine the last call time corresponding to each object according to the object access amount;
[0024] When the time interval between the last call time and the current time is greater than a preset threshold, the corresponding object is regarded as an unvisited object;
[0025] The preset object and the unvisited object are regarded as abandoned objects.
[0026] Optionally, during the pipeline execution process, the step of obtaining a grayscale jar package in a grayscale environment specifically includes:
[0027] After the sub-product is registered, the registration information is pushed to the pipeline platform for pipeline registration;
[0028] After the pipeline is registered, the pipeline is executed, and during the pipeline execution, it is determined whether the project number is entered for production;
[0029] If yes, get the grayscale jar package in the grayscale environment.
[0030] In addition, to achieve the above-mentioned purpose, the present application also provides a grayscale release coverage detection device, the grayscale release coverage detection device comprising:
[0031] The jar package acquisition module is used to obtain the grayscale jar package in the grayscale environment during the pipeline execution process;
[0032] A file determination module, used to compare the grayscale jar package with the production jar package in the production environment to obtain a code change file;
[0033] An object determination module, used to perform code link analysis on the code change file and determine the affected object according to the link analysis result;
[0034] The coverage detection module is used to collect logs of the affected objects and detect the grayscale release coverage based on the collected log information.
[0035] In addition, to achieve the above-mentioned purpose, the present application also proposes a grayscale release coverage detection device, which includes: a memory, a processor, and a computer program stored on the memory and executable on the processor, and the computer program is configured to implement the steps of the grayscale release coverage detection method as described above.
[0036] In addition, to achieve the above-mentioned purpose, the present application also proposes a storage medium, which is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by the processor, the steps of the grayscale release coverage detection method described above are implemented.
[0037] In addition, to achieve the above-mentioned purpose, the present application also provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, it implements the steps of the grayscale release coverage detection method as described above.
[0038] This application obtains the grayscale jar package in the grayscale environment during the execution of the pipeline, and then compares the grayscale jar package with the production jar package in the production environment to obtain the code change file, and then performs code link analysis on the code change file, and determines the affected object based on the link analysis results, and then collects logs for the affected object, and detects the grayscale release coverage based on the collected log information. This application obtains the code change file by comparing the grayscale jar package in the grayscale environment with the production jar package in the production environment, and can automatically detect the changed code between the grayscale environment and the formal environment, and then performs code link analysis on the code change file to determine the affected object, and can obtain the affected object in the grayscale environment based on the code change file, and then collects logs for the affected object, and detects the grayscale release coverage based on the collected log information, thereby accurately detecting the grayscale release coverage. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0040] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0041] Figure 1 This is a flow chart of the first embodiment of the grayscale release coverage detection method of the present application;
[0042] Figure 2 This is a schematic diagram of the process of obtaining the grayscale jar package in an embodiment of grayscale release coverage of this application;
[0043] Figure 3 This is a flow chart of the second embodiment of the grayscale release coverage detection method of the present application;
[0044] Figure 4 This is a flowchart of obtaining affected objects according to an embodiment of grayscale release coverage rate of this application;
[0045] Figure 5 This is a code analysis comparison diagram of an embodiment of grayscale release coverage of this application;
[0046] Figure 6 A schematic diagram of supported call types of an embodiment of grayscale release coverage of the present application;
[0047] Figure 7 This is a flowchart of the third embodiment of the grayscale release coverage detection method of the present application;
[0048] Figure 8 This is a schematic diagram of discarded objects in an embodiment of a grayscale release coverage detection method of the present application;
[0049] Fig. 9 This is a logical diagram of determining unvisited objects in an embodiment of a grayscale release coverage detection method of the present application;
[0050] Fig.10 This is a structural block diagram of the first embodiment of the grayscale release coverage detection device of the present application;
[0051] Fig.11 It is a structural diagram of a grayscale release coverage detection device for a hardware operating environment involved in an embodiment of the present application.
[0052] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0053] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.
[0054] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.
[0055] The main solution of the embodiment of the present application is: during the execution of the pipeline, a grayscale jar package in a grayscale environment is obtained; the grayscale jar package is compared with the production jar package in the production environment to obtain a code change file; a code link analysis is performed on the code change file, and the affected objects are determined based on the link analysis results; logs are collected for the affected objects, and the grayscale release coverage is detected based on the collected log information.
[0056] With the advent of the In Cloud era, it has become increasingly important to improve the quality of production environment and ensure the stable operation of the production environment. Most systems in the industry have built a mature grayscale release system, such as the grayscale release of the OAM platform, the blue-green release used by the CMS operation platform, and the grayscale management system developed by W+. However, production problems caused by the online production link are common. After the grayscale environment is released, whether there are functional defects and whether the verification has passed mainly depends on the feedback of the verification personnel. When the verification is not sufficient, the verification results obtained are often incomplete.
[0057] This application obtains the grayscale jar package in the grayscale environment during the execution of the pipeline, and then compares the grayscale jar package with the production jar package in the production environment to obtain the code change file, and then performs code link analysis on the code change file, and determines the affected object based on the link analysis results, and then collects logs for the affected object, and detects the grayscale release coverage based on the collected log information. This application obtains the code change file by comparing the grayscale jar package in the grayscale environment with the production jar package in the production environment, and can automatically detect the changed code between the grayscale environment and the formal environment, and then performs code link analysis on the code change file to determine the affected object, and can obtain the affected object in the grayscale environment based on the code change file, and then collects logs for the affected object, and detects the grayscale release coverage based on the collected log information, thereby accurately detecting the grayscale release coverage.
[0058] It should be noted that the execution subject of the present application may be a computing service device with data processing, network communication and program running functions, such as a tablet computer, a personal computer, etc., or an electronic device capable of realizing the above functions, a grayscale release coverage detection device, etc. The following takes the grayscale release coverage detection device as an example to illustrate this embodiment and the following embodiments.
[0059] Based on this, the present application embodiment provides a grayscale release coverage detection method, referring to Figure 1 , Figure 1 This is a flow chart of the first embodiment of the grayscale release coverage detection method of the present application.
[0060] In this embodiment, the grayscale release coverage detection method includes the following steps:
[0061] Step S10: During the execution of the pipeline, a grayscale jar package in a grayscale environment is obtained.
[0062] Furthermore, in order to effectively obtain the grayscale jar package, in this embodiment, the step S10 includes: after the sub-product is registered, the registration information is pushed to the pipeline platform for pipeline registration; after the pipeline registration, the pipeline is executed, and during the pipeline execution, it is determined whether the project number is entered for production; if so, the grayscale jar package in the grayscale environment is obtained.
[0063] Understandably, referring to Figure 2 , Figure 2 This is a flow chart of obtaining the grayscale jar package in an embodiment of grayscale release coverage of this application, as shown in FIG. Figure 2As shown, this embodiment provides a visual configuration page. Users can complete the registration at the product / sub-product granularity by registering the product / sub-product number through the page. After the sub-product registration is completed, the registration information will be pushed to the pipeline platform for pipeline registration. After the pipeline registration is completed, the pipeline can be executed. During the pipeline execution process, it can be determined whether the user has entered the project number for production. If so, the pipeline will assist in saving the production jar package of the registered product to the ESC object storage, that is, obtaining the grayscale jar package in the grayscale environment.
[0064] Step S20: Compare the grayscale jar package with the production jar package in the production environment to obtain a code change file.
[0065] It can be understood that the production jar package refers to the jar package generated in the production environment. In this embodiment, the code in the grayscale jar package and the code in the production jar package can be compared line by line, that is, each line of code in the grayscale jar package is compared with each line of code in the production jar package in turn to obtain the code change file. The code change file refers to the code in the grayscale jar package compared to the production jar. The change can be deletion, addition, change, etc.
[0066] Step S30: performing code link analysis on the code change file, and determining the affected object according to the link analysis result.
[0067] It should be understood that this embodiment performs code link analysis on the code change file and determines the affected objects according to the link analysis result. The affected objects may include changed interfaces and methods.
[0068] Step S40: Collect logs of the affected objects, and detect the grayscale release coverage rate based on the collected log information.
[0069] It is understandable that logs can be collected for the affected objects, that is, the log information corresponding to the changed interfaces and methods can be collected, and the grayscale release coverage can be detected based on the log information. Specifically, it can be determined whether the changed interfaces and methods generate log information. If generated, it means that the corresponding interface or method has passed the verification, and the grayscale release coverage is calculated based on the verified interfaces and methods. For example, if there are two changed interfaces and methods and one has passed the verification, the grayscale release coverage is 50%.
[0070] This embodiment obtains the grayscale jar package in the grayscale environment during the pipeline execution process, and then compares the grayscale jar package with the production jar package in the production environment to obtain the code change file, and then performs code link analysis on the code change file, and determines the affected object according to the link analysis result, and then collects logs for the affected object, and detects the grayscale release coverage according to the collected log information. This embodiment automatically detects the changed code between the grayscale environment and the formal environment by comparing the grayscale jar package in the grayscale environment with the production jar package in the production environment, and then performs code link analysis on the code change file to determine the affected object, and can obtain the affected object in the grayscale environment according to the code change file, and then collects logs for the affected object, and detects the grayscale release coverage according to the collected log information, thereby accurately detecting the grayscale release coverage.
[0071] refer to Figure 3 , Figure 3 This is a flow chart of the second embodiment of the grayscale release coverage detection method of the present application.
[0072] Based on the above first embodiment, in this embodiment, step S30 includes:
[0073] Step S301: Perform code analysis on the grayscale jar package based on static program analysis generated by bytecode to obtain code analysis results.
[0074] Understandably, referring to Figure 4 , Figure 4 This is a flow chart of obtaining the affected objects in an embodiment of the grayscale release coverage rate of this application, as shown in FIG. Figure 4 As shown, first, you can enter the address of the grayscale jar package and the code change file (diffFiles), diffFiles{[file name, change type, change line number]}, and obtain the grayscale jar package according to the address, and then analyze the grayscale jar package based on Bcel, that is, perform code analysis on the grayscale jar package based on static program analysis generated based on bytecode to obtain the code analysis result.
[0075] It should be understood that reference Figure 5 , Figure 5 This is a code analysis comparison diagram of an embodiment of grayscale release coverage of this application, as shown in Figure 5As shown, there are three main types of code analysis methods at present. Static program analysis includes source code generation and byte code generation. The principle of source code generation is to reproduce the compiler front-end process: code lexical analysis, syntax analysis, and semantic analysis. The advantages are language independence and strong scalability, and the disadvantages are poor accuracy and slow analysis speed. The principle of byte code generation is to obtain class and method information from the .class file, and then find the invoke instruction from the byte code to obtain the calling method signature and build a call relationship graph. The advantages are simple implementation, high accuracy, and fast speed, and the disadvantage is language dependence. It also includes dynamic program analysis, the principle of which is runtime program analysis, generally based on agent piling, the advantage is that accurate and complete runtime information can be obtained, and the disadvantage is code intrusion and performance impact. The code analysis method in this embodiment is preferably based on byte code generation.
[0076] In the specific implementation, the principle of zero intrusion to the running code in the production environment and zero performance loss is followed, and most of the applications in the team are in Java. Therefore, this embodiment uses the open source bytecode static analysis tool java-callgraph2. Compared with common bytecode operation frameworks such as Bcel, ASM, and java-callgraph, java-callgraph2 supports Figure 6 The 13 call types shown are invokevirtual, invokeinterface, invokespecial, invokestatic, invokedynamic, interface and implementation class methods, Runnable implementation class thread call, Callable implementation class thread call, Thread subclass thread call, Iambda expression, parent class calling subclass implementation method, subclass calling parent class implementation method, and manually added method call relationship. Figure 6 A schematic diagram of supported call types for an embodiment of grayscale release coverage of the present application.
[0077] Step S302: Traverse the changed code in the code change file, and determine whether the grayscale jar package deletes the code based on the traversal result.
[0078] It can be understood that this embodiment can traverse the changed code in the code change file, that is, traverse the diffFiles, that is, determine whether the grayscale jar package has deleted the code based on the traversal results. Specifically, the traversal results may include all the changed codes in the code change file. If there is a changed code in the production jar package, it can be determined that the changed code may be deleted in the grayscale jar package.
[0079] Step S303: performing call analysis according to the judgment result, and determining the affected object according to the call analysis result and the code analysis result.
[0080] Furthermore, in order to accurately determine the affected object, in this embodiment, the step S303 includes: when the judgment result is that the grayscale jar package deletes the code, searching the target code corresponding to the deleted code from the production jar package, and determining the method to which the target code belongs; when the judgment result is that the grayscale jar package does not delete the code, determining the method to which the changed code in the code change file belongs; performing call analysis on the method based on the grayscale jar package, and determining the affected object according to the call analysis result and the code analysis result.
[0081] It should be understood that when the grayscale jar package deletes the code, the target code corresponding to the deleted code can be found in the production jar package, the target code can be basically consistent with the deleted code, and the method / class to which the target code belongs can be determined. When the grayscale jar package does not delete the code, the method / class to which each changed code in the code change file belongs can be determined.
[0082] In the specific implementation, after obtaining the methods / classes to which all the changed codes in the code change file belong, the above methods / classes can be called and analyzed based on the grayscale jar package, and the affected objects can be determined based on the call analysis results and the code analysis results, that is, all methods and interfaces affected by the output incremental code.
[0083] This embodiment performs code analysis on the grayscale jar package based on static program analysis generated by bytecode, obtains code analysis results, then traverses the changed code in the code change file, and determines whether the grayscale jar package deletes the code based on the traversal results, and then performs call analysis based on the judgment results, and determines the affected objects based on the call analysis results and the code analysis results. This embodiment traverses the changed code in the code change file, and determines whether the grayscale jar package deletes the code based on the traversal results, and then accurately and effectively performs call analysis based on the judgment results, and determines the affected objects based on the call analysis results and the code analysis results.
[0084] refer to Figure 7 , Figure 7 This is a flow chart of the third embodiment of the grayscale release coverage detection method of the present application.
[0085] Based on the above embodiments, in this embodiment, step S40 includes:
[0086] Step S401: Determine discarded objects according to the historical log information corresponding to each object.
[0087] It is understandable that the abandoned objects may include abandoned interfaces, methods and interfaces not covered by log traffic pre-set in the project. The abandoned objects may be determined based on the historical log information corresponding to each object, and the historical log information may include the log information generated when each object worked in the historical time period.
[0088] It should be understood that abandoned interfaces and methods have no access traffic. If the code change affects the abandoned interfaces and methods, these interfaces will always be identified as uncovered when the coverage is calculated. Therefore, it is necessary to check the abandoned interfaces and methods, that is, to determine the abandoned objects.
[0089] Furthermore, in order to accurately obtain abandoned objects, in this embodiment, the step S401 includes: determining the object access volume based on the historical log information corresponding to each object; determining the last call time corresponding to each object based on the object access volume; when the time interval between the last call time and the current time is greater than a preset threshold, treating the corresponding object as an unvisited object; treating the preset object and the unvisited object as abandoned objects.
[0090] Understandably, referring to Figure 8 , Figure 8 This is a schematic diagram of discarded objects in an embodiment of the grayscale release coverage detection method of this application. Figure 8 As shown in the figure, when the top-level method of the code call link is the service layer, dao layer, util method, etc., it means that this part cannot be executed when the application is running, and an abandoned mark is given as the preset object. If it is a controller, rpc, scheduled task schedule, filter, etc., it is necessary to judge whether it has been called recently, that is, judge by historical log information.
[0091] It should be understood that reference Fig. 9 , Fig. 9 This is a logical diagram of determining unvisited objects in an embodiment of a grayscale release coverage detection method of this application, such as Fig. 9As shown in the figure, since the logs of the log platform are usually only retained for 7 days, even if an independent es cluster is used to store the logs, if the log details are stored for a long time, the es storage resources will incur a large overhead. Therefore, the interface access volume of the previous few days is concentrated in the early morning every day, that is, the object access volume is determined according to the historical log information corresponding to each object, and the statistical results are stored in es. Since the values saved are aggregated by date and interface, the storage overhead is small. Then calculate the last access time of the interface that is not covered by the traffic, that is, the last call time: by parsing the es data, the term, sort, and limit can be used to analyze and obtain the time when the interface was last called, so as to determine the interface that has been recently accessed and the interface that has not been accessed for a long time, and return the judgment result, that is, the basis, to the application side. When the time interval between the last call time and the current time is greater than the preset threshold, the corresponding object is regarded as an unaccessed object, and the preset object and the unaccessed object are regarded as discarded objects.
[0092] Step S402: Eliminate the discarded object from the influencing objects to obtain the target object.
[0093] It is understandable that the target object may be an interface or method obtained after removing the discarded object from the impact object.
[0094] Step S403: Collect logs for the target object, and detect the grayscale release coverage rate based on the collected log information.
[0095] It should be understood that log collection can be performed on the target object, that is, log information corresponding to the target interface and method can be collected, and the grayscale release coverage can be detected based on the log information. Specifically, it can be determined whether the target interface and method generate log information. If generated, it means that the corresponding interface or method has passed the verification, and the grayscale release coverage is calculated based on the verified interfaces and methods. For example, there are two target interfaces and methods, and one has passed the verification, then the grayscale release coverage is 50%.
[0096] This embodiment determines the abandoned objects based on the historical log information corresponding to each object, and then removes the abandoned objects from the affected objects to obtain the target object, and then collects logs for the target object, and detects the grayscale release coverage based on the collected log information. This embodiment removes the abandoned objects from the affected objects, and can remove objects that have been identified as uncovered for a long time, and then detects the grayscale release coverage based on the log information collected for the target object, thereby accurately detecting the grayscale release coverage.
[0097] Reference Fig.10 , Fig.10 This is a structural block diagram of the first embodiment of the grayscale release coverage detection device of the present application.
[0098] like Fig.10As shown, the grayscale release coverage detection device proposed in the embodiment of the present application includes:
[0099] The jar package acquisition module 10 is used to acquire the grayscale jar package in the grayscale environment during the pipeline execution process;
[0100] A file determination module 20, used to compare the grayscale jar package with the production jar package in the production environment to obtain a code change file;
[0101] The object determination module 30 is used to perform code link analysis on the code change file and determine the affected object according to the link analysis result;
[0102] The coverage detection module 40 is used to collect logs of the affected objects and detect the coverage of the grayscale release based on the collected log information.
[0103] This embodiment obtains the grayscale jar package in the grayscale environment during the pipeline execution process, and then compares the grayscale jar package with the production jar package in the production environment to obtain the code change file, and then performs code link analysis on the code change file, and determines the affected object according to the link analysis result, and then collects logs for the affected object, and detects the grayscale release coverage according to the collected log information. This embodiment automatically detects the changed code between the grayscale environment and the formal environment by comparing the grayscale jar package in the grayscale environment with the production jar package in the production environment, and then performs code link analysis on the code change file to determine the affected object, and can obtain the affected object in the grayscale environment according to the code change file, and then collects logs for the affected object, and detects the grayscale release coverage according to the collected log information, thereby accurately detecting the grayscale release coverage.
[0104] It should be noted that the workflow described above is merely illustrative and does not limit the scope of protection of the present application. In practical applications, technicians in this field can select part or all of it according to actual needs to achieve the purpose of the present embodiment, and no limitation is made here.
[0105] In addition, for technical details not described in detail in this embodiment, please refer to the grayscale release coverage detection method provided in any embodiment of the present application, which will not be repeated here.
[0106] Based on the above-mentioned first embodiment of the grayscale release coverage detection device of the present application, a second embodiment of the grayscale release coverage detection device of the present application is proposed.
[0107] In this embodiment, the object determination module 30 is also used to perform code analysis on the grayscale jar package based on static program analysis generated by bytecode to obtain code analysis results; traverse the changed code in the code change file, and determine whether the grayscale jar package deletes the code based on the traversal results; perform call analysis based on the judgment results, and determine the affected objects based on the call analysis results and the code analysis results.
[0108] Furthermore, the object determination module 30 is also used to search for the target code corresponding to the deleted code from the production jar package and determine the method to which the target code belongs when the judgment result is that the grayscale jar package has deleted the code; determine the method to which the changed code in the code change file belongs when the judgment result is that the grayscale jar package has not deleted the code; perform call analysis on the method based on the grayscale jar package, and determine the affected object based on the call analysis result and the code analysis result.
[0109] Furthermore, the coverage detection module 40 is also used to determine the abandoned objects according to the historical log information corresponding to each object; remove the abandoned objects from the affected objects to obtain the target objects; collect logs for the target objects, and detect the grayscale release coverage according to the collected log information.
[0110] Furthermore, the coverage detection module 40 is also used to determine the object access volume based on the historical log information corresponding to each object; determine the last call time corresponding to each object based on the object access volume; when the time interval between the last call time and the current time is greater than a preset threshold, the corresponding object is regarded as an unvisited object; and the preset object and the unvisited object are regarded as discarded objects.
[0111] Furthermore, the jar package acquisition module 10 is also used to push the registration information to the pipeline platform for pipeline registration after the sub-product is registered; after the pipeline is registered, the pipeline is executed, and during the pipeline execution process, it is determined whether the project number is entered for production; if so, the grayscale jar package in the grayscale environment is obtained.
[0112] Other embodiments or specific implementation methods of the grayscale release coverage detection device of the present application can refer to the above-mentioned method embodiments and will not be repeated here.
[0113] The present application provides a grayscale release coverage detection device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the grayscale release coverage detection method in the above-mentioned embodiment one.
[0114] Reference below Fig.11 , which shows a schematic diagram of the structure of a grayscale release coverage detection device suitable for implementing the embodiment of the present application. The grayscale release coverage detection device in the embodiment of the present application may include but is not limited to mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Fig.11 The grayscale release coverage detection device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0115] like Fig.11 As shown, the grayscale release coverage detection device may include a processing device 1001 (such as a central processing unit, a graphics processor, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. In RAM1004, various programs and data required for the operation of the grayscale release coverage detection device are also stored. The processing device 1001, ROM1002 and RAM1004 are connected to each other via a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Typically, the following systems can be connected to the I / O interface 1006: input devices 1007 including, for example, a touch screen, a touchpad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; output devices 1008 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; storage devices 1003 including, for example, a magnetic tape, a hard disk, etc.; and communication devices 1009. The communication device 1009 can allow the grayscale release coverage detection device to communicate wirelessly or wired with other devices to exchange data. Although the figure shows a grayscale release coverage detection device with various systems, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems may be implemented or have instead.
[0116] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.
[0117] The grayscale release coverage detection device provided by the present application adopts the grayscale release coverage detection method in the above embodiment, which can solve the technical problem of how to automatically detect the change code between the grayscale environment and the formal environment, and then accurately detect the grayscale release coverage. Compared with the prior art, the beneficial effects of the grayscale release coverage detection device provided by the present application are the same as the beneficial effects of the grayscale release coverage detection method provided by the above embodiment, and the other technical features in the grayscale release coverage detection device are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.
[0118] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.
[0119] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
[0120] The present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer programs) stored thereon, and the computer-readable program instructions are used to execute the grayscale release coverage detection method in the above-mentioned embodiment.
[0121] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination of the above.
[0122] The above-mentioned computer-readable storage medium may be included in the grayscale release coverage detection device; or it may exist independently without being assembled into the grayscale release coverage detection device.
[0123] The above-mentioned computer-readable storage medium carries one or more programs. When the above-mentioned one or more programs are executed by the grayscale release coverage detection device, the grayscale release coverage detection device: obtains the grayscale jar package in the grayscale environment during the pipeline execution process; compares the grayscale jar package with the production jar package in the production environment to obtain the code change file; performs code link analysis on the code change file, and determines the affected object according to the link analysis result; collects logs for the affected object, and detects the grayscale release coverage based on the collected log information.
[0124] Computer program code for performing the operations of the present application may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0125] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0126] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.
[0127] The readable storage medium provided by the present application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned grayscale release coverage detection method, and can solve the technical problem of how to automatically detect the change code between the grayscale environment and the formal environment, and then accurately detect the grayscale release coverage. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided by the present application are the same as the beneficial effects of the grayscale release coverage detection method provided by the above-mentioned embodiment, and will not be repeated here.
[0128] The present application also provides a computer program product, including a computer program, which implements the steps of the grayscale release coverage detection method as described above when executed by a processor.
[0129] The computer program product provided by this application can solve the technical problem of how to automatically detect the changed code of the grayscale environment and the formal environment, and then accurately detect the grayscale release coverage. Compared with the prior art, the beneficial effects of the computer program product provided by this application are the same as the beneficial effects of the grayscale release coverage detection method provided by the above embodiment, which will not be repeated here.
[0130] The above descriptions are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect applications in other related technical fields are included in the patent protection scope of the present application.
Claims
1. A grayscale release coverage detection method, characterized in that: The grayscale release coverage detection method comprises the following steps: During the pipeline execution, obtain the grayscale jar package in the grayscale environment; Compare the grayscale jar package with the production jar package in the production environment to obtain a code change file; Performing code link analysis on the code change file, and determining the affected object according to the link analysis result; Logs are collected for the affected objects, and the grayscale release coverage is detected based on the collected log information.
2. The grayscale release coverage detection method according to claim 1, characterized in that: The step of performing code link analysis on the code change file and determining the affected object according to the link analysis result specifically includes: Perform code analysis on the grayscale jar package based on static program analysis generated by bytecode to obtain code analysis results; Traversing the changed code in the code change file, and judging whether the grayscale jar package deletes the code according to the traversal result; A call analysis is performed according to the judgment result, and an affected object is determined according to the call analysis result and the code analysis result.
3. The grayscale release coverage detection method according to claim 2, characterized in that: The step of performing call analysis according to the judgment result, and determining the affected object according to the call analysis result and the code analysis result specifically includes: When the result of the judgment is that the grayscale jar package deletes the code, searching the target code corresponding to the deleted code from the production jar package, and determining the method to which the target code belongs; When the result of the judgment is that the grayscale jar package has not deleted the code, determining the method to which the changed code in the code change file belongs; The method is subjected to call analysis based on the grayscale jar package, and the affected object is determined according to the call analysis result and the code analysis result.
4. The grayscale release coverage detection method according to claim 1, characterized in that: The step of collecting logs of the affected object and detecting the grayscale release coverage rate according to the collected log information specifically includes: Determine discarded objects based on historical log information corresponding to each object; Eliminate the discarded object from the affected objects to obtain the target object; Logs are collected for the target object, and the grayscale release coverage is detected based on the collected log information.
5. The grayscale release coverage detection method according to claim 4, characterized in that: The step of determining discarded objects according to the historical log information corresponding to each object specifically includes: Determine the object access volume based on the historical log information corresponding to each object; Determine the last call time corresponding to each object according to the object access amount; When the time interval between the last call time and the current time is greater than a preset threshold, the corresponding object is regarded as an unvisited object; The preset object and the unvisited object are regarded as abandoned objects.
6. The grayscale release coverage detection method according to any one of claims 1 to 5, characterized in that: The step of obtaining the grayscale jar package in the grayscale environment during the pipeline execution process specifically includes: After the sub-product is registered, the registration information is pushed to the pipeline platform for pipeline registration; After the pipeline is registered, the pipeline is executed, and during the pipeline execution, it is determined whether the project number is entered for production; If yes, get the grayscale jar package in the grayscale environment.
7. A grayscale release coverage detection device, characterized in that: The grayscale release coverage detection device comprises: The jar package acquisition module is used to obtain the grayscale jar package in the grayscale environment during the pipeline execution process; A file determination module, used to compare the grayscale jar package with the production jar package in the production environment to obtain a code change file; An object determination module, used to perform code link analysis on the code change file and determine the affected object according to the link analysis result; The coverage detection module is used to collect logs of the affected objects and detect the grayscale release coverage based on the collected log information.
8. A grayscale release coverage detection device, characterized in that: The device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the grayscale release coverage detection method according to any one of claims 1 to 6.
9. A storage medium, characterized in that: The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the grayscale release coverage detection method according to any one of claims 1 to 6 are implemented.
10. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the steps of the grayscale release coverage detection method according to any one of claims 1 to 6 are implemented.
