Measurement methods and apparatus for processing information, storage media and electronic devices

By adding target bytecode files to the business code of the business service and dynamically editing the metering function interface, the problem of the inability to decouple the business system and the metering function is solved, the business system is decoupled, upgrade costs are reduced, and the application efficiency of the metering function is improved.

CN117170758BActive Publication Date: 2026-11-17QINGDAO HAIER TECH +1
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210582238.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-26
Publication Date
2026-11-17
Estimated Expiration
2042-05-26

AI Technical Summary

Technical Problem

In existing technologies, business systems and metering functions cannot be effectively decoupled, resulting in high upgrade costs for business systems and the intrusion of metering functions into business systems, affecting their normal operation.

Method used

By adding target bytecode files to the business code of the business service, the metering function interface can be dynamically edited, thereby decoupling the business system from the metering function. The metering function module can be added to the business service using JVM bytecode dynamic editing technology, avoiding the need to modify the business system.

Benefits of technology

This decouples the business system from the metering function, reduces the upgrade cost of the business system, improves the application efficiency of the metering function, and avoids the dependence on the transformation and iteration of the business system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117170758B_ABST
    Figure CN117170758B_ABST
Patent Text Reader

Abstract

This application discloses a method, apparatus, storage medium, and electronic device for measuring information processing, relating to the field of smart home technology. The method includes: adding a target bytecode file to the business code corresponding to a business service, wherein the target bytecode file is used to add functional interfaces to the business service; determining the loading result of the target bytecode file in the business code; and, if the loading result indicates that the target bytecode file has been successfully loaded and that the target bytecode file already contains functional bytecode with metering capabilities, measuring the processing information generated by the business service using the target bytecode file to obtain a metering result for the processing information, wherein the processing information is the process information corresponding to data requests sent by devices related to the business service. This method can solve the problem in the prior art where the business system and metering function cannot be effectively decoupled when statistical requests are made.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of smart homes, and more specifically, to a measurement method and apparatus for processing information, a storage medium, and an electronic device. Background Technology

[0002] Currently, related technologies rely on business systems for metering different requests. Common methods include: 1. Deploying a gateway to intercept requests and perform metering; the metering function depends on the gateway. 2. Relying on business modules; metering functionality needs to be added iteratively. Therefore, accurate metering of requests requires support from the business system, either through project deployment or by adding metering support to a business system module. Consequently, metering functionality inevitably intrudes into the business system to some extent. It's impossible to decouple the business system and metering functionality, creating a dependency between them. This coupling necessitates upgrades and modifications to the business system, incurring significant costs and requiring substantial development effort from technical personnel.

[0003] There is still no effective solution to the problem that related technologies cannot effectively decouple the business system and the metering function when making statistical requests. Summary of the Invention

[0004] This invention provides a metering method and apparatus for processing information, a storage medium and an electronic device, to at least solve the problem in related technologies that it is impossible to effectively decouple the business system and the metering function when making statistical requests.

[0005] According to an embodiment of the present invention, a method for measuring processing information is provided, comprising: adding a target bytecode file to business code corresponding to a business service, wherein the target bytecode file is used to add a functional interface to the business service; determining the loading result of the target bytecode file in the business code; and, when the loading result indicates that the target bytecode file has been loaded and the target bytecode file has functional bytecode with measuring function, measuring the processing information generated by the business service through the target bytecode file to obtain a measuring result of the processing information, wherein the processing information is process information corresponding to the data request sent by the business service in processing the data request sent by the device associated with the business service.

[0006] In an exemplary embodiment, after the loading result indicates that the target bytecode file has been loaded, the method further includes: receiving a function instruction input by the target object, wherein the function instruction is used to dynamically edit the bytecode in the target bytecode file and add function bytecode corresponding to different measurement functions in the target bytecode, so that the target bytecode file has measurement functions; adding a function description to the function instruction, wherein the function description is used to annotate the function bytecode in the target bytecode file.

[0007] In an exemplary embodiment, before adding the target bytecode file to the business code corresponding to the business service, the method further includes: determining the data type generated by the business service when processing a data request sent by a device associated with the business service; if the data type matches a preset data type, determining that the business service supports information measurement, and allowing the target bytecode file to be loaded in the business service; if the data type does not match the preset data type, determining that the business service does not support information measurement, and prohibiting the loading of the target bytecode file in the business service.

