A method and apparatus for identifying service changes
The method automatically identifies and monitors business changes by comparing application versions, addressing manual effort and production disruptions in distributed systems, ensuring timely alerts and reduced errors.
Patent Information
- Application Number
- CN201811069076.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2018-09-13
- Publication Date
- 2025-07-15
- Estimated Expiration
- 2038-09-13
AI Technical Summary
In the prior art, code management tools cannot record to the business change level, monitoring platforms require manual configuration and workload, and version records rely on manual, which has a high error rate.
By obtaining the online time stamp of the current application version, determining the adjacent most recent historical version, comparing the code to identify the change code, and determining the change service based on the correspondence between the code and the service, automatically transmitting the service information to the monitoring platform for monitoring, and generating an alarm command when the change service is identified.
It realizes independent identification of business changes and automatic addition of alarm monitoring, reducing the workload of manual intervention and improving the accuracy and efficiency of monitoring.
Smart Images

Figure CN110895472B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular, to a method and device for identifying business changes. Background Art
[0002] With the wide application of the Internet, the architecture of computer application systems has evolved from a single-cluster hot-cold backup to a multi-cluster distributed architecture to improve the system load capacity, reduce the coupling between modules, and enhance the cohesion of modules.
[0003] Existing applications generally adopt a distributed architecture, generally use an RPC (Remote Procedure Call Protocol) framework, and are usually assembled by multiple modules with different functions.
[0004] In the process of implementing the present invention, the inventors found that the prior art has at least the following problems:
[0005] 1) There are many content changes in the online version. The currently common code management tool git can only record at the file level and will not record at the business change level;
[0006] 2) For the monitoring of each modified method by the monitoring platform, it needs to be manually configured by developers, with a large workload and being rather cumbersome; if the monitoring is not timely, it may affect large-scale operations in the existing production;
[0007] 3) For each online version, its commit record (commit ID), tags, etc. are usually manually recorded, resulting in a high cost of manual version maintenance and many errors. Summary of the Invention
[0008] In view of this, embodiments of the present invention provide a method and device for identifying business changes, which can at least solve the problem in the prior art that for the business modified in the online version, monitoring requires manual participation, with a large workload and being cumbersome.
[0009] To achieve the above object, according to one aspect of the embodiments of the present invention, a method for identifying business changes is provided, including:
[0010] Obtain the online timestamp of the current application version, and determine the historical application version closest to the online timestamp;
[0011] Compare the code in the current application version and the historical application version, and identify the changed code in the current application version;
[0012] Determine the changed services in the current application version according to the correspondence between the code and the services corresponding to the current application version; wherein, the service is the smallest granularity that can be operably executed in the current application version.
[0013] Optionally, comparing the code in the current application version and the historical application version to identify the changed code in the current application version includes:
[0014] Obtain the modules in the current application version and determine the identification information of the modules; wherein, the identification information includes at least the name of the module.
[0015] According to the identification information, determine the historical modules corresponding to the identification information in the historical application version, compare the code in the module and the historical module, and determine the changed code in the module; or
[0016] When there is no historical module corresponding to the identification information in the historical application version, determine all the code in the module as changed code.
[0017] Optionally, after determining the changed services in the current application version, it further includes:
[0018] Transmit the service information of the changed service to the monitoring platform to monitor the execution parameters of the changed service in the current application version based on the service information; and
[0019] When receiving the alarm request transmitted by the monitoring platform, generate a corresponding alarm instruction and transmit it to the alarm platform for alarm operation.
[0020] Optionally, it further includes:
[0021] Obtain the modules in the current application version, and determine the online branch where the module is located according to the module branch list corresponding to the application version;
[0022] Extract the commit records corresponding to the current application version in the determined online branch, combine the obtained commit records and mark them.
[0023] To achieve the above object, according to another aspect of the embodiments of the present invention, there is provided a device for identifying service changes, including:
[0024] A version determination module, configured to obtain the online timestamp of the current application version and determine the historical application version closest to the online timestamp.
[0025] A code identification module, configured to compare the code in the current application version and the historical application version to identify the changed code in the current application version.
[0026] A service determination module, configured to determine the changed services in the current application version according to the corresponding relationship between the code and the services corresponding to the current application version; wherein, the service is the smallest granularity that can be operably executed in the current application version.
[0027] Optionally, the code recognition module is configured to:
[0028] Obtain the modules in the current application version, and determine the identification information of the modules; wherein, the identification information includes at least the name of the module;
[0029] According to the identification information, determine the historical modules corresponding to the identification information in the historical application version, compare the code in the module and the historical module, and determine the changed code in the module; or
[0030] When there is no historical module corresponding to the identification information in the historical application version, determine all the code in the module as the changed code.
[0031] Optionally, it further includes a service monitoring module, configured to:
[0032] Transmit the service information of the changed service to a monitoring platform to monitor the execution parameters of the changed service in the current application version based on the service information; and
[0033] When receiving an alarm request transmitted by the monitoring platform, generate a corresponding alarm instruction and transmit it to an alarm platform for alarm operation.
[0034] Optionally, it further includes a tagging record module, configured to:
[0035] Obtain the modules in the current application version, and determine the online branch where the module is located according to the module branch list corresponding to the application version;
[0036] Extract the commit records corresponding to the current application version in the determined online branch, combine the obtained commit records and tag them.
[0037] To achieve the above object, according to another aspect of the embodiments of the present invention, there is provided an electronic device for identifying service changes.
[0038] The electronic device according to the embodiments of the present invention includes: one or more processors; a storage device for storing one or more programs, when the one or more programs are executed by the one or more processors, enabling the one or more processors to implement the method for identifying service changes as described in any of the above.
[0039] To achieve the above object, according to another aspect of the embodiments of the present invention, there is provided a computer-readable medium having a computer program stored thereon, and when the program is executed by a processor, the method for identifying service changes described above is implemented.
[0040] According to the solution provided by the present invention, one embodiment of the above invention has the following advantages or beneficial effects: It can automatically identify the service names corresponding to the modified code in the current version and the historically launched version, and automatically add alarm monitoring to the identified changed services.
[0041] The further effects of the above non-conventional optional methods will be described in conjunction with specific embodiments below. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] The drawings are used to better understand the present invention and do not constitute an improper limitation to the present invention. Among them:
[0043] Figure 1 is a schematic diagram of the main process of a method for identifying service changes according to an embodiment of the present invention;
[0044] Figure 2 is a schematic diagram of the main modules of a device for identifying service changes according to an embodiment of the present invention;
[0045] Figure 3 is an exemplary system architecture diagram to which an embodiment of the present invention can be applied;
[0046] Figure 4 is a schematic diagram of the structure of a computer system of a mobile device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0047] The following makes an explanation of the exemplary embodiments of the present invention in conjunction with the drawings. Various details of the embodiments of the present invention are included therein to facilitate understanding, and they should be considered merely exemplary. Therefore, those of ordinary skill in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted below.
[0048] It should be noted that the embodiments of the present invention are applicable to application systems with function / service updates. For example, warehousing systems and other application systems related to warehousing systems. The present invention is described by taking a warehousing system as an example.
[0049] In addition, in addition to being applicable to the monitoring of the online application versions, the present invention can also monitor the test versions in the test environment. However, the online application versions are relatively fixed compared to the test versions, and there is more valid data to be managed. Therefore, the present invention mainly describes the online application versions.
[0050] See Figure 1 , which shows the main flowchart of a method for identifying business changes provided by an embodiment of the present invention, including the following steps:
[0051] S101: Obtain the online timestamp of the current application version, and determine the historical application version that is closest to the online timestamp;
[0052] S102: Compare the codes in the current application version and the historical application version, and identify the changed codes in the current application version;
[0053] S103: According to the correspondence between the code corresponding to the current application version and the business, determine the changed business in the current application version; wherein, the business is the smallest granularity that can be operably executed by the current application version.
[0054] In the above embodiment, for step S101, the version involved in the present invention refers to the application program version, which is an abstract concept, and will be subsequently simplified to version for the application version. Just like when a commodity is put on the shelf with a specific name (for example, the limited J brand bag in the 2018 autumn model), each time a new function of the application is launched, there will be a version number, such as V2.01, and the version name is usually defined by the staff according to the business content launched each time.
[0055] The same application may have multiple historical versions, but the functions of each version may be different. Each version is improved compared to the closest historical version before it. Therefore, the objects to be compared are the current version and the closest historical version.
[0056] The basis for obtaining the historical version is mainly the online timestamp of the current version and the application name of the current version. For example, X Mall v1.00 - launched on August 1, 2018, X Mall v1.02 - launched on August 14, 2018. And usually, the historical versions are stored in the online server.
[0057] For step S102, due to the differences in the development environment, test environment, and online environment, for the newly launched application version currently, its functional improvements / changes compared to the historical application version need to be monitored. If an exception occurs during execution, an alarm reminder will be shown.
[0058] For the latest released version, the modules with function improvements / changes are mainly obtained by comparing the codes of two application versions. Specifically:
[0059] 1) Determine the modules and the included codes of the current version and the historical version respectively
[0060] In the version management system, the release of a version means the release of the included modules. For example, on August 9, 2018, X Mall was released, including the release of the APP (Application), background module 1, and background module 2.
[0061] The application programs developed in the Java language can package the modules with fixed functions into a compressed file with the suffix.jar to implement the specified functions. For example, module 1 - receive the username and password, module 2 - verify whether the username and password match.
[0062] For the code, it is usually stored in the git-server. Here, git is a code storage tool. However, if the code is saved on the computer, it is easy to have the situation of computer damage and code loss. Therefore, usually, the git open-source tool is used to save the code to the remote server for easy reading and storage management.
[0063] 2) Compare the codes in the modules of the current version with those in the modules of the historical version, determine the changed modules with code changes, and call the git diff command to determine the changed code;
[0064] The command form is as follows:
[0065] diff—git a / f1b / f1
[0066] index 6f8a38c..449b072 100644
[0067] ---a / f1
[0068] +++b / f1
[0069] @@-1,7,+1,7@@
[0070] -a
[0071] +b
[0072] It should be noted that the number of modules released each time for the application version is not necessarily the same, and the storage locations are not necessarily exactly the same. That is, the corresponding codes, the lines where the codes are located, etc. may all be different.
[0073] In addition, the modules in the historical versions and the current version need to be compared one by one, mainly based on their module names. Usually, the name of a functional module will not change.
[0074] 3) Before each application goes online, the code in the modules it contains has a certain correspondence with the methods, such as the module-business-code table. The business here refers to the execution method and represents the minimum granularity of operable execution.
[0075] After the code is determined, the corresponding business is determined according to the table, which means that this part of the method / business has been changed compared with the historical version.
[0076] For example, for the same application, the "Free Shipping" module of 2018.08.09 corresponds to the "Free Shipping" module of 2018.08.10, and if code replacement, deletion, etc. are identified, it means that the function has been updated and needs to be monitored later; if it is found that the "Free Shipping" module does not exist in the historical module, it means that the "Free Shipping" module of 2018.08.10 is a new module and the free shipping function is a new function.
[0077] As an alternative to step 2), the number of lines to which the changed code belongs in the corresponding module can be determined, thereby determining the changed business:
[0078] 1) Use Java LineNumberReader to read the diff file and determine the line number corresponding to the changed code. Use the regular expression Pattern.compile("^+\\w+") to match a character pattern with the searched string and record the changed line number in memory, for example [1,3,6], which means that the code in the first, third, and sixth lines has changed;
[0079] 2) Use the tools package that comes with Java in JDK (Java Development Kit) to parse the number of changed code lines to analyze the starting and ending lines of the business in the modified file;
[0080] Specifically, the JavaCompiler class is used to compile the class of the specified path to obtain the compiled object; for example, the code written by the staff is translated into instructions recognizable by the computer, and the code SAfwseoirfuweorfj is translated into: I have an appointment for dinner at 11 o'clock today;
[0081] Use the JavaTask object to parse the compiled object to obtain the CompilationUnitTree object, and loop through the CompilationUnitTree to accumulate business / code according to the time change sequence, and find out which business has changed, as well as the starting and ending line numbers of the business.
[0082] The JavaTask here is an abstract tool, and the JavaCompiler uses the JavaTask to translate the code; for example, sending the changed line number 6 of the code to the JavaTask can find out which business the changed code corresponds to.
[0083] 3) Compare the line numbers of the code changes obtained in step 1) this time with the line numbers corresponding to the business obtained in step 2). Here, there can be a business-code-line number table to determine which business the code falls into. Since the business corresponds to the business, the business information changed in the current version compared with the historical version can be determined.
[0084] In addition, it should be noted that the business is located within the file, and a file is composed of different businesses inside. For example, the timed shutdown function:
[0085] The file generated by the function development: timed_shutdown.java
[0086] The businesses included in the file shutdown.java are:
[0087] Business 1 {Check whether the current system time is equal to the predetermined shutdown time};
[0088] Business 2 {Shutdown};
[0089] Business 3 {Call Business 1(), call Business 2()}.
[0090] After determining the changed business / businesses, the business / business information modified in the current version compared with the historical version can be uniformly sent to the enterprise monitoring platform to monitor the execution parameters of the business in the current version (for example, execution duration, whether the execution result is successful, etc.).
[0091] Currently, each enterprise basically has its own independent monitoring platform, and it is usually independent of the application system. For example, by adding AOP (Aspect Oriented Programming) annotations to the monitored business, the execution parameters of the business are monitored and recorded to analyze its operation efficiency.
[0092] When the monitoring platform detects an abnormality in the execution of a service, it can execute an alarm reminder. For example, record the time from the start to the end of a service operation. If the operation duration exceeds 30s, an alarm reminder will be issued to achieve control and management of new functions and new modules, and reduce the error probability of service operation.
[0093] However, some monitoring platforms do not have an alarm function. In this case, an alarm instruction needs to be generated and transmitted to the alarm for alarm reminder.
[0094] In the version management system, for the current application version, its identification information such as application name and version number usually needs to rely on staff to be set through the configuration of basic interface tools. For example:
[0095] 1) Application name: It is mainly entered when the application is first developed. There may be many enterprise internal systems. To avoid confusion in subsequent application management, it can be distinguished by using defined names, such as X Mall, X Logistics, X Warehouse WMS (Warehouse Management System) system, etc.;
[0096] 2) Modules included in the application and module names: Usually defined by the business side, product type, and product function to design the transformation of the APP and background code. For example, for the warehouse system, the modules it includes can be: remote service, web side, serial number management platform, task asynchronous processing platform, order receiving platform, order receiving message parsing platform, printing platform, centralized configuration management platform, inventory service platform.
[0097] 3) Git access addresses of the code repositories for each module: Can be obtained through git-local (i.e., local git repository, client),
[0098] 4) Git username and password that can access the code repository, and test through the JGIT third-party jar package to verify whether the application function can be normally connected and used; for example, when logging in to a bank website, verify whether the entered username and password are correct. When the test result is correct / feasible / can be connected, it means the test passes and the service can be provided normally.
[0099] Before the application goes live, it is necessary to agree on its version number for easy recording and subsequent rollback. For example, if there is a problem with the application version launched on 2018 / 07 / 09, the entire set will be rolled back to the version before going live.
[0100] The specific implementation process is as follows:
[0101] 1) Select the application that has gone live;
[0102] 2) Select the corresponding modules for combination according to the content launched this time; for example, the X Mall v1.00 can purchase self-operated products, v1.02 can purchase products from third-party stores, v1.03 can use cash on delivery, and the 1.02 version requires 5,000 lines of code and 100 files to be developed compared to v1.00.
[0103] It can also be to input the corresponding code according to the changed business content, generate methods / files based on this code, package them into modules, and then combine, delete, add, or replace them with historical modules, which is specifically determined according to the launched content.
[0104] In addition, there are modules corresponding to the modified content. For example, for the flash sale module, if the X Mall needs to add this function, it can be directly combined with the original historical module.
[0105] For example, on August 9, 2018, the X Mall launched version v2.00, whose functions include performance improvement in the background and can support 100 million users. Such an upgrade only requires improving / adding background modules; on September 15, 2018, the launched version was v2.02, and this version added the function of "flash sale at 11 pm"; on September 20, 2018, the launched version was v2.04, and the function of "flash sale at 11 pm" was deleted.
[0106] 3) Use JGIT to obtain the module-branch list and determine the launched branch where the module is located;
[0107] It should be noted that a branch is a concept of code management in a computer, and each branch contains the transformation of different application content functions.
[0108] For example, different teams develop different new functions for the same application, and the functions are in different branches. Team A - white bar payment - branch A, Team B - free shipping - branch B. The functions, codes, etc. on different branches do not affect each other, reflecting the role of branch isolation.
[0109] But actually when going live, the cost of "free shipping" may be too high, so it is not launched temporarily, and there is a way to select the launched branch according to the actual situation. However, if it is chosen to launch both functions A and B together, branches A and B need to be selected.
[0110] 4) Use JGIT to obtain the commit records (commit ID) under the determined launched branch, select the commit ID for this version to go live, and perform marking record processing; usually, the commit records will be stored in wiki, excel, or word.
[0111] In this way, subsequently, the corresponding combination can be quickly found through the label. For example:
[0112] Label 1: Function A + Function B;
[0113] Label 2: Function A + Function B + Function C;
[0114] In code development, a label corresponds to a combination of modified files and can record the phased changes in version updates. When a problem occurs after the version is launched, the historical version can be found, rolled back, and launched again.
[0115] The method provided by the embodiments of the present invention can automatically identify the method names / business names involved in the modified Java code in the current version and the historical launched version, and automatically add alarm monitoring to the identified methods / businesses.
[0116] See Figure 2 , which shows a schematic diagram of the main modules of a device 200 for identifying business changes provided by the embodiments of the present invention, including:
[0117] A version determination module 201, configured to obtain the online timestamp of the current application version and determine the historical application version closest to the online timestamp;
[0118] A code identification module 202, configured to compare the code in the current application version and the historical application version and identify the changed code in the current application version;
[0119] A business determination module 203, configured to determine the changed business in the current application version according to the correspondence between the code and the business corresponding to the current application version; wherein, the business is the smallest granularity that can be operably executed in the current application version.
[0120] In the implementation device of the present invention, the code identification module 202 is configured to:
[0121] Obtain the modules in the current application version and determine the identification information of the modules; wherein, the identification information includes at least the name of the module;
[0122] According to the identification information, determine the historical module corresponding to the identification information in the historical application version, compare the code in the module and the historical module, and determine the changed code in the module; or
[0123] When there is no historical module corresponding to the identification information in the historical application version, determine all the code in the module as changed code.
[0124] The implementation device of the present invention further includes a business monitoring module 204 (not marked in the figure), configured to:
[0125] Transmit the service information of the changed service to the monitoring platform, and based on the service information, monitor the execution parameters of the changed service in the current application version; and
[0126] When receiving the alarm request transmitted by the monitoring platform, generate a corresponding alarm instruction and transmit it to the alarm platform for alarm operation.
[0127] The implementation device of the present invention further includes a marking record module 205 (not marked in the figure), which is used for:
[0128] Obtain the modules in the current application version, and determine the online branch where the module is located according to the module branch list corresponding to the application version;
[0129] Extract the commit records corresponding to the current application version in the determined online branch, combine the obtained commit records and mark them.
[0130] In addition, the specific implementation content of the service change identification device described in the embodiments of the present invention has been described in detail in the above-described service change identification method, so the repeated content will not be described here.
[0131] The device provided by the embodiments of the present invention can automatically identify the method names / business names involved in the modified Java code in the current version and the historical online version, and automatically add alarm monitoring to the identified methods / businesses.
[0132] Figure 3 An exemplary system architecture 300 to which the service change identification method or the service change identification device of the embodiments of the present invention can be applied is shown.
[0133] As Figure 3 shown, the system architecture 300 may include terminal devices 301, 302, 303, a network 304, and a server 305 (merely examples). The network 304 is used to provide a medium for communication links between the terminal devices 301, 302, 303 and the server 305. The network 304 may include various connection types, such as wired, wireless communication links, or fiber optic cables, etc.
[0134] Users can use the terminal devices 301, 302, 303 to interact with the server 305 through the network 304 to receive or send messages, etc. Various communication client applications may be installed on the terminal devices 301, 302, 303, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (merely examples).
[0135] The terminal devices 301, 302, and 303 can be various electronic devices with a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and so on.
[0136] The server 305 can be a server that provides various services. For example, it can be a background management server (only for example) that supports the shopping websites browsed by users using the terminal devices 301, 302, and 303. The background management server can analyze and process data such as product information query requests received, and feedback the processing results (such as target push information, product information - only for example) to the terminal devices.
[0137] It should be noted that the method for identifying service changes provided by the embodiments of the present invention is generally executed by the server 305. Correspondingly, the device for identifying service changes is generally arranged in the server 305.
[0138] It should be understood that Figure 3 the numbers of the terminal devices, the network, and the server in
[0139] are merely illustrative. According to the implementation requirements, there can be any number of terminal devices, networks, and servers. Figure 4 shown in Figure 4 is only an example of the terminal device and should not impose any limitations on the functions and usage scope of the embodiments of the present invention.
[0140] As Figure 4 shown, the computer system 400 includes a central processing unit (CPU) 401, which can execute various appropriate actions and processes according to the program stored in the read-only memory (ROM) 402 or the program loaded from the storage section 408 into the random access memory (RAM) 403. In the RAM 403, various programs and data required for the operation of the system 400 are also stored. The CPU 401, the ROM 402, and the RAM 403 are connected to each other through a bus 404. The input / output (I / O) interface 405 is also connected to the bus 404.
[0141] The following components are connected to the I / O interface 405: an input section 406 including a keyboard, a mouse, etc.; an output section 407 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc. and a speaker, etc.; a storage section 408 including a hard disk, etc.; and a communication section 409 including a network interface card such as a LAN card, a modem, etc. The communication section 409 performs communication processing via a network such as the Internet. A drive 410 is also connected to the I / O interface 405 as required. A removable medium 411 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc. is mounted on the drive 410 as required so that a computer program read therefrom is installed into the storage section 408 as required.
[0142] Specifically, according to the embodiments disclosed by the present invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, the embodiments disclosed by the present invention include a computer program product which includes a computer program carried on a computer-readable medium, and the computer program includes program codes for performing the methods shown in the flowcharts. In such an embodiment, the computer program can be downloaded and installed from the network via the communication section 409, and / or installed from the removable medium 411. When the computer program is executed by a central processing unit (CPU) 401, the above-described functions defined in the system of the present invention are performed.
[0143] It should be noted that the computer-readable medium shown in the present invention can be a computer-readable signal medium, a computer-readable storage medium, or any combination of the two. A computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples of a computer-readable storage medium can 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 the present invention, a computer-readable storage medium can be any tangible medium that contains or stores a program, and this program can be used by or in conjunction with an instruction execution system, apparatus, or device. In the present invention, a computer-readable signal medium can include a data signal propagated in a baseband or as part of a carrier wave, which carries computer-readable program code. Such a propagated data signal can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium, and this computer-readable medium can send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on a computer-readable medium can be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0144] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architectures, functions, and operations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram can represent a module, a program segment, or a part of code, and the above module, program segment, or part of code contains one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks can occur in a different order than that marked in the accompanying drawings. For example, two consecutive blocks shown can actually be executed substantially in parallel, and they can sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and the combination of blocks in a block diagram or flowchart, can be implemented by a dedicated hardware-based system for performing the specified functions or operations, or can be implemented by a combination of dedicated hardware and computer instructions.
[0145] The modules involved in the embodiments of the present invention can be implemented in software or in hardware. The described modules can also be provided in a processor. For example, it can be described as: a processor includes a version determination module, a code identification module, and a service determination module. Among them, the names of these modules do not constitute a limitation to the module itself in some cases. For example, the code identification module can also be described as "a module for identifying changed codes".
[0146] As another aspect, the present invention further provides a computer-readable medium, which can be included in the device described in the above embodiments; or can exist alone without being assembled into the device. The above computer-readable medium carries one or more programs. When the above one or more programs are executed by a device, the device includes:
[0147] Obtain the online timestamp of the current application version, and determine the historical application version closest to the online timestamp;
[0148] Compare the codes in the current application version and the historical application version, and identify the changed codes in the current application version;
[0149] According to the correspondence between the code and the service corresponding to the current application version, determine the changed services in the current application version; where the service is the smallest granularity that the current application version can operate and execute.
[0150] According to the technical solution of the embodiments of the present invention, it is possible to automatically identify the method names / business names involved in the modified Java code in the current version and the historical online version, and automatically add alarm monitoring to the identified methods / businesses.
[0151] The above specific embodiments do not constitute a limitation to the protection scope of the present invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can occur depending on design requirements and other factors. Any modifications, equivalent replacements, and improvements made within the spirit and principle of the present invention shall be included within the protection scope of the present invention.
Claims
1. A method for identifying business changes, characterized in that, include: Obtain the online timestamp of the current application version, and determine the most recent historical application version adjacent to the online timestamp; Comparing the codes in the current application version and the historical application version, and identifying the changed codes in the current application version; According to the correspondence between the code and the business corresponding to the current application version, the changed business in the current application version is determined; wherein the business is the minimum granularity that the current application version can operate and execute; the process of determining the changed business includes: using a Java line number reader to read a diff file to determine the number of lines corresponding to the changed code in the corresponding module; using a toolkit provided by Java in JDK to parse the number of lines corresponding to the changed code to analyze the starting line number and the ending line number of the business in the modified file; comparing the number of lines corresponding to the changed code with the starting line number and the ending line number of the obtained business to determine the business to which the code falls; The method of using the toolkit provided by Java in JDK to parse the number of lines corresponding to the changed code to analyze the starting line number and the ending line number of the business in the modified file includes: Use the JavaCompiler class to compile the class in the specified path to obtain the compiled object; Use abstract tools to parse the compiled object to obtain a compilation unit tree object, loop the compilation unit tree object, accumulate services or codes according to the time change sequence, and obtain the changed services and the starting and ending line numbers of the services.
2. The method according to claim 1, wherein The comparing the codes in the current application version and the historical application version to identify the changed codes in the current application version includes: Obtain a module in the current application version, and determine identification information of the module; wherein the identification information at least includes a name of the module; Determine, according to the identification information, a historical module in the historical application version corresponding to the identification information, compare the module with the code in the historical module, and determine the changed code in the module; or When the historical module corresponding to the identification information does not exist in the historical application version, it is determined that all codes in the module are changed codes.
3. The method according to claim 1, wherein After determining the changed service in the current application version, the method further includes: Transmitting the business information of the changed business to a monitoring platform, so as to monitor the execution parameters of the changed business in the current application version based on the business information; and When an alarm request transmitted by the monitoring platform is received, a corresponding alarm instruction is generated and transmitted to the alarm platform for alarm operation.
4. The method according to claim 1, wherein Also includes: Obtain a module in the current application version, and determine the online branch where the module is located according to a module branch list corresponding to the application version; Extract the submission record corresponding to the current application version in the determined online branch, combine the obtained submission records and mark them.
5. An apparatus for identifying service changes, characterized in that, include: A version determination module, used to obtain the online timestamp of the current application version, and determine the most recent historical application version adjacent to the online timestamp; A code identification module, used to compare the codes in the current application version and the historical application version, and identify the changed codes in the current application version; A business determination module is used to determine the changed business in the current application version according to the corresponding relationship between the code corresponding to the current application version and the business; wherein the business is the minimum granularity that the current application version can operate and execute; the process of determining the changed business includes: using a Java line number reader to read a diff file to determine the number of lines corresponding to the changed code in the corresponding module; using a toolkit provided by Java in JDK to parse the number of lines corresponding to the changed code to analyze the starting number of lines and the ending number of lines of the business in the modified file; comparing the number of lines corresponding to the changed code with the starting number of lines and the ending number of lines of the obtained business to determine the business to which the code falls; The method of using the toolkit provided by Java in JDK to parse the number of lines corresponding to the changed code to analyze the starting line number and the ending line number of the business in the modified file includes: Use the JavaCompiler class to compile the class in the specified path to obtain the compiled object; Use abstract tools to parse the compiled object to obtain a compilation unit tree object, loop the compilation unit tree object, accumulate services or codes according to the time change sequence, and obtain the changed services and the starting and ending line numbers of the services.
6. The device according to claim 5, characterized in that, The code recognition module is used to: Obtain a module in the current application version, and determine identification information of the module; wherein the identification information at least includes a name of the module; Determine, according to the identification information, a historical module in the historical application version corresponding to the identification information, compare the module with the code in the historical module, and determine the changed code in the module; or When the historical module corresponding to the identification information does not exist in the historical application version, it is determined that all codes in the module are changed codes.
7. The device according to claim 5, characterized in that It also includes a business monitoring module for: Transmitting the business information of the changed business to a monitoring platform, so as to monitor the execution parameters of the changed business in the current application version based on the business information; as well as When an alarm request transmitted by the monitoring platform is received, a corresponding alarm instruction is generated and transmitted to the alarm platform for alarm operation.
8. The device according to claim 5, characterized in that, Also includes a marking record module for: Obtain a module in the current application version, and determine the online branch where the module is located according to a module branch list corresponding to the application version; Extract the submission record corresponding to the current application version in the determined online branch, combine the obtained submission records and mark them.
9. An electronic device, characterized in that, include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 4.
10. A computer-readable medium having a computer program stored thereon, characterized in that, When the program is executed by a processor, the method according to any one of claims 1 to 4 is implemented.
Citation Information
Patent Citations
Method for determining function point changing through code analysis
CN101286119A
Code processing method and device
CN107229487A