Time series data processing method and device, electronic equipment and storage medium
Patent Information
- Application Number
- CN202411005655.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-25
- Publication Date
- 2026-10-27
- Estimated Expiration
- 2044-07-25
AI Technical Summary
然而采用该方法,需要同时对数据发送方和数据接收方进行改造,从而,实现成本较高
[0030]根据上一个时序数据对应的现有增量值和新的增量值,确定当前时序数据对应的增量值。
Smart Images

Figure CN118673013B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing technology, and in particular to a time-series data processing method, apparatus, electronic device, and storage medium. Background Technology
[0002] In certain specific scenarios within the observability domain, monitoring systems (such as Prometheus) need to use remote writes to forward collected data to other components, enabling these components to perform secondary processing and storage. However, during data forwarding, if network fluctuations occur, there may be delays in the data reaching the next component (e.g., adjacent data items may be out of order).
[0003] To ensure data reliability, the Transmission Control Protocol (TCP) proposes a solution using an acknowledgment (ACK) mechanism and a sliding time window to ensure that all arriving TCP packets are assembled and unpacked in a consistent order. However, this method requires modifications to both the data sender and receiver, resulting in high implementation costs.
[0004] Therefore, when electronic devices detect a delay in the received time-series data, how to reduce the cost of data repair while ensuring the reliability of data storage results has become an urgent problem to be solved. Summary of the Invention
[0005] This application provides a time-series data processing method, apparatus, electronic device, and storage medium, which can not only ensure the reliability of data storage results when there is a delay in the received time-series data, but also reduce the cost of data repair.
[0006] In a first aspect, embodiments of this application provide a time-series data processing method, the method comprising:
[0007] If a delay is detected in the received current timing data, the first counter value corresponding to the previous timing data, the current increment value corresponding to the previous timing data, and the second counter value corresponding to the current timing data are obtained; the current increment value represents the change in the first counter value of the previous timing data relative to the counter value of the timing data preceding the previous timing data.
[0008] Based on the values of the first and second counters, the existing increment values are corrected to obtain the new increment values corresponding to the previous time series data.
[0009] Determine the increment value corresponding to the current time series data based on the existing increment value and the new increment value corresponding to the previous time series data.
[0010] In one embodiment, the existing incremental value is corrected based on the first counter value and the second counter value to obtain a new incremental value corresponding to the previous time series data. This includes: determining a first difference between the first counter value and the second counter value; and using the first difference to replace the existing incremental value to obtain a new incremental value corresponding to the previous time series data.
[0011] In one embodiment, determining the increment value corresponding to the current time series data based on the existing increment value and the new increment value corresponding to the previous time series data includes: determining a second difference between the existing increment value and the new increment value corresponding to the previous time series data; and using the second difference as the increment value corresponding to the current time series data.
[0012] In one embodiment, after correcting the existing incremental value based on the first counter value and the second counter value to obtain the new incremental value corresponding to the previous time series data, the method further includes: associating and storing the new incremental value with the timestamp and the first counter value corresponding to the previous time series data.
[0013] In one embodiment, after determining the increment value corresponding to the current time series data based on the existing increment value and the new increment value corresponding to the previous time series data, the method further includes: associating and storing the timestamp, the second counter value and the increment value corresponding to the current time series data.
[0014] In one embodiment, the method further includes: when receiving current time-series data, obtaining the timestamp corresponding to the current time-series data and the timestamp corresponding to the previous time-series data; if it is determined that the timestamp corresponding to the current time-series data is later than the timestamp corresponding to the previous time-series data, determining that the current time-series data has a delay.
[0015] Secondly, embodiments of this application provide a time-series data processing apparatus, the apparatus comprising:
[0016] The acquisition module is used to acquire, when a delay is detected in the received current time-series data, the first counter value corresponding to the previous time-series data, the current increment value corresponding to the previous time-series data, and the second counter value corresponding to the current time-series data; the current increment value represents the change in the first counter value of the previous time-series data relative to the counter value of the time-series data preceding the previous time-series data.
[0017] The processing module is used to correct the existing incremental value based on the first counter value and the second counter value to obtain the new incremental value corresponding to the previous time series data.
[0018] The determination module is used to determine the increment value corresponding to the current time series data based on the existing increment value and the new increment value corresponding to the previous time series data.
[0019] Thirdly, this application provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to perform the following steps:
[0020] If a delay is detected in the received current timing data, the first counter value corresponding to the previous timing data, the current increment value corresponding to the previous timing data, and the second counter value corresponding to the current timing data are obtained; the current increment value represents the change in the first counter value of the previous timing data relative to the counter value of the previous timing data.
[0021] Based on the values of the first and second counters, the existing increment values are corrected to obtain the new increment values corresponding to the previous time series data.
[0022] Determine the increment value corresponding to the current time series data based on the existing increment value and the new increment value corresponding to the previous time series data.
[0023] Fourthly, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, performs the following steps:
[0024] If a delay is detected in the received current timing data, the first counter value corresponding to the previous timing data, the current increment value corresponding to the previous timing data, and the second counter value corresponding to the current timing data are obtained; the current increment value represents the change in the first counter value of the previous timing data relative to the counter value of the previous timing data.
[0025] Based on the values of the first and second counters, the existing increment values are corrected to obtain the new increment values corresponding to the previous time series data.
[0026] Determine the increment value corresponding to the current time series data based on the existing increment value and the new increment value corresponding to the previous time series data.
[0027] Fifthly, this application also provides a computer program product, including a computer program that, when executed by a processor, performs the following steps:
[0028] If a delay is detected in the received current timing data, the first counter value corresponding to the previous timing data, the current increment value corresponding to the previous timing data, and the second counter value corresponding to the current timing data are obtained; the current increment value represents the change in the first counter value of the previous timing data relative to the counter value of the previous timing data.
[0029] Based on the values of the first and second counters, the existing increment values are corrected to obtain the new increment values corresponding to the previous time series data.
[0030] Determine the increment value corresponding to the current time series data based on the existing increment value and the new increment value corresponding to the previous time series data.
[0031] The aforementioned time-series data processing method, apparatus, electronic device, and storage medium allow the electronic device to acquire, upon detecting a delay in the received current time-series data, the first counter value corresponding to the previous time-series data, the existing increment value corresponding to the previous time-series data, and the second counter value corresponding to the current time-series data. The existing increment value represents the change in the first counter value of the previous time-series data relative to the counter value of the time preceding the previous time-series data. Then, based on the first and second counter values, the existing increment value is corrected to obtain a new increment value corresponding to the previous time-series data. Finally, based on the existing and new increment values corresponding to the previous time-series data, the increment value corresponding to the current time-series data is determined. Using this method, the electronic device can quickly restore the order of the current and previous time-series data based on the increment value corresponding to the current time-series data. This ensures the reliability of data storage results during data storage and, compared to methods that ensure data reliability through ACK mechanisms and sliding time windows, eliminates the need to modify both the data sender and receiver, thereby reducing the cost of data restoration. Attached Figure Description
[0032] To more clearly illustrate the technical solutions in the embodiments of this application or related technologies, the drawings used in the description of the embodiments of this application or related technologies will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0033] Figure 1 This is a schematic diagram illustrating an application scenario of a time-series data processing method provided in an embodiment of this application;
[0034] Figure 2 This is a flowchart illustrating a time-series data processing method provided in an embodiment of this application;
[0035] Figure 3 This is a flowchart illustrating another time-series data processing method provided in an embodiment of this application;
[0036] Figure 4 This is a schematic diagram of the structure of a time-series data processing device provided in an embodiment of this application;
[0037] Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0038] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0039] Please see Figure 1 , Figure 1 This is a schematic diagram illustrating an application scenario of a time-series data processing method provided in an embodiment of this application. For example... Figure 1 As shown, this application scenario includes a first electronic device 101 and a second electronic device 102. Figure 1 (The second electronic device 102 is illustrated as a network camera). The first electronic device 101 and the second electronic device 102 transmit data via a network.
[0040] The second electronic device 102 can acquire multiple time-series data and perform incremental processing on the time series of each time-series data (which is of counter type) to obtain the incremental value corresponding to each time-series data. Then, it sends the multiple time-series data and the relevant information of each time-series data to the first electronic device 101.
[0041] For example, the original sequence and incremental sequence of the time-series data acquired by the second electronic device 102 can be shown in Table 1 below.
[0042] Table 1. Raw sequence and incremental sequence of time-series data acquired by the second electronic device 102
[0043]
[0044] Suppose that during the transmission of timing data from the second electronic device 102 to the first electronic device 101, network jitter occurs around 12:01:00 on 2024-05-01, resulting in the original sequence and incremental sequence of the timing data received by the first electronic device 101 being as shown in Table 2 below.
[0045] Table 2. Raw sequence and incremental sequence of timing data received by the first electronic device 101
[0046]
[0047] As shown in Table 2, the order of the time-series data corresponding to 12:02:00 on 2024-05-01 and 12:01:00 on 2024-05-01 is reversed. The incremental value of the time-series data corresponding to 12:01:00 on 2024-05-01 is discarded, and the time-series data corresponding to 12:02:00 on 2024-05-01 receives an incorrect incremental value. In this case, the first electronic device 101 can obtain the first counter value corresponding to the previous time-series data, the existing incremental value corresponding to the previous time-series data, and the second counter value corresponding to the current time-series data. The existing incremental value represents the change in the first counter value of the previous time-series data relative to the counter value of the previous time-series data. Then, based on the first counter value and the second counter value, the existing incremental value is corrected to obtain the new incremental value corresponding to the previous time-series data. Finally, based on the existing incremental value and the new incremental value corresponding to the previous time-series data, the incremental value corresponding to the current time-series data is determined. Using this method, electronic devices can quickly restore the order of current and previous time-series data based on the incremental value corresponding to the current time-series data. This ensures the reliability of data storage results during data storage, and compared to methods that rely on ACK mechanisms and sliding time windows to guarantee data reliability, it eliminates the need to modify both the data sender and receiver, thus reducing the cost of data restoration.
[0048] Optionally, the first electronic device 101 may include, but is not limited to, smartphones, tablets, laptops, desktop computers, smartwatches, smart TVs, smart vehicle terminals, etc., without limitation.
[0049] Optionally, the second electronic device 102 may be a network camera, video recorder, etc., which is not limited here.
[0050] The timing data processing method provided in the embodiments of this application will be described in detail below.
[0051] Please see Figure 2 , Figure 2 This is a flowchart illustrating a time-series data processing method provided in an embodiment of this application. The method can be implemented by an electronic device (e.g., a...). Figure 1 The first electronic device 101 in the process executes the command. Figure 2 As shown, this time-series data processing method may include, but is not limited to, the following steps:
[0052] S201. If a delay is detected in the received current timing data, obtain the first counter value corresponding to the previous timing data, the existing increment value corresponding to the previous timing data, and the second counter value corresponding to the current timing data.
[0053] The existing increment value represents the change in the first counter value of the previous time series data relative to the counter value of the previous time series data.
[0054] For example, referring to Table 2, assuming the previous time series data is the time series data corresponding to the timestamp 2024-05-01 12:02:00, and the time series data preceding the previous time series data is the time series data corresponding to the timestamp 2024-05-01 12:00:00, then the existing incremental value of the time series data corresponding to 2024-05-01 12:02:00 is the change in the counter value 10002 of the time series data corresponding to 2024-05-01 12:02:00 relative to the counter value 10000 of the time series data corresponding to 2024-05-01 12:00:00, which is 10002 - 10000 = 2.
[0055] In one optional implementation, the electronic device may also, upon receiving the current timing data, obtain the timestamp corresponding to the current timing data and the timestamp corresponding to the previous timing data; and if it is determined that the timestamp corresponding to the current timing data is later than the timestamp corresponding to the previous timing data, it may determine that there is a delay in the current timing data.
[0056] For example, suppose that after receiving the current time-series data, the electronic device obtains the timestamp of the current time-series data as 2024-05-01 12:01:00 and the timestamp of the previous time-series data as 2024-05-01 12:02:00. Then the electronic device can determine that 2024-05-01 12:02:00 is later than 2024-05-01 12:01:00. In this case, the electronic device can determine that there is a delay in the current time-series data.
[0057] S202. Based on the first counter value and the second counter value, the existing increment value is corrected to obtain the new increment value corresponding to the previous time series data.
[0058] In one optional implementation, after step S202, the electronic device can associate and store the new incremental value (or actual incremental value) corresponding to the previous time series data with the timestamp and the first counter value corresponding to the previous time series data.
[0059] S203. Determine the increment value corresponding to the current time series data based on the existing increment value and the new increment value corresponding to the previous time series data.
[0060] In one optional implementation, after step S203, the electronic device may further associate and store the timestamp, the second counter value, and the increment value corresponding to the current time-series data.
[0061] In this embodiment, when the electronic device detects a delay in the received current time-series data, it can determine the increment value corresponding to the current time-series data based on the existing increment value and the new increment value corresponding to the previous time-series data. This allows for rapid restoration of the order of the current and previous time-series data based on the increment value corresponding to the current time-series data. On the one hand, this ensures the reliability of data storage results; on the other hand, compared to methods that ensure data reliability through ACK mechanisms and sliding time windows, it eliminates the need to modify both the data sender and receiver, thereby reducing the cost of data restoration.
[0062] Please see Figure 3 , Figure 3 This is a flowchart illustrating another time-series data processing method provided in an embodiment of this application. Figure 2 Compared to the time-series data processing methods shown, Figure 3 The method illustrated specifically explains how the electronic device corrects the existing increment value based on the first counter value and the second counter value to obtain the new increment value corresponding to the previous timing data, and how it determines the increment value corresponding to the current timing data based on the existing increment value and the new increment value corresponding to the previous timing data. For example... Figure 3 As shown, this time-series data processing method may include, but is not limited to, the following steps:
[0063] S301. Upon receiving the current time series data, obtain the timestamp corresponding to the current time series data and the timestamp corresponding to the previous time series data.
[0064] In one optional implementation, before step S201, when the electronic device receives the previous time-series data of the current time-series data, it can associate and store the first counter value corresponding to the previous time-series data, the existing increment value corresponding to the previous time-series data, and the timestamp corresponding to the previous time-series data. This allows the electronic device to directly obtain relevant data when it detects a delay in the received current time-series data.
[0065] For example, the relevant information of the previous time-series data stored in the electronic device can be shown in Table 3 below.
[0066] Table 3. Relevant information table for the previous time series data
[0067]
[0068] S302. If it is determined that the timestamp corresponding to the current time series data is later than the timestamp corresponding to the previous time series data, obtain the first counter value corresponding to the previous time series data, the existing increment value corresponding to the previous time series data, and the second counter value corresponding to the current time series data.
[0069] The existing increment value represents the change in the first counter value of the previous time series data relative to the counter value of the previous time series data.
[0070] For example, suppose that the relevant information of the current timing data received by the electronic device is shown in Table 4 below.
[0071] Table 4. Relevant Information Table for Current Time Series Data
[0072]
[0073] Based on Tables 3 and 4, the electronic device can determine that t2 (i.e., 2024-05-01 12:02:00) is later than t1 (i.e., 2024-05-01 12:01:00). In this case, the electronic device can obtain the counter value v1 (i.e. 10002) corresponding to the previous timing data, the existing increment value d11 (i.e. 2) corresponding to the previous timing data, and the counter value v2 (i.e. 10001) corresponding to the current timing data.
[0074] S303. Determine the first difference between the first counter value and the second counter value, and use the first difference to replace the existing incremental value to obtain the new incremental value corresponding to the previous time series data.
[0075] For example, continuing from the previous example, the electronic device can first determine that the difference between v1 (i.e., 10002) and v2 (i.e., 10001) is d12 = v1 - v2 = 10002 - 10001 = 1. Then, the electronic device can use d12 (i.e., 1) to replace the existing incremental value d11 (i.e., 2) to obtain the new incremental value (i.e., d12) 1 corresponding to the previous timing data.
[0076] S304. Determine the second difference between the existing increment value and the new increment value corresponding to the previous time series data, and use the second difference as the increment value corresponding to the current time series data.
[0077] For example, continuing from the previous example, the electronic device can determine the difference between the existing increment value 2 and the new increment value 1 corresponding to the previous time series data, i.e., 2-1=1, and then use 1 as the increment value corresponding to the current time series data. That is, the increment value d2 corresponding to the current time series data in Table 2 is 1.
[0078] In this embodiment, when the electronic device detects a delay in the received current time-series data, it can determine the increment value corresponding to the current time-series data based on the existing increment value and the new increment value corresponding to the previous time-series data. This allows for rapid restoration of the order of the current and previous time-series data based on the increment value corresponding to the current time-series data. On the one hand, this ensures the reliability of data storage results; on the other hand, compared to methods that ensure data reliability through ACK mechanisms and sliding time windows, it eliminates the need to modify both the data sender and receiver, thereby reducing the cost of data restoration.
[0079] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.
[0080] Based on the same inventive concept, this application also provides a time-series data processing apparatus for implementing the time-series data processing method described above. The solution provided by this apparatus is similar to the implementation scheme described in the above method; therefore, the specific limitations in one or more time-series data processing apparatus embodiments provided below can be found in the limitations of the time-series data processing method described above, and will not be repeated here.
[0081] Please see Figure 4 , Figure 4 This is a schematic diagram of the structure of a timing data processing device provided in an embodiment of this application. Figure 4 As shown, the time-series data processing device may include, but is not limited to: an acquisition module 401, a processing module 402, and a determination module 403. Wherein:
[0082] The acquisition module 401 is used to acquire, when a delay is detected in the received current timing data, the first counter value corresponding to the previous timing data, the existing increment value corresponding to the previous timing data, and the second counter value corresponding to the current timing data; the existing increment value represents the change in the first counter value of the previous timing data relative to the counter value of the previous timing data.
[0083] Processing module 402 is used to correct the existing incremental value based on the first counter value and the second counter value to obtain the new incremental value corresponding to the previous time series data;
[0084] The determination module 403 is used to determine the increment value corresponding to the current time series data based on the existing increment value and the new increment value corresponding to the previous time series data.
[0085] In one embodiment, when the processing module 402 corrects the existing incremental value based on the first counter value and the second counter value to obtain a new incremental value corresponding to the previous time series data, it is specifically used to: determine a first difference between the first counter value and the second counter value; and use the first difference to replace the existing incremental value to obtain a new incremental value corresponding to the previous time series data.
[0086] In one embodiment, when determining the increment value corresponding to the current time series data based on the existing increment value and the new increment value corresponding to the previous time series data, the determining module 403 is specifically used to: determine the second difference between the existing increment value and the new increment value corresponding to the previous time series data; and use the second difference as the increment value corresponding to the current time series data.
[0087] In one embodiment, the device further includes a storage module. The storage module is used to associate and store the new incremental value with the timestamp and the first counter value corresponding to the previous time series data after the processing module 402 corrects the existing incremental value according to the first counter value and the second counter value.
[0088] In one embodiment, the storage module is further configured to associate and store the timestamp, the second counter value, and the increment value corresponding to the current time series data after the determining module 403 determines the increment value corresponding to the current time series data based on the existing increment value and the new increment value corresponding to the previous time series data.
[0089] In one embodiment, the acquisition module 401 is further configured to acquire the timestamp corresponding to the current time series data and the timestamp corresponding to the previous time series data when the current time series data is received; the determination module 403 is further configured to determine that the current time series data has a delay when the timestamp corresponding to the current time series data is later than the timestamp corresponding to the previous time series data.
[0090] In one exemplary embodiment, this application provides an electronic device, which may be a terminal device, and its internal structure diagram may be as follows. Figure 5 As shown, this electronic device includes a processor, memory, input / output interface, communication interface, and input device. The processor, memory, and input / output interface are connected via a system bus, and the communication interface and input device are also connected to the system bus via the input / output interface. The processor provides computing and control capabilities. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The input / output interface is used for exchanging information between the processor and external devices. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, Near Field Communication (NFC), or other technologies. When the computer program is executed by the processor, it implements… Figure 2 or Figure 3 The illustrated timing data processing method. The display unit of the electronic device is used to form a visually visible image and can be a display screen, a projection device, or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen. The input device of the computer device can be a touch layer covering the display screen, or buttons, a trackball, or a touchpad set on the casing of the computer device, or an external keyboard, touchpad, or mouse, etc.
[0091] Those skilled in the art will understand that Figure 5 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the electronic device to which the present application is applied. The specific electronic device may include more or fewer components than shown in the figure, or combine certain components, or have different component arrangements.
[0092] In one exemplary embodiment, this application provides an electronic device including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to perform the following steps:
[0093] If a delay is detected in the received current timing data, the first counter value corresponding to the previous timing data, the current increment value corresponding to the previous timing data, and the second counter value corresponding to the current timing data are obtained; the current increment value represents the change in the first counter value of the previous timing data relative to the counter value of the timing data preceding the previous timing data.
[0094] Based on the values of the first and second counters, the existing increment values are corrected to obtain the new increment values corresponding to the previous time series data.
[0095] Determine the increment value corresponding to the current time series data based on the existing increment value and the new increment value corresponding to the previous time series data.
[0096] In one embodiment, when the processor executes a computer program to correct an existing increment value based on a first counter value and a second counter value to obtain a new increment value corresponding to the previous time-series data, the specific steps are as follows: determining a first difference between the first counter value and the second counter value; and using the first difference to replace the existing increment value to obtain a new increment value corresponding to the previous time-series data.
[0097] In one embodiment, when the processor executes a computer program to determine the increment value corresponding to the current time-series data based on the existing increment value and the new increment value corresponding to the previous time-series data, the specific steps are as follows: determining the second difference between the existing increment value and the new increment value corresponding to the previous time-series data; and using the second difference as the increment value corresponding to the current time-series data.
[0098] In one embodiment, after the processor executes a computer program to correct the existing incremental value based on the first counter value and the second counter value to obtain the new incremental value corresponding to the previous time series data, it further performs the following steps: associating and storing the new incremental value with the timestamp and the first counter value corresponding to the previous time series data.
[0099] In one embodiment, after the processor executes a computer program to determine the increment value corresponding to the current time series data based on the existing increment value and the new increment value corresponding to the previous time series data, it further performs the following steps: associatively storing the timestamp, the second counter value, and the increment value corresponding to the current time series data.
[0100] In one embodiment, when the processor executes the computer program, it further performs the following steps: when receiving current timing data, it obtains the timestamp corresponding to the current timing data and the timestamp corresponding to the previous timing data; if it is determined that the timestamp corresponding to the current timing data is later than the timestamp corresponding to the previous timing data, it determines that there is a delay in the current timing data.
[0101] In one exemplary embodiment, this application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, performs the following steps:
[0102] If a delay is detected in the received current timing data, the first counter value corresponding to the previous timing data, the current increment value corresponding to the previous timing data, and the second counter value corresponding to the current timing data are obtained; the current increment value represents the change in the first counter value of the previous timing data relative to the counter value of the timing data preceding the previous timing data.
[0103] Based on the values of the first and second counters, the existing increment values are corrected to obtain the new increment values corresponding to the previous time series data.
[0104] Determine the increment value corresponding to the current time series data based on the existing increment value and the new increment value corresponding to the previous time series data.
[0105] In one embodiment, when a computer program is executed by a processor to correct an existing increment value based on a first counter value and a second counter value to obtain a new increment value corresponding to the previous time-series data, the specific steps are as follows: determining a first difference between the first counter value and the second counter value; and using the first difference to replace the existing increment value to obtain a new increment value corresponding to the previous time-series data.
[0106] In one embodiment, when a computer program is executed by a processor to determine the increment value corresponding to the current time-series data based on the existing increment value and the new increment value corresponding to the previous time-series data, the specific steps are as follows: determining a second difference between the existing increment value and the new increment value corresponding to the previous time-series data; and using the second difference as the increment value corresponding to the current time-series data.
[0107] In one embodiment, after the computer program is executed by the processor to correct the existing incremental value according to the first counter value and the second counter value to obtain the new incremental value corresponding to the previous time series data, it further implements the following steps: associating and storing the new incremental value with the timestamp and the first counter value corresponding to the previous time series data.
[0108] In one embodiment, after the computer program is executed by the processor to determine the increment value corresponding to the current time series data based on the existing increment value and the new increment value corresponding to the previous time series data, it further implements the following steps: associatively storing the timestamp, the second counter value and the increment value corresponding to the current time series data.
[0109] In one embodiment, the computer program executed by the processor further implements the following steps: when receiving current time-series data, obtaining the timestamp corresponding to the current time-series data and the timestamp corresponding to the previous time-series data; if it is determined that the timestamp corresponding to the current time-series data is later than the timestamp corresponding to the previous time-series data, determining that there is a delay in the current time-series data.
[0110] In one exemplary embodiment, this application provides a computer program product including a computer program that, when executed by a processor, performs the following steps:
[0111] If a delay is detected in the received current timing data, the first counter value corresponding to the previous timing data, the current increment value corresponding to the previous timing data, and the second counter value corresponding to the current timing data are obtained; the current increment value represents the change in the first counter value of the previous timing data relative to the counter value of the timing data preceding the previous timing data.
[0112] Based on the values of the first and second counters, the existing increment values are corrected to obtain the new increment values corresponding to the previous time series data.
[0113] Determine the increment value corresponding to the current time series data based on the existing increment value and the new increment value corresponding to the previous time series data.
[0114] In one embodiment, when a computer program is executed by a processor to correct an existing increment value based on a first counter value and a second counter value to obtain a new increment value corresponding to the previous time-series data, the specific steps are as follows: determining a first difference between the first counter value and the second counter value; and using the first difference to replace the existing increment value to obtain a new increment value corresponding to the previous time-series data.
[0115] In one embodiment, when a computer program is executed by a processor to determine the increment value corresponding to the current time-series data based on the existing increment value and the new increment value corresponding to the previous time-series data, the specific steps are as follows: determining a second difference between the existing increment value and the new increment value corresponding to the previous time-series data; and using the second difference as the increment value corresponding to the current time-series data.
[0116] In one embodiment, after the computer program is executed by the processor to correct the existing incremental value according to the first counter value and the second counter value to obtain the new incremental value corresponding to the previous time series data, it further implements the following steps: associating and storing the new incremental value with the timestamp and the first counter value corresponding to the previous time series data.
[0117] In one embodiment, after the computer program is executed by the processor to determine the increment value corresponding to the current time series data based on the existing increment value and the new increment value corresponding to the previous time series data, it further implements the following steps: associatively storing the timestamp, the second counter value and the increment value corresponding to the current time series data.
[0118] In one embodiment, the computer program executed by the processor further implements the following steps: when receiving current time-series data, obtaining the timestamp corresponding to the current time-series data and the timestamp corresponding to the previous time-series data; if it is determined that the timestamp corresponding to the current time-series data is later than the timestamp corresponding to the previous time-series data, determining that there is a delay in the current time-series data.
[0119] It should be noted that the data involved in this application (including but not limited to the previous time series data, the current time series data, etc.) are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data must comply with relevant regulations.
[0120] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, artificial intelligence (AI) processors, etc., and are not limited to these.
[0121] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0122] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A time-series data processing method, characterized in that, The method includes: If a delay is detected in the received current time-series data, the first counter value corresponding to the previous time-series data, the existing increment value corresponding to the previous time-series data, and the second counter value corresponding to the current time-series data are obtained; the existing increment value represents the change in the first counter value of the previous time-series data relative to the counter value of the time-series data preceding the previous time-series data. Determine the first difference between the first counter value and the second counter value, and use the first difference to replace the existing incremental value to obtain a new incremental value corresponding to the previous time series data; Determine the second difference between the existing incremental value and the new incremental value corresponding to the previous time series data, and use the second difference as the incremental value corresponding to the current time series data.
2. The method according to claim 1, characterized in that, After replacing the existing incremental value using the first difference to obtain the new incremental value corresponding to the previous time series data, the process further includes: The new incremental value is associated with and stored in conjunction with the timestamp corresponding to the previous time series data and the first counter value.
3. The method according to claim 1, characterized in that, The method further includes: The timestamp corresponding to the current time series data, the second counter value, and the incremental value corresponding to the current time series data are stored together.
4. The method according to any one of claims 1 to 3, characterized in that, The method further includes: When the current time series data is received, the timestamp corresponding to the current time series data and the timestamp corresponding to the previous time series data are obtained; If it is determined that the timestamp corresponding to the current time series data is later than the timestamp corresponding to the previous time series data, it is determined that the current time series data has a delay.
5. A time-series data processing apparatus, characterized in that, The device includes: The acquisition module is used to acquire, when a delay is detected in the received current time-series data, a first counter value corresponding to the previous time-series data, an existing increment value corresponding to the previous time-series data, and a second counter value corresponding to the current time-series data; the existing increment value represents the change in the first counter value of the previous time-series data relative to the counter value of the time-series data preceding the previous time-series data. The processing module is used to determine a first difference between the first counter value and the second counter value, and use the first difference to replace the existing incremental value to obtain a new incremental value corresponding to the previous time series data. The determining module is used to determine a second difference between the existing incremental value and the new incremental value corresponding to the previous time series data, and to use the second difference as the incremental value corresponding to the current time series data.
6. The apparatus according to claim 5, characterized in that, The device further includes: The storage module is used to associate and store the new incremental value with the timestamp and the first counter value corresponding to the previous time series data.
7. The apparatus according to claim 6, characterized in that, The storage module is also used to associate and store the timestamp, the second counter value, and the incremental value corresponding to the current time series data.
8. An electronic device, characterized in that, The method includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the steps of the method according to any one of claims 1 to 4.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method as described in any one of claims 1 to 4.
10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method as described in any one of claims 1 to 4.
Citation Information
Patent Citations
Time series data storage method and device, computer equipment and storage medium
CN110633277A
Data synchronization method and system
CN112527910A