[0008] In an exemplary embodiment, when the loading result indicates that the target bytecode file has been successfully loaded and the target bytecode file contains functional bytecode with metering capabilities, the processing information generated by the business service is metered through the target bytecode file to obtain a metering result for the processing information. This includes: determining the metering type corresponding to the functional bytecode in the target bytecode file, wherein the metering type includes at least one of the following: metering device information corresponding to the device that sends a data request to the business service, metering the number of times the same device sends a data request to the business service, and metering the processing result of the business service for the data request; determining the metering timing of the target bytecode in the business service based on the metering type, wherein the metering timing includes at least one of the following: metering before the business service runs the corresponding business code to process the data request and generates a processing result, and metering after the business service runs the corresponding business code to process the data request and generates a processing result; and instructing the target bytecode file to extract data from the processing information generated by the business service based on the metering timing and the metering type to obtain a metering result.

[0009] In an exemplary embodiment, after measuring the processing information generated by the business service through the target bytecode file and obtaining the measurement result of the processing information, the above method further includes: matching the data request in the measurement result with the processing result of the business service corresponding to the data request to obtain a target matching value; if the target matching value is less than a preset threshold, determining that the business service needs to improve its business code, and sending a prompt to the target object that the business service needs to be upgraded.

[0010] In an exemplary embodiment, after adding the target bytecode file to the business code corresponding to the business service, the method further includes: performing a startup test on the target bytecode file, wherein the startup test is used to determine whether the processing result corresponding to the business service can be obtained when the target bytecode file is decoupled from the business code; and if the startup test fails, sending a prompt message to the target object, wherein the prompt message carries a reference reason for the failure of the target bytecode file test and an exception code.

[0011] In an exemplary embodiment, after sending a prompt message to the target object in the event that the startup test fails, the method further includes: obtaining the target object's feedback result to the prompt message, wherein the feedback result carries a verification bytecode file corresponding to the target bytecode file after re-verification by the target object; and re-adding the verification bytecode file to the business code based on the feedback result to perform the startup test.

[0012] According to another embodiment of the present invention, a metering device for processing information is provided, comprising: an adding module for adding a target bytecode file to business code corresponding to a business service, wherein the target bytecode file is used to add a functional interface to the business service; a determining module for determining the loading result of the target bytecode file in the business code; and a metering module for metering the processing information generated by the business service through the target bytecode file when the loading result indicates that the target bytecode file has been loaded and the target bytecode file already has functional bytecode with metering function, thereby obtaining a metering result of the processing information, wherein the processing information is process information corresponding to data requests sent by devices associated with the business service.

[0013] In an exemplary embodiment, the above-mentioned metering module further includes: an instruction unit, configured to receive a function instruction input by a target object, wherein the function instruction is configured to dynamically edit the bytecode in the target bytecode file and add function bytecode corresponding to different metering functions to the target bytecode, so that the target bytecode file has metering functions; and to add a function description to the function instruction, wherein the function description is configured to annotate the function bytecode in the target bytecode file.

[0014] In one exemplary embodiment, the apparatus further includes: a type module, configured to determine the data type generated by the service when processing a data request sent by a device associated with the service; if the data type matches a preset data type, determine that the service supports information measurement and allow the target bytecode file to be loaded in the service; if the data type does not match the preset data type, determine that the service does not support information measurement and prohibit the loading of the target bytecode file in the service.

[0015] In an exemplary embodiment, the metering module is further configured to determine the metering type corresponding to the functional bytecode in the target bytecode file, wherein the metering type includes at least one of the following: metering device information corresponding to the device that sends a data request to the business service, metering the number of times the same device sends a data request to the business service, and metering the processing result of the business service for the data request; determining the metering timing of the target bytecode in the business service according to the metering type, wherein the metering timing includes at least one of the following: metering before the business service runs the corresponding business code to process the data request and generates a processing result, and metering after the business service runs the corresponding business code to process the data request and generates a processing result; instructing the target bytecode file to extract data from the processing information generated by the business service based on the metering timing and the metering type to obtain a metering result.

[0016] In an exemplary embodiment, the above apparatus further includes: a prompting module, configured to match the data request in the measurement result with the processing result of the business service corresponding to the data request to obtain a target matching value; if the target matching value is less than a preset threshold, determine that the business service needs to improve its business code, and send a prompt to the target object that the business service needs to be upgraded.

[0017] In an exemplary embodiment, the above apparatus further includes: a testing module, configured to perform a startup test on the target bytecode file, wherein the startup test is configured to determine whether the processing result corresponding to the business service can be obtained when the target bytecode file is decoupled from the business code; and in the event that the startup test fails, sending a prompt message to the target object, wherein the prompt message carries a reference reason for the failure of the target bytecode file test and an exception code.

