Data reporting method and device, equipment, storage medium and product
By matching the data attributes and network status of the application data, the data reporting strategy of the mobile terminal is determined, which solves the problem that the data reporting strategy in the existing technology does not have dynamic and network status recognition capabilities, and achieves efficient and stable in different network environments data reporting.
Patent Information
- Application Number
- CN202411516484.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-29
- Publication Date
- 2025-02-18
AI Technical Summary
In the prior art, the data reporting strategy does not have dynamic targeting of APP and users, and cannot accurately identify hidden weak network states, resulting in frequent data reporting affecting functional network requests of APP.
By obtaining application data and data attributes, matching the reporting policy in the pre-built policy library, and determining the reporting method based on the network status of the mobile terminal, and reporting the application data to the cloud server.
It realizes the dynamic issuance of targeted reporting strategies based on different APPs and users, and selects appropriate reporting methods based on network status, avoiding the impact of the APP function due to frequent data reporting when network resources are tight.
Smart Images

Figure CN119484236A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of this specification relate to the field of computer technology, and in particular to a data reporting method, device, equipment, storage medium and product. Background Art
[0002] With the rapid development of mobile Internet, the number of APPs (applications) used in mobile terminals continues to grow, and the demand for data collection is increasing. Common data includes APP performance data, exception data, user behavior data, and log data. How to efficiently and reliably report this data to the cloud server has become an important task that cannot be avoided in APP management.
[0003] The existing data reporting technology method is to build a reporting strategy into the local mobile application, which can control the data reporting behavior to a certain extent. However, this method has the same reporting strategy for all APP versions or user dynamics, and is not targeted at APP and user dynamics. In the prior art, there are solutions for setting different reporting strategies according to different network types, but the hidden weak network status cannot be accurately identified based on the network type alone. When network resources are tight, frequent data reporting will seriously affect the normal functional network requests of the APP. Therefore, there is an urgent need for a data reporting method that can solve the above technical problems. Summary of the invention
[0004] In response to the above-mentioned problems in the prior art, the purpose of the embodiments of this specification is to provide a data reporting method, device, equipment, storage medium and product to solve the problem that the reporting strategy in the prior art is not dynamically targeted at APPs and users, and the frequent data reporting due to the inability to accurately identify hidden weak network status causes the normal functional network requests of APP to be seriously affected.
[0005] In order to solve the above technical problems, the specific technical solutions of the embodiments of this specification are as follows:
[0006] On the one hand, an embodiment of this specification provides a data reporting method, which is applied to a mobile terminal and includes:
[0007] Acquire application data and data attributes collected by the application program, and store the application data in a local database of the mobile terminal;
[0008] According to the data attribute, a reporting policy of the application is matched from a pre-built policy library, wherein the policy library includes a mapping relationship between data attributes and reporting policies;
[0009] Get the network status of the mobile terminal;
[0010] Determining a reporting method corresponding to the network status of the mobile terminal in the reporting strategy of the application;
[0011] The application data in the local database is reported to the cloud server according to the determined reporting method.
[0012] Furthermore, the reporting strategy includes a whitelist strategy, a pre-configured strategy and a default strategy.
[0013] Furthermore, the data attributes include application identification, terminal device identification, user identification and data type;
[0014] The matching of the reporting strategy of the application from a pre-built strategy library according to the data attribute includes:
[0015] Determine whether the application identifier, terminal device identifier, and user identifier have a corresponding whitelist policy in the policy library;
[0016] If yes, the corresponding whitelist policy is used as the reporting policy of the application;
[0017] If not, determining whether there is a corresponding pre-configured policy for the data type in the policy library;
[0018] If yes, then using the corresponding pre-configured policy as the reporting policy of the application;
[0019] If not, the default policy is used as the reporting policy of the application.
[0020] Further, the obtaining of the network status of the mobile terminal includes:
[0021] Obtaining network parameters of the mobile terminal, wherein the network parameters include round-trip delay, network type, packet loss rate, and network delay;
[0022] The weight of each network parameter is determined by using the analytic hierarchy process;
[0023] The network parameters are weighted and summed using the weights of each network parameter to obtain the network environment threshold;
[0024] The network status of the mobile terminal is acquired according to the network environment threshold.
[0025] Furthermore, the method further comprises:
[0026] Matching a new reporting policy of each application from the policy library at a preset time interval;
[0027] Recording the effective period of the new reporting policy of the application, and storing the new reporting policy in the mobile terminal persistent cache policy library;
[0028] It is determined whether the hash value of the new reporting policy of the application is consistent with the hash value of the current reporting policy of the application; if not, the current reporting policy of the application is replaced with the new reporting policy of the application.
[0029] Furthermore, before reporting the application data in the local database to the background server according to the determined reporting method, the method further includes:
[0030] Get the effective period of the application's reporting policy;
[0031] Determining whether the reporting policy of the application is invalid according to the effective period of the reporting policy of the application;
[0032] If so, a new reporting strategy is reselected from the mobile terminal persistent cache strategy library according to the data attribute of the application data, and the effective time period of the new reporting strategy is recorded.
[0033] Furthermore, before reporting the application data to the background server according to the reporting method, the method further includes:
[0034] Determining whether the application data contains a terminal device identifier;
[0035] If yes, then calculating a first hash value of the terminal device identifier corresponding to the application data, and taking the modulus of the first hash value as the grayscale percentage;
[0036] If not, determining whether the application data contains a user identifier;
[0037] If yes, then calculating a second hash value of the user identifier corresponding to the application data, and taking the modulus of the second hash value as the grayscale percentage;
[0038] If not, a random generation function is called to generate a random number, and the random number is used as the grayscale percentage;
[0039] Whether the application data needs to be reported is determined according to the grayscale percentage and a preset grayscale percentage.
[0040] Furthermore, before reporting the application data to the background server according to the reporting method, the method further includes:
[0041] Calculating a signature value of the application data;
[0042] The signature value is added to the corresponding application data.
[0043] Furthermore, the method further comprises:
[0044] Determining whether the application data is reported successfully;
[0045] If yes, deleting the reported application data in the local database of the mobile terminal;
[0046] If not, wait for the next data reporting trigger opportunity and re-initiate data reporting to the cloud server.
[0047] On the other hand, an embodiment of the present specification provides a data reporting device, which is applied to a mobile terminal and includes:
[0048] A data acquisition module, used to acquire application data and data attributes collected by the application program, and store the application data in a local database of the mobile terminal;
[0049] A matching module, used to match the reporting strategy of the application program from a pre-built strategy library according to the data attribute, wherein the strategy library includes a mapping relationship between data attributes and reporting strategies;
[0050] A network status acquisition module, used to acquire the network status of the mobile terminal;
[0051] A determination module, used to determine a reporting method corresponding to the network status of the mobile terminal in the reporting strategy of the application program;
[0052] The reporting module is used to report the application data in the local database to the cloud server according to the determined reporting method.
[0053] On the other hand, an embodiment of the present specification further provides a computer device, including a memory, a processor, and a computer program stored in the memory, wherein when the computer program is executed by the processor, the instructions of any one of the above methods are executed.
[0054] On the other hand, an embodiment of the present specification further provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor of a computer device, the computer program executes instructions of any one of the above-described methods.
[0055] On the other hand, the embodiments of this specification further provide a computer program product, which, when executed by a processor of a computer device, executes instructions of any one of the above methods.
[0056] By adopting the above technical solution, the data reporting method provided in the embodiment of this specification can match the reporting strategy of the application program from the pre-built strategy library according to the data attributes of the application data, and determine the corresponding reporting method in the reporting strategy according to the network status of the mobile terminal, and report the application data to the cloud server according to the reporting method. Therefore, through this solution, different reporting strategies can be issued for different APPs, and the reporting method in the reporting strategy can be selected according to the network status of the mobile terminal, avoiding the problem that frequent data reporting affects the APP function when network resources are tight.
[0057] The above description is only an overview of the technical solutions of some embodiments of this specification. In order to more clearly understand the technical means of some embodiments of this specification, they can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the embodiments of this specification more obvious and easy to understand, the following specifically cites the preferred embodiments and describes them in detail in conjunction with the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0058] In order to more clearly illustrate the embodiments of this specification or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0059] Figure 1 A schematic diagram showing a flow chart of a data reporting method in some embodiments of this specification;
[0060] Figure 2 A schematic diagram of a process of matching the reporting strategy of the application from a pre-built strategy library according to the data attribute in some embodiments of this specification is shown;
[0061] Figure 3 A schematic diagram showing a process of obtaining the network status of a mobile terminal in some embodiments of this specification;
[0062] Figure 4 A schematic diagram of a process for reporting strategy timing updates in some embodiments of this specification is shown;
[0063] Figure 5 A schematic diagram of a process for determining whether a reporting strategy is invalid in some embodiments of this specification is shown;
[0064] Figure 6 A schematic diagram of a process for determining whether data is reported in grayscale in some embodiments of this specification is shown;
[0065] Figure 7A schematic diagram of the module structure of a data reporting device in some embodiments of this specification is shown;
[0066] Figure 8 A schematic diagram of the structure of a computer device in this specification is shown.
[0067] Description of the accompanying symbols:
[0068] 701, data acquisition module;
[0069] 702, matching module;
[0070] 703. Network status acquisition module;
[0071] 704. Determine module;
[0072] 705, reporting module;
[0073] 802. Computer equipment;
[0074] 804, processor;
[0075] 806. Memory;
[0076] 808, driving mechanism;
[0077] 810, input / output module;
[0078] 812. Input device;
[0079] 814. Output device;
[0080] 816. Presentation equipment;
[0081] 818. Graphical user interface;
[0082] 820, network interface;
[0083] 822, communication link;
[0084] 824. Communication bus. DETAILED DESCRIPTION
[0085] The following will be combined with the drawings in the embodiments of this specification to clearly and completely describe the technical solutions in the embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this specification, not all of the embodiments. Based on the embodiments in this specification, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this specification.
[0086] In order to solve the above problem, an embodiment of this specification provides a data reporting method. Figure 1It is a flowchart of a data reporting method provided by an embodiment of this specification. This specification provides method operation steps as described in the embodiment or flowchart, but may include more or fewer operation steps based on conventional or non-creative labor. The order of steps listed in the embodiment is only one way of executing the order of many steps and does not represent the only execution order. When the actual system or device product is executed, it can be executed in the order of the method shown in the embodiment or the accompanying drawings or in parallel.
[0087] It should be noted that the terms "first", "second", etc. in this specification and claims and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of this specification described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, device, product or equipment that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or equipment.
[0088] Reference Figure 1 As shown, an embodiment of this specification provides a data reporting method, which is applied to a mobile terminal and includes:
[0089] S101: Acquire application data and data attributes collected by the application program, and store the application data in a local database of the mobile terminal.
[0090] S102: Matching the reporting policy of the application from a pre-built policy library according to the data attribute, wherein the policy library includes a mapping relationship between data attributes and reporting policies.
[0091] S103: Acquire the network status of the mobile terminal.
[0092] S104: Determine a reporting method corresponding to the network status of the mobile terminal in the reporting strategy of the application.
[0093] S105: Report the application data in the local database to the cloud server according to the determined reporting method.
[0094] By adopting the above technical solution, the data reporting method provided in the embodiment of this specification can match the reporting strategy of the application program from the pre-built strategy library according to the data attributes of the application data, and determine the corresponding reporting method in the reporting strategy according to the network status of the mobile terminal, and report the application data to the cloud server according to the reporting method. Therefore, through this solution, different reporting strategies can be issued for different APPs, and the reporting method in the reporting strategy can be selected according to the network status of the mobile terminal, avoiding the problem that frequent data reporting affects the APP function when network resources are tight.
[0095] In step S101, the application refers to an application running on a mobile terminal and an H5 application running across terminals, wherein H5 is an application that supports the Web terminal and the mini-program terminal. The application data includes abnormal data, APP performance data, user behavior data, and log data, etc. The corresponding data attributes include application identification, terminal device identification, user identification, and data type. The various types of data collected by the application are transmitted to the mobile gateway, and the mobile gateway forwards the data reporting interface to the corresponding microservice processing. After the stream computing data is processed, the data is supplied to the data bus. The downstream data analysis system consumes the data of the data bus on demand, thereby performing multi-dimensional data mining. The application data is stored in the local database, so that in the case of abnormal network status, the application data can also be temporarily persisted in the local database. When the network status is detected to be normal, the data is continued to be reported to the cloud server, thereby realizing offline reporting of data and avoiding the problem of missing data reporting due to network abnormalities.
[0096] In some embodiments of the present specification, in step S102, the reporting policies in the policy library include whitelist policies, preconfigured policies, and default policies. In other embodiments, the reporting policies in the policy library also include SDK built-in policies, which are pre-set policies in the software development kit (SDK) and do not support custom modifications. This policy will only be enabled when there is an abnormality in the policy library, and can be regarded as a fallback policy in abnormal situations. Among the above four policies, the SDK built-in policy has the lowest priority, indicating that when other policies conflict with the SDK built-in policy, other policies will overwrite the SDK built-in policy. The default policy is a policy that the system or application automatically adopts without specific configuration or user intervention. The policy is usually designed to provide basic protection or functions and serves as the default behavior of the application. The priority of the default policy is higher than the SDK built-in policy, but lower than the preconfigured policy and whitelist policy. When a suitable policy cannot be matched from the policy library based on data attributes, the default policy will be enabled. Preconfigured policies are reporting policies that are preconfigured based on a certain application scenario or data type. For example, if an APP is going to hold a rights day event at 12 noon tomorrow, the reporting policy can be configured in advance to cope with high concurrent data during the event. Preconfigured policies can be obtained by combining multiple configuration parameters, such as policy effective time, network type, reporting frequency, reporting mode, grayscale control, sampling rate, data coloring and whitelist, etc. Through these policy configuration parameters, various types of data reporting policies can be combined and applied to various scenarios. The priority of preconfigured policies is higher than the default policy and SDK built-in policy, but lower than the whitelist policy. The whitelist policy is a security policy that allows only explicitly listed entities (such as user identification address, application identification, etc.) to execute policies. This policy is usually used to prevent unauthorized access or operation, thereby protecting the security of applications and data. Among the four policies, the whitelist policy has the highest priority, indicating that when other policies conflict with the whitelist policy, the whitelist policy will take effect first. By configuring the above four policies reasonably, the security and stability of the application when reporting data can be ensured, while meeting different application scenarios.
[0097] In some embodiments of this specification, the pre-built policy library includes a mapping relationship between data attributes and reporting policies, refer to Figure 2 As shown, matching the reporting strategy of the application from a pre-built strategy library according to the data attribute includes:
[0098] S201: Determine whether the application identifier, terminal device identifier or user identifier has a corresponding whitelist policy in the policy library;
[0099] S202: If yes, use the corresponding whitelist policy as the reporting policy of the application;
[0100] S203: If not, determine whether there is a corresponding pre-configured policy for the data type in the policy library;
[0101] S204: If yes, use the corresponding pre-configured policy as the reporting policy of the application;
[0102] S205: If not, the default policy is used as the reporting policy of the application.
[0103] It can be understood that when selecting a reporting strategy, since the whitelist strategy has the highest priority, the whitelist strategy is first matched from the policy library according to the application identifier, terminal device identifier, and user identifier. If there is no corresponding whitelist strategy, the pre-configured strategy is matched according to the data type. If no strategy is matched, the default strategy is used as the final reporting strategy. In some embodiments of this specification, in order to perform refined policy control on application data of different data types, data classification is encoded and mapped to different data reporting strategies. Specifically, data classification is distinguished using two codes, typeid and chid. typeid is a major data category, such as performance data, crash data, etc.; chid is a further subdivision of typeid, such as network performance data of performance data, page loading performance data, etc. Each set of typeid-chid corresponds to multiple sets of strategies, such as h5's buried point data. This data can run on Android or iOS, so different strategies can be selected according to different systems, or different strategies can be selected according to device identifiers.
[0104] In some embodiments of this specification, refer to Figure 3 , the obtaining of the network status of the mobile terminal includes:
[0105] S301: Acquire network parameters of the mobile terminal, where the network parameters include round-trip delay, network type, packet loss rate, and network delay;
[0106] S302: Determine the weight of each network parameter using the hierarchical analysis method;
[0107] S303: performing weighted sum processing on the network parameters using the weights of the network parameters to obtain a network environment threshold;
[0108] S304: Acquire the network status of the mobile terminal according to the network environment threshold.
[0109] Specifically, in step S301, the round-trip time (RTT) is the total time required for a data packet to be sent from the sender to the receiver and then returned from the receiver to the sender. This parameter can reflect the response speed of the network. The shorter the RTT, the faster the network transmission speed, and vice versa. Network types include 3G, 4G, 5G, Wi-Fi, etc. Different types of networks have their inherent bandwidth and delay characteristics. Packet loss rate refers to the proportion of data packets lost during data transmission. A high packet loss rate usually means poor network quality. Network delay refers to the time required for a data packet to travel from the sender to the receiver, excluding the return time in the round-trip delay. This parameter can reflect the transmission efficiency of the network. By analyzing the network status by combining the above four network parameters, the changes in network performance can be more comprehensively reflected. The weight of each network parameter is determined by the hierarchical analysis method, which can ensure that the weight distribution is more scientific and reasonable. By performing weighted summation processing on the network parameters using the weights of each network parameter, a network environment threshold can be obtained, and the calculated network environment threshold is compared with the preset threshold range to determine the network status of the mobile terminal. For example, the network status can be divided into several levels such as "excellent", "good", "average", "poor" and "extremely poor", and the current network status of the mobile terminal can be determined according to the range of the network environment threshold. Therefore, compared with the solution of determining the network status only according to the network type in the prior art, the embodiment of this specification determines the network status according to the above four network parameters, which can more comprehensively and accurately reflect the changes in network performance.
[0110] In the embodiment of the present specification, after determining the network status of the mobile terminal, the reporting method corresponding to the corresponding network status information in the reporting strategy is determined according to the current network status, and the application data in the local database is reported to the cloud server according to the reporting method, thereby achieving differentiated reporting in different network environments, thereby avoiding serious impact on the normal functional network requests of the APP due to frequent data reporting when network resources are tight.
[0111] In some embodiments of this specification, refer to Figure 4 , the data reporting method further includes:
[0112] S401: matching a new reporting policy of each application from the policy library at a preset time interval;
[0113] S402: Recording the effective period of the new reporting policy of the application, and storing the new reporting policy in the mobile terminal persistent cache policy library;
[0114] S403: Determine whether the hash value of the new reporting policy of the application is consistent with the hash value of the current reporting policy of the application; if not, replace the current reporting policy of the application with the new reporting policy of the application.
[0115] It can be understood that in order to avoid the reporting strategy from being executed at an inappropriate time, causing unnecessary interference or influence, a corresponding strategy effective period is set for each reporting strategy in the embodiment of this specification, and the strategy effective period refers to the specific time period when the strategy starts to be executed and remains effective. By setting the strategy effective period, it can be ensured that the strategy takes effect within the predetermined time, and it can also meet different application scenarios and needs. For example, in the field of network security, it is necessary to set the effective period of the firewall strategy according to the peak and trough periods of network traffic to optimize network performance and security. Since the environment and requirements of the application may change over time, its reporting strategy also needs to be adjusted accordingly. By matching the reporting strategy of the application from the policy library every preset time, it can ensure that the strategy is updated in time, thereby maintaining the effectiveness and accuracy of the strategy. The preset time can be set according to actual needs, such as every few minutes, every few hours or triggered by a specific event. After matching the new reporting strategy, the system will record the effective period of these reporting strategies and store these new reporting strategies in the persistent cache strategy library of the mobile terminal, so as to avoid the loss of reporting strategy data when the device is restarted or powered off. In step S403, the hash value of the newly reported policy is compared with the hash value of the current reported policy. The hash value is a fixed-length string used for data integrity and identity authentication. If the hash values of two data are the same, then the two data are identical in content. If the hash value of the newly reported policy is inconsistent with the hash value of the current policy, it means that there is a difference between the new reported policy and the current policy (it may be an update, modification, or addition in content). In this case, the current policy will be replaced with the new reported policy to ensure that the application uses the latest policy. Among them, the hash value of the reported policy can be calculated based on the application identifier or user identifier of the corresponding application data.
[0116] In some embodiments of this specification, refer to Figure 5 , before reporting the application data in the local database to the background server according to the determined reporting method, it also includes:
[0117] S501: Obtaining the effective period of the reporting policy of the application program;
[0118] S502: determining whether the reporting policy of the application is invalid according to the effective period of the reporting policy of the application;
[0119] S503: If yes, reselect a new reporting strategy from the mobile terminal persistent cache strategy library according to the data attribute of the application data, and record the effective time period of the new reporting strategy.
[0120] It can be understood that before implementing data reporting, it is necessary to determine whether the reporting strategy corresponding to the application data is invalid. In the embodiment of this specification, the validity period of the reporting strategy and the cloud service time can be used to determine whether the strategy is invalid. This is because the client time may be inconsistent with the actual time due to various reasons (such as time zone setting error, system time tampering, etc.). Therefore, using the cloud service time to control the effectiveness of the strategy can ensure the consistency and accuracy of the time. Before each report, the SDK can send a heartbeat or query request to the backend service to obtain the current cloud service time. When it is determined that the reporting strategy has expired, it is necessary to find a new reporting strategy from the persistent cache strategy library of the mobile terminal to replace it. When selecting a new strategy, it can be selected according to the data attributes of the application data to ensure that the new strategy matches the requirements of the application data or application scenario. Therefore, through the above scheme, it is ensured that the reporting strategy of the application is always the latest and effective, thereby avoiding potential problems caused by the use of outdated strategies. At the same time, by selecting a new strategy according to the data attributes of the application, the system can ensure that the new strategy matches the actual needs of the application, thereby improving the effectiveness and accuracy of the strategy.
[0121] In some embodiments of this specification, refer to Figure 6 , before reporting the application data to the background server according to the reporting method, it also includes:
[0122] S601: Determine whether the application data contains a terminal device identifier;
[0123] S602: If yes, calculate a first hash value of the terminal device identifier corresponding to the application data, and take the modulus of the first hash value as the grayscale percentage;
[0124] S603: If not, determine whether the application data contains a user identifier;
[0125] S604: If yes, calculate a second hash value of the user identifier corresponding to the application data, and take the second hash value as the grayscale percentage after taking the modulus;
[0126] S605: If not, calling a random generation function to generate a random number, and using the random number as the grayscale percentage;
[0127] S606: Determine whether the application data needs to be reported according to the grayscale percentage and a preset grayscale percentage.
[0128] It can be understood that when the amount of application data is large, such as when a certain APP platform is active, the amount of data access will increase significantly. At this time, in order to reduce the amount of data reporting, thereby reducing the data processing pressure of the background service, it is necessary to report the data in grayscale. In the embodiment of this specification, the grayscale percentage is first calculated according to the terminal device identification. If the application data has no terminal device identification, the grayscale percentage is calculated according to the user identification. If there is neither a user identification nor a terminal device identification, a random function is used to generate a random number as the grayscale percentage. Since the data from the same device or the same user should be as complete as possible when uploading the application data to the cloud server for data analysis, the embodiment of this specification calculates the grayscale percentage according to the terminal device identification or application identification of the application data to prevent data loss during data analysis. However, when the user is not logged in, the generated data has no user identification. In this case, a random number will be used to determine whether to report this data. When the calculated grayscale percentage is less than the preset percentage, it indicates that the application data needs to be reported within the grayscale range. When it is greater than the preset percentage, it indicates that the application data is outside the grayscale range and can be discarded.
[0129] In other embodiments, in order to further reduce the pressure of data reporting on the background system, the embodiments of this specification compress the reported data to reduce the data size and improve the efficiency of data reporting. Optionally, the embodiments of this specification adopt the gzip compression algorithm, and after comparative testing, the data compression rate reaches 80%. This not only effectively reduces the occupation of network resources by data reporting, but also significantly reduces the bandwidth overhead of the public network link of the server, thereby improving the throughput rate of data reporting.
[0130] In some embodiments of this specification, in order to ensure the security of the data reporting process and prevent data tampering, before reporting the application data to the background server according to the reporting method, it also includes:
[0131] Calculating a signature value of the application data;
[0132] The signature value is added to the corresponding application data.
[0133] Specifically, filter out the parameter names of all non-empty parameter values from the application data that needs to be reported, sort these parameter names from small to large according to the ASCII code, connect the parameter name and parameter value with = according to the sorted parameter name order, and separate the parameters with &, such as "appid=12345¶m1=value1¶m2=value2", and then use the HMAC-SHA256 algorithm to perform a signature operation on the above assembled string to obtain the signature value of the application data, and add the signature value to the corresponding application data and report it to the cloud server together. After the cloud server receives the reported data and signature value, it first regenerates the assembled string according to the same rules, and then uses the HMAC-SHA256 algorithm and key to perform a signature operation on the regenerated assembled string, and compares the regenerated signature value with the reported signature value. If they are consistent, it means that the data is complete and has not been tampered with. If they are inconsistent, the data may have been tampered with or an error occurred during the transmission process. At this time, it is necessary to send an alarm notification to the corresponding terminal of the business personnel for corresponding processing.
[0134] In some embodiments of this specification, the method further includes:
[0135] Determining whether the application data is reported successfully;
[0136] If yes, deleting the reported application data in the local database of the mobile terminal;
[0137] If not, wait for the next data reporting trigger opportunity and re-initiate data reporting to the cloud server.
[0138] Specifically, after the application data is sent to the cloud server, the mobile terminal should wait for and receive a response from the server, and determine whether the data is successfully reported based on the response content returned by the server. The response content may be a status code, which indicates whether the data is successfully received and processed. For example, HTTP status code 200 usually indicates success, while 4xx and 5xx status codes indicate different types of errors. If an error status code is encountered, the corresponding error handling is performed according to the specific error type (such as network error, server error, data verification failure, etc.). If the data is successfully reported, the reported application data is deleted from the local database of the mobile terminal to ensure that the local database does not accumulate redundant data, thereby saving storage space and improving data query efficiency. In some embodiments, after the data is successfully reported, a log of successful reporting is recorded for future auditing or troubleshooting. If the data fails, the timing of the next trigger data reporting is determined according to a predefined retry strategy (such as immediate retry, delayed retry, limiting the number of retries, etc.), and a log of failed reporting is recorded, including the failure time, error code, and possible error causes, so as to facilitate subsequent analysis of the failure cause and optimize the reporting process. In addition, a notification of report failure can be sent to business personnel so that corresponding processing measures can be implemented later.
[0139] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. And the acquisition, storage, use, and processing of data in the technical solutions described in the embodiments of this application are in compliance with relevant regulations.
[0140] Based on the above-mentioned data reporting method, the embodiment of this specification also provides a corresponding data reporting device. The device may include a system (including a distributed system), software (application), module, component, server, client, etc. using the method described in the embodiment of this specification and a device combined with necessary implementation hardware. Based on the same innovative concept, the device in one or more embodiments provided in the embodiment of this specification is as described in the following embodiments. Since the implementation scheme and method of the device to solve the problem are similar, the implementation of the specific device in the embodiment of this specification can refer to the implementation of the aforementioned method, and the repetitions will not be repeated. As used below, the term "unit" or "module" can implement a combination of software and / or hardware of predetermined functions. Although the device described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceived.
[0141] Specifically, Figure 7 This is a schematic diagram of the module structure of an embodiment of a data reporting device provided in the embodiment of this specification, referring to Figure 7As shown, an embodiment of this specification provides a data reporting device, which is applied to a mobile terminal and includes:
[0142] The data acquisition module 701 is used to acquire application data and data attributes collected by the application program, and store the application data in a local database of the mobile terminal;
[0143] A matching module 702, configured to match the reporting policy of the application from a pre-built policy library according to the data attribute, wherein the policy library includes a mapping relationship between data attributes and reporting policies;
[0144] The network status acquisition module 703 is used to acquire the network status of the mobile terminal;
[0145] A determination module 704, configured to determine a reporting method corresponding to the network status of the mobile terminal in the reporting strategy of the application program;
[0146] The reporting module 705 is used to report the application data in the local database to the cloud server according to the determined reporting method.
[0147] The beneficial effects obtained by the device provided in the embodiments of this specification are consistent with the beneficial effects obtained by the above method and will not be repeated here.
[0148] Reference Figure 8 As shown, based on the above-mentioned data reporting method, a computer device 802 is also provided in an embodiment of the specification, wherein the above-mentioned method runs on the computer device 802. The computer device 802 may include one or more processors 804, such as one or more central processing units (CPUs), and each processing unit may implement one or more hardware threads. The computer device 802 may also include any memory 806, which is used to store any kind of information such as code, settings, data, etc. Non-limiting, for example, the memory 806 may include any one or more combinations of the following: any type of RAM, any type of ROM, flash memory device, hard disk, optical disk, etc. More generally, any memory can use any technology to store information. Further, any memory can provide volatile or non-volatile retention of information. Further, any memory can represent a fixed or removable component of the computer device 802. In one case, when the processor 804 executes an associated instruction stored in any memory or a combination of memories, the computer device 802 can perform any operation of the associated instruction. The computer device 802 also includes one or more drive mechanisms 808 for interacting with any storage, such as a hard disk drive mechanism, an optical disk drive mechanism, etc.
[0149] The computer device 802 may also include an input / output module 810 (I / O) for receiving various inputs (via input devices 812) and for providing various outputs (via output devices 814). A specific output mechanism may include a presentation device 816 and an associated graphical user interface (GUI) 818. In other embodiments, the input / output module 810 (I / O), the input device 812, and the output device 814 may not be included, and the computer device 802 may be used as a computer device in a network. The computer device 802 may also include one or more network interfaces 820 for exchanging data with other devices via one or more communication links 822. One or more communication buses 824 couple the components described above together.
[0150] The communication link 822 may be implemented in any manner, for example, through a local area network, a wide area network (e.g., the Internet), a point-to-point connection, etc., or any combination thereof. The communication link 822 may include any combination of hardwired links, wireless links, routers, gateway functions, name servers, etc. governed by any protocol or combination of protocols.
[0151] Corresponding to Figures 1 to 6 In addition to the method shown, an embodiment of the specification also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the above method are executed.
[0152] The embodiment of the present specification also provides a computer-readable instruction, wherein when the processor executes the instruction, the program therein causes the processor to execute the following Figures 1 to 6 The method shown.
[0153] The embodiments of the present specification also provide a computer program product, including at least one instruction or at least one program, wherein the at least one instruction or the at least one program is loaded and executed by a processor to implement the following Figures 1 to 6 The method shown.
[0154] It should be understood that in the various embodiments of this specification, the size of the serial numbers of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this specification.
[0155] It should also be understood that in the embodiments of this specification, the term "and / or" is only a description of the association relationship of the associated objects, indicating that three relationships can exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this specification generally indicates that the associated objects before and after are in an "or" relationship.
[0156] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed in this specification can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this specification.
[0157] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0158] In the several embodiments provided in this specification, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, or it can be an electrical, mechanical or other form of connection.
[0159] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the embodiments of this specification.
[0160] In addition, each functional unit in each embodiment of this specification may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0161] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this specification is essentially or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of this specification. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.
[0162] Specific embodiments are used in this specification to illustrate the principles and implementation methods of this specification. The description of the above embodiments is only used to help understand the methods and core ideas of this specification. At the same time, for those skilled in the art, according to the ideas of this specification, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on this specification.
Claims
1. A data reporting method, characterized in that: The method is applied to a mobile terminal and includes: Acquire application data and data attributes collected by the application program, and store the application data in a local database of the mobile terminal; According to the data attribute, a reporting policy of the application is matched from a pre-built policy library, wherein the policy library includes a mapping relationship between data attributes and reporting policies; Get the network status of the mobile terminal; Determining a reporting method for the network status of the mobile terminal in the reporting strategy of the application; The application data in the local database is reported to the cloud server according to the determined reporting method.
2. The method according to claim 1, characterized in that The reporting strategies include whitelist strategies, pre-configured strategies and default strategies.
3. The method according to claim 2, characterized in that The data attributes include application identification, terminal device identification, user identification and data type; The matching of the reporting strategy of the application from a pre-built strategy library according to the data attribute includes: Determine whether the application identifier, terminal device identifier, and user identifier have a corresponding whitelist policy in the policy library; If yes, the corresponding whitelist policy is used as the reporting policy of the application; If not, determining whether there is a corresponding pre-configured policy for the data type in the policy library; If yes, then using the corresponding pre-configured policy as the reporting policy of the application; If not, the default policy is used as the reporting policy of the application.
4. The method according to claim 1, characterized in that: The obtaining of the network status of the mobile terminal includes: Obtaining network parameters of the mobile terminal, wherein the network parameters include round-trip delay, network type, packet loss rate, and network delay; The weight of each network parameter is determined by using the analytic hierarchy process; The network parameters are weighted and summed using the weights of each network parameter to obtain the network environment threshold; The network status of the mobile terminal is acquired according to the network environment threshold.
5. The method according to claim 1, characterized in that The method further comprises: Matching a new reporting policy of each application from the policy library at a preset time interval; Recording the effective period of the new reporting policy of the application, and storing the new reporting policy in the mobile terminal persistent cache policy library; It is determined whether the hash value of the new reporting policy of the application is consistent with the hash value of the current reporting policy of the application; if not, the current reporting policy of the application is replaced with the new reporting policy of the application.
6. The method according to claim 5, characterized in that Before reporting the application data in the local database to the background server according to the determined reporting method, the method further includes: Get the effective period of the application's reporting policy; Determining whether the reporting policy of the application is invalid according to the effective period of the reporting policy of the application; If so, a new reporting strategy is reselected from the mobile terminal persistent cache strategy library according to the data attribute of the application data, and the effective time period of the new reporting strategy is recorded.
7. The method according to claim 1, characterized in that Before reporting the application data to the background server according to the reporting method, the method further includes: Determining whether the application data contains a terminal device identifier; If yes, then calculating a first hash value of the terminal device identifier corresponding to the application data, and taking the modulus of the first hash value as the grayscale percentage; If not, determining whether the application data contains a user identifier; If yes, then calculating a second hash value of the user identifier corresponding to the application data, and taking the modulus of the second hash value as the grayscale percentage; If not, a random generation function is called to generate a random number, and the random number is used as the grayscale percentage; Whether the application data needs to be reported is determined according to the grayscale percentage and a preset grayscale percentage.
8. The method according to claim 1, characterized in that Before reporting the application data to the background server according to the reporting method, the method further includes: Calculating a signature value of the application data; The signature value is added to the corresponding application data.
9. The method according to claim 1, characterized in that: The method further comprises: Determining whether the application data is reported successfully; If yes, deleting the reported application data in the local database of the mobile terminal; If not, wait for the next trigger data reporting opportunity and re-initiate data reporting to the cloud server.
10. A data reporting device, characterized in that: The device is applied to a mobile terminal, and the device includes: A data acquisition module, used to acquire application data and data attributes collected by the application program, and store the application data in a local database of the mobile terminal; A matching module, used to match the reporting strategy of the application program from a pre-built strategy library according to the data attribute, wherein the strategy library includes a mapping relationship between data attributes and reporting strategies; A network status acquisition module, used to acquire the network status of the mobile terminal; A determination module, used to determine a reporting method corresponding to the network status of the mobile terminal in the reporting strategy of the application program; The reporting module is used to report the application data in the local database to the cloud server according to the determined reporting method.
11. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 9 is implemented.
12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 9 is implemented.
13. A computer program product, characterized in that The method comprises at least one instruction or at least one program, wherein the at least one instruction or the at least one program is loaded and executed by a processor to implement the method according to any one of claims 1 to 9.
Citation Information
Cited By
License authorization method and system suitable for multiple scenes, terminal and medium
CN120979723A
A license authorization method and system suitable for multiple scenarios, a terminal and a medium
CN120979723B