[0018] In an exemplary embodiment, the above-mentioned test module further includes a feedback unit, used to obtain the feedback result of the target object to the prompt information, wherein the feedback result carries a verification bytecode file corresponding to the target bytecode file after re-verification of the target object; and to re-add the verification bytecode file to the business code according to the feedback result to start the test.

[0019] According to yet another embodiment of the present invention, a storage medium is also provided, wherein a computer program is stored therein, wherein the computer program is configured to execute the steps in any of the above method embodiments when running.

[0020] According to yet another embodiment of the present invention, an electronic device is also provided, including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the steps in any of the above method embodiments.

[0021] This invention adds a target bytecode file to the business code corresponding to a business service. The target bytecode file is used to add functional interfaces to the business service. The loading result of the target bytecode file in the business code is determined. If the loading result indicates that the target bytecode file has been successfully loaded and contains metering bytecode, the processing information generated by the business service is metered using the target bytecode file to obtain the metering result. The processing information is the process information corresponding to data requests sent by devices associated with the business service. In other words, by adding a dynamically editable target bytecode file to the business code corresponding to the business service, and then adding metering bytecode to the target bytecode file, the metering bytecode file is used to perform metering and statistics on data requests sent by associated devices and the corresponding processing information. This decoupling of the metering function from the corresponding business code is achieved through the target bytecode file. Therefore, it solves the problem in existing technologies where the business system and metering function cannot be effectively decoupled when statistically analyzing requests, avoids coupling between the business service and the metering function, reduces the upgrade cost of the business service, and improves the application efficiency of the metering function. Attached Figure Description

[0022] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0023] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0024] Figure 1 This is a schematic diagram of the hardware environment for a metering method for processing information according to an embodiment of this application.

[0025] Figure 2 This is a flowchart of a measurement method for processing information according to an embodiment of the present invention;

[0026] Figure 3 This is a schematic diagram of a gateway-dependent metering method in related technologies;

[0027] Figure 4 This is a schematic diagram illustrating the metering methods that rely on the business modules themselves in related technologies;

[0028] Figure 5 This is a schematic diagram of a metering method based on dynamic JVM bytecode editing according to an optional embodiment of the present invention;

[0029] Figure 6 This is a structural block diagram of a metering device for processing information according to an embodiment of the present invention. Detailed Implementation

[0030] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.

[0031] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0032] According to one aspect of the embodiments of this application, a method for measuring processed information is provided. This method for measuring processed information is widely applicable to whole-house intelligent digital control application scenarios such as smart homes, smart home ecosystems, and intelligencehouse ecosystems. Optionally, in this embodiment, the above-mentioned method for measuring processed information can be applied to, for example... Figure 1 The hardware environment shown consists of terminal device 102 and server 104. For example... Figure 1 As shown, server 104 is connected to terminal device 102 via a network and can be used to provide services (such as application services) to the terminal or clients installed on the terminal. A database can be set up on the server or independently of the server to provide data storage services for server 104. Cloud computing and / or edge computing services can be configured on the server or independently of the server to provide data processing services for server 104.

[0033] The aforementioned network may include, but is not limited to, at least one of the following: wired network, wireless network. The aforementioned wired network may include, but is not limited to, at least one of the following: wide area network, metropolitan area network, local area network. The aforementioned wireless network may include, but is not limited to, at least one of the following: Wi-Fi (Wireless Fidelity), Bluetooth. The terminal device 102 may not be limited to PC, mobile phone, tablet computer, smart air conditioner, smart range hood, smart refrigerator, smart oven, smart stove, smart washing machine, smart water heater, smart washing equipment, smart dishwasher, smart projector, smart TV, smart clothes rack, smart curtains, smart audio-visual equipment, smart socket, smart speaker, smart speaker box, smart fresh air equipment, smart kitchen and bathroom equipment, smart bathroom equipment, smart robot vacuum cleaner, smart window cleaning robot, smart mopping robot, smart air purifier, smart steam oven, smart microwave oven, smart water heater, smart air purifier, smart water dispenser, smart door lock, etc.

[0034] This embodiment provides a measurement method for processing information. Figure 2 This is a flowchart of a measurement method for processing information according to an embodiment of the present invention, the process including the following steps:

[0035] Step S202: Add the target bytecode file to the business code corresponding to the business service, wherein the target bytecode file is used to add functional interfaces to the business service;

[0036] It should be noted that the target bytecode file mentioned above can be a JVM (Java Virtual Machine) bytecode dynamic editor file (i.e., a probe). By adding this target bytecode file to the code corresponding to the business service, a metering function module can be built in the business code, so that the business service and the metering function are completely decoupled, and the addition of the metering function does not affect the normal operation of the business code corresponding to the business service.

[0037] Step S204: Determine the loading result of the target bytecode file in the business code;

[0038] Understandably, the above loading result is used to indicate whether the target bytecode file has been successfully loaded in the business service, so as to determine whether the metering function corresponding to the target bytecode file can be enabled normally; for example, when the loading result indicates that the target bytecode file failed to load, the corresponding metering function will not be able to be performed in the business service.

[0039] Step S206: If the loading result indicates that the target bytecode file has been loaded and the target bytecode file contains functional bytecode with metering function, the processing information generated by the business service is metered through the target bytecode file to obtain the metering result of the processing information. The processing information is the process information corresponding to the data request sent by the device that is related to the business service. Optionally, the processing information includes: the data request and the processing result of the business service corresponding to the data request.

[0040] Through the above steps, the target bytecode file is added to the business code corresponding to the business service. The target bytecode file is used to add functional interfaces to the business service. The loading result of the target bytecode file in the business code is determined. If the loading result indicates that the target bytecode file has been successfully loaded and contains metering bytecode, the processing information generated by the business service is metered using the target bytecode file to obtain the metering result. The processing information is the process information corresponding to data requests sent by devices related to the business service. In other words, by adding a dynamically editable target bytecode file to the business code corresponding to the business service, and then adding metering bytecode to the target bytecode file, the metering bytecode file is used to meter and statistically analyze the data requests sent by the associated devices and the corresponding processing information of the business service. This decoupling of the metering function from the corresponding business code is achieved through the target bytecode file. Therefore, it solves the problem in existing technologies where it is impossible to effectively decouple the business system and metering function when statistically analyzing requests, avoids coupling between the business service and the metering function, reduces the upgrade cost of the business service, and improves the application efficiency of the metering function.

[0041] In an exemplary embodiment, after the loading result indicates that the target bytecode file has been loaded, the method further includes: receiving a function instruction input by the target object, wherein the function instruction is used to dynamically edit the bytecode in the target bytecode file and add function bytecode corresponding to different measurement functions in the target bytecode, so that the target bytecode file has measurement functions; adding a function description to the function instruction, wherein the function description is used to annotate the function bytecode in the target bytecode file.

[0042] In other words, after the target bytecode file is loaded into the business code of the corresponding business service, it is also necessary to add functional bytecode corresponding to different metering functions to the target bytecode file so that the target bytecode file in the business code has the corresponding metering functions. For example, after the JVM program starts, according to the original startup instruction java xxx, the probe (equivalent to the target bytecode file) is used. Specifically, -javaagent:probe.jar is added to the corresponding instruction, that is, the startup instruction is transformed into java -javaagent:probe.jar xxx, and then the bytecode can be dynamically edited in the business code to add metering functions.

[0043] In an exemplary embodiment, before adding the target bytecode file to the business code corresponding to the business service, the method further includes: determining the data type generated by the business service when processing a data request sent by a device associated with the business service; if the data type matches a preset data type, determining that the business service supports information measurement, and allowing the target bytecode file to be loaded in the business service; if the data type does not match the preset data type, determining that the business service does not support information measurement, and prohibiting the loading of the target bytecode file in the business service.

[0044] Understandably, to ensure the smooth addition of the target bytecode file to the corresponding business service and the accuracy of subsequent metering, the data type generated by the business service processing data requests is confirmed. If the data type belongs to a preset data type that supports metering functions through the target bytecode file, it is determined that the current business service is allowed to perform metering. Otherwise, it means that the current business service is not allowed to perform metering, and there is no need to add the target bytecode file to the corresponding business code. This increases the accuracy and effectiveness of metering through the target bytecode file, and the normal functioning of the business service is not affected by the target bytecode file. This effectively decouples the business system and the metering function, so that the business services in the business system do not need to consider the impact of the metering function when upgrading.

[0045] In an exemplary embodiment, when the loading result indicates that the target bytecode file has been successfully loaded and the target bytecode file contains functional bytecode with metering capabilities, the processing information generated by the business service is metered through the target bytecode file to obtain a metering result for the processing information. This includes: determining the metering type corresponding to the functional bytecode in the target bytecode file, wherein the metering type includes at least one of the following: metering device information corresponding to the device that sends a data request to the business service, metering the number of times the same device sends a data request to the business service, and metering the processing result of the business service for the data request; determining the metering timing of the target bytecode in the business service based on the metering type, wherein the metering timing includes at least one of the following: metering before the business service runs the corresponding business code to process the data request and generates a processing result, and metering after the business service runs the corresponding business code to process the data request and generates a processing result; and instructing the target bytecode file to extract data from the processing information generated by the business service based on the metering timing and the metering type to obtain a metering result.

[0046] In simple terms, when executing the corresponding metering function through the target bytecode file, the metering type corresponding to the dynamically edited function bytecode in the target bytecode file can be determined, as well as the information to be statistically analyzed and the timing of the metering function execution can be determined. This makes the metering results obtained through the target bytecode file more closely match the metering requirements and facilitates the subsequent use of the data corresponding to the metering results.

[0047] For example, an IoT service (equivalent to the aforementioned business service) facilitates data integration with various smart devices. These devices report data to the IoT service via the internet according to protocols. When it's necessary to count the number of times each device reports data daily, a probe approach is used: probe-related parameters are added when the service starts. The probe (equivalent to the aforementioned target bytecode file) program is automatically injected into the service, modifying the running service code and adding metering logic (other logic is also possible). When a request (equivalent to the aforementioned data request) arrives, the request is executed according to the modified logic, analyzing the devices in the request, completing the count, and then reporting the data. Therefore, applications using the metering function do not need to iterate on the corresponding project architecture of the business system.

[0048] In an exemplary embodiment, after measuring the processing information generated by the business service through the target bytecode file and obtaining the measurement result of the processing information, the above method further includes: matching the data request in the measurement result with the processing result of the business service corresponding to the data request to obtain a target matching value; if the target matching value is less than a preset threshold, determining that the business service needs to improve its business code, and sending a prompt to the target object that the business service needs to be upgraded.

[0049] In order to reflect the stability of business services through measurement results, the efficiency of business services in processing corresponding data requests is determined by matching the information in the measurement results. When the determined target matching value is less than a preset threshold, it indicates that the efficiency of business services in processing data requests is low, and business services need to be updated in a timely manner.

[0050] In an exemplary embodiment, after adding the target bytecode file to the business code corresponding to the business service, the method further includes: performing a startup test on the target bytecode file, wherein the startup test is used to determine whether the processing result corresponding to the business service can be obtained when the target bytecode file is decoupled from the business code; and if the startup test fails, sending a prompt message to the target object, wherein the prompt message carries a reference reason for the failure of the target bytecode file test and an exception code.

[0051] In an exemplary embodiment, after sending a prompt message to the target object in the event that the startup test fails, the method further includes: obtaining the target object's feedback result to the prompt message, wherein the feedback result carries a verification bytecode file corresponding to the target bytecode file after re-verification by the target object; and re-adding the verification bytecode file to the business code based on the feedback result to perform the startup test.

[0052] To better understand the process of the above-mentioned information processing measurement method, the following describes the flow of the above-mentioned information processing measurement method in conjunction with several optional embodiments.

[0053] To better understand this application, a brief description of the relevant technologies will be provided first.

[0054] The requested metrology-related technologies are handled in the following ways:

[0055] Method 1: Deploy a gateway to intercept requests and perform metering. The metering function depends on the gateway. Figure 3 This is a schematic diagram of a gateway-dependent metering method in related technologies;

[0056] Method 2: Relies on business modules; metering functionality needs to be added through iterations of business modules. Figure 4 This is a schematic diagram illustrating the metering methods that rely on the business modules themselves in related technologies;

[0057] As can be seen from the above methods, accurate measurement of requests requires the business system to support the measurement function, that is, the business system deployment method supports the measurement function or the business system module supports the measurement function. Therefore, the measurement function will more or less intrude into the business system, which will cause the business system and the measurement function to be coupled, and the business system needs to be upgraded and transformed before it can be implemented, which has a certain cost.

[0058] Therefore, as an optional implementation, a request metering method based on JVM bytecode dynamic editing technology is proposed. Aiming to decouple the business system and metering function, this method uses JVM bytecode dynamic editing technology (probe) to add request metering functionality to the JVM program; it is independent of project deployment methods and business modules. This achieves decoupling of the metering function and the business system. In other words, the program logic can be dynamically modified using JVM bytecode dynamic editing technology (probe) to add metering functionality, thus eliminating the need for modifications to the business system and achieving decoupling.

[0059] Optional, Figure 5This is a schematic diagram of a metering method based on JVM bytecode dynamic editing technology according to an optional embodiment of the present invention. By applying JVM bytecode dynamic editing (probe), the module logic in the business system is modified so that it can support the metering function without being noticed, and no changes are required to the business module. This completely decouples the business system from the metering function, and there is no iterative interference between them.

[0060] For example, when a JVM program starts, the original startup command is `java xxx`. After using a probe, `-javaagent:probe.jar` is added to the corresponding command, transforming the original startup command into `java -javaagent:probe.jar xxx`. Furthermore, by adding the above command, the probe dynamically edits the bytecode, thus adding metering functionality, as shown in Table 1 below.

[0061] Table 1

[0062]

[0063] In practical applications, for example, an IoT service (equivalent to the aforementioned business service) facilitates data exchange between various smart devices. These devices report data to the IoT service via the internet according to protocols. When it's necessary to count the number of times each device reports data daily, a probe approach is used: probe-related parameters are added when the service starts. The probe (equivalent to the aforementioned target bytecode file) program is automatically injected into the service, modifying the running service code and adding metering logic (other logic is also possible). When a request (equivalent to the aforementioned data request) arrives, the request is executed according to the modified logic, analyzing the devices in the request, completing the count, and then reporting the data. Therefore, applications using the metering function do not need to iterate on the corresponding project architecture of the business system.

[0064] In summary, the above design utilizes JVM bytecode editing technology to add request metering logic to the business system. By employing JVM dynamic bytecode editing technology, the business system and request metering functionality are decoupled. Request metering capabilities are added to the business module seamlessly without requiring modifications to the business system, achieving decoupling, simplifying code interfaces, and reducing later maintenance costs.

[0065] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the measurement of information processing described in the various embodiments of the present invention.

[0066] This embodiment also provides a metering device for processing information, which is used to implement the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can refer to a combination of software and / or hardware that implements a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.

[0067] Figure 6 This is a structural block diagram of a metering device for processing information according to an embodiment of the present invention, such as... Figure 6 As shown, the device includes:

[0068] (1) Add module 62, used to add target bytecode file to business code corresponding to business service, wherein the target bytecode file is used to add functional interface to business service;

[0069] (2) Determining module 64, used to determine the loading result of the target bytecode file in the business code;

[0070] (3) Metering module 66, used to measure the processing information generated by the business service through the target bytecode file when the loading result indicates that the target bytecode file has been loaded and the target bytecode file has functional bytecode with metering function, and obtain the metering result of the processing information, wherein the processing information is the process information corresponding to the data request sent by the device that is related to the business service.

[0071] Using the aforementioned apparatus, a target bytecode file is added to the business code corresponding to the business service. This target bytecode file is used to add functional interfaces to the business service. The loading result of the target bytecode file in the business code is determined. If the loading result indicates that the target bytecode file has been successfully loaded and contains metering bytecode, the processing information generated by the business service is metered using the target bytecode file to obtain the metering result. The processing information is the process information corresponding to data requests sent by devices related to the business service. In other words, by adding a dynamically editable target bytecode file to the business code corresponding to the business service, and then adding metering bytecode to the target bytecode file, the metering bytecode file is used to meter and statistically analyze the data requests sent by the associated devices and the corresponding processing information. This decoupling of the metering function from the corresponding business code is achieved through the target bytecode file. Therefore, it solves the problem in existing technologies where the business system and metering function cannot be effectively decoupled when statistically analyzing requests, avoids coupling between the business service and the metering function, reduces the upgrade cost of the business service, and improves the application efficiency of the metering function.

[0072] In an exemplary embodiment, the above-mentioned metering module further includes: an instruction unit, configured to receive a function instruction input by a target object, wherein the function instruction is configured to dynamically edit the bytecode in the target bytecode file and add function bytecode corresponding to different metering functions to the target bytecode, so that the target bytecode file has metering functions; and to add a function description to the function instruction, wherein the function description is configured to annotate the function bytecode in the target bytecode file.

[0073] In one exemplary embodiment, the apparatus further includes: a type module, configured to determine the data type generated by the service when processing a data request sent by a device associated with the service; if the data type matches a preset data type, determine that the service supports information measurement and allow the target bytecode file to be loaded in the service; if the data type does not match the preset data type, determine that the service does not support information measurement and prohibit the loading of the target bytecode file in the service.

[0074] In an exemplary embodiment, the metering module is further configured to determine the metering type corresponding to the functional bytecode in the target bytecode file, wherein the metering type includes at least one of the following: metering device information corresponding to the device that sends a data request to the business service, metering the number of times the same device sends a data request to the business service, and metering the processing result of the business service for the data request; determining the metering timing of the target bytecode in the business service according to the metering type, wherein the metering timing includes at least one of the following: metering before the business service runs the corresponding business code to process the data request and generates a processing result, and metering after the business service runs the corresponding business code to process the data request and generates a processing result; instructing the target bytecode file to extract data from the processing information generated by the business service based on the metering timing and the metering type to obtain a metering result.

[0075] In an exemplary embodiment, the above apparatus further includes: a prompting module, configured to match the data request in the measurement result with the processing result of the business service corresponding to the data request to obtain a target matching value; if the target matching value is less than a preset threshold, determine that the business service needs to improve its business code, and send a prompt to the target object that the business service needs to be upgraded.

[0076] In an exemplary embodiment, the above apparatus further includes: a testing module, configured to perform a startup test on the target bytecode file, wherein the startup test is configured to determine whether the processing result corresponding to the business service can be obtained when the target bytecode file is decoupled from the business code; and in the event that the startup test fails, sending a prompt message to the target object, wherein the prompt message carries a reference reason for the failure of the target bytecode file test and an exception code.

[0077] In an exemplary embodiment, the above-mentioned test module further includes a feedback unit, used to obtain the feedback result of the target object to the prompt information, wherein the feedback result carries a verification bytecode file corresponding to the target bytecode file after re-verification of the target object; and to re-add the verification bytecode file to the business code according to the feedback result to start the test.

[0078] In the description of this invention, it should be understood that the terms "center," "upper," "lower," "front," "rear," "left," and "right," etc., indicating orientation or positional relationships, are based on the orientation or positional relationships shown in the accompanying drawings and are only for the convenience of describing the invention and simplifying the description, and do not indicate or imply that the device or component referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of the invention. Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance.

[0079] In the description of this invention, it should be noted that, unless otherwise explicitly specified and limited, the terms "installation," "connection," and "linking" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal communication between two components. When a component is referred to as being "fixed to" or "set on" another element, it can be directly on the other component or there may be an intervening component. When a component is considered to be "connected" to another element, it can be directly connected to the other element or there may be an intervening component. Those skilled in the art can understand the specific meaning of the above terms in this invention based on the specific circumstances.

[0080] It should be noted that the above modules can be implemented by software or hardware. For the latter, they can be implemented in the following ways, but are not limited to: all the above modules are located in the same processor; or, the above modules are located in different processors in any combination.

[0081] Embodiments of the present invention also provide a storage medium storing a computer program, wherein the computer program is configured to execute the steps in any of the above method embodiments when running.

[0082] In one exemplary embodiment, the storage medium described above may be configured to store a computer program for performing the following steps:

[0083] S1, add the target bytecode file to the business code corresponding to the business service, wherein the target bytecode file is used to add functional interfaces to the business service;

[0084] S2, determine the loading result of the target bytecode file in the business code;

[0085] S3, if the loading result indicates that the target bytecode file has been loaded and the target bytecode file has functional bytecode with metering function, the processing information generated by the business service is metered through the target bytecode file to obtain the metering result of the processing information, wherein the processing information is the process information corresponding to the data request sent by the device that is related to the business service.

[0086] In one exemplary embodiment, the storage medium may include, but is not limited to, various media capable of storing computer programs, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard drive, magnetic disk, or optical disk.

[0087] Embodiments of the present invention also provide an electronic device including a memory and a processor, the memory storing a computer program and the processor being configured to run the computer program to perform the steps in any of the above method embodiments.

[0088] In one exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor and the input / output device is connected to the processor.

[0089] In one exemplary embodiment, the processor described above may be configured to perform the following steps via a computer program:

[0090] S1, add the target bytecode file to the business code corresponding to the business service, wherein the target bytecode file is used to add functional interfaces to the business service;

[0091] S2, determine the loading result of the target bytecode file in the business code;

[0092] S3, if the loading result indicates that the target bytecode file has been loaded and the target bytecode file has functional bytecode with metering function, the processing information generated by the business service is metered through the target bytecode file to obtain the metering result of the processing information, wherein the processing information is the process information corresponding to the data request sent by the device that is related to the business service.

[0093] In an exemplary embodiment, specific examples in this embodiment can refer to the examples described in the above embodiments and optional implementations, and will not be repeated here.

[0094] It will be apparent to those skilled in the art that the modules or steps of the present invention described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. In one exemplary embodiment, they can be implemented using computer-executable program code, thereby allowing them to be stored in a storage device for execution by a computing device. Furthermore, in some cases, the steps shown or described can be performed in a different order than those presented herein, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be implemented as a single integrated circuit module. Thus, the present invention is not limited to any particular hardware and software combination.

[0095] The above description is only a preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.

Claims

1. A measurement method for processing information, characterized in that, include: The target bytecode file is added to the business code corresponding to the business service, wherein the target bytecode file is used to add functional interfaces to the business service; Determine the loading result of the target bytecode file in the business code; When the loading result indicates that the target bytecode file has been loaded and the target bytecode file already contains functional bytecode with metering function, the processing information generated by the business service is metered through the target bytecode file to obtain the metering result of the processing information, wherein the processing information is the process information corresponding to the data request sent by the device that is related to the business service in processing; After the loading result indicates that the target bytecode file has been loaded, the following steps are performed: receiving a function instruction input by the target object, wherein the function instruction is used to dynamically edit the bytecode in the target bytecode file and add function bytecode corresponding to different metering functions to the target bytecode file so that the target bytecode file has metering functions; performing a startup test on the target bytecode file, wherein the startup test is used to determine whether the processing result corresponding to the business service can be obtained when the target bytecode file is decoupled from the business code.

2. The measurement method for processing information according to claim 1, characterized in that, After receiving the function instruction input by the target object, the method further includes: Add a function description to the function instruction, wherein the function description is used to comment out the function bytecode in the target character code file.

3. The measurement method for processing information according to claim 1, characterized in that, Before adding the target bytecode file to the business code corresponding to the business service, the method further includes: Determine the data type generated by the service when processing data requests sent by devices associated with the service; If the data type matches a preset data type, it is determined that the business service supports information measurement, and the target bytecode file is allowed to be loaded in the business service. If the data type does not match the preset data type, it is determined that the business service does not support information measurement, and loading the target bytecode file for the business service is prohibited.

4. The measurement method for processing information according to claim 1, characterized in that, If the loading result indicates that the target bytecode file has been successfully loaded, and the target bytecode file contains functional bytecode with metering capabilities, then the processing information generated by the business service is metered using the target bytecode file to obtain the metering result of the processing information, including: Determine the measurement type corresponding to the functional bytecode in the target bytecode file, wherein the measurement type includes at least one of the following: measuring the device information corresponding to the device that sends a data request to the service, measuring the number of times the same device sends a data request to the service, and measuring the processing result of the service for the data request: The metering timing of the target bytecode in the business service is determined according to the metering type, wherein the metering timing includes at least one of the following: metering before the business code corresponding to the business service executes processing on the data request and generates a processing result, and metering after the business code corresponding to the business service executes processing on the data request and generates a processing result; The target bytecode file is instructed to extract data from the processing information generated by the business service based on the metering timing and the metering type to obtain the metering result.

5. The method for processing information measurement according to claim 1, characterized in that, After measuring the processing information generated by the business service through the target bytecode file and obtaining the measurement result of the processing information, the method further includes: The data request in the measurement result and the processing result of the business service corresponding to the data request are matched to obtain the target matching value; If the target matching value is less than a preset threshold, it is determined that the business service needs to improve its business code, and a prompt is sent to the target object that the business service needs to be upgraded.

6. The measurement method for processing information according to claim 1, characterized in that, After performing a startup test on the target bytecode file, the method further includes: If the test fails to start, a prompt message is sent to the target object, which includes a reference reason for the failure of the target bytecode file test and the exception code.

7. The method for measuring information processing according to claim 6, characterized in that, In the event that the start test fails, after sending a notification message to the target object, the method further includes: Obtain the feedback result of the target object to the prompt information, wherein the feedback result carries the verification bytecode file corresponding to the target bytecode file after the target object has been re-verified; Based on the feedback results, the verification bytecode file is added back to the business code to start the test.

8. A measuring device for processing information, characterized in that, include: An add module is used to add a target bytecode file to the business code corresponding to the business service, wherein the target bytecode file is used to add a functional interface to the business service; The determination module is used to determine the loading result of the target bytecode file in the business code; The metering module is used to measure the processing information generated by the business service through the target bytecode file when the loading result indicates that the target bytecode file has been loaded and the target bytecode file has functional bytecode with metering function, and to obtain the metering result of the processing information, wherein the processing information is the process information corresponding to the data request sent by the business service in processing the data request sent by the device that is related to the business service; The aforementioned metering module is further configured to receive function instructions input by the target object, wherein the function instructions are used to dynamically edit the bytecode in the target bytecode file and add function bytecode corresponding to different metering functions to the target bytecode, so that the target bytecode file has metering functionality. The testing module is used to perform a startup test on the target bytecode file, wherein the startup test is used to determine whether the processing result corresponding to the business service can be obtained when the target bytecode file is decoupled from the business code.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored program, wherein the program, when executed, performs the method of any one of claims 1 to 7.

10. An electronic device comprising a memory and a processor, characterized in that, The memory stores a computer program, and the processor is configured to execute the method of any one of claims 1 to 7 through the computer program.

Citation Information

Patent Citations

  • Automatic index generation method and system based on byte codes

    CN113254317A