CN112131276A - Data statistics method, electronic equipment and readable storage medium - Google Patents
Data statistics method, electronic equipment and readable storage medium Download PDFInfo
- Publication number
- CN112131276A CN112131276A CN202011031679.2A CN202011031679A CN112131276A CN 112131276 A CN112131276 A CN 112131276A CN 202011031679 A CN202011031679 A CN 202011031679A CN 112131276 A CN112131276 A CN 112131276A
- Authority
- CN
- China
- Prior art keywords
- statistical
- data
- server
- service
- memory
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 62
- 230000015654 memory Effects 0.000 claims abstract description 89
- 238000004364 calculation method Methods 0.000 claims abstract description 60
- 238000010586 diagram Methods 0.000 description 14
- 238000012544 monitoring process Methods 0.000 description 7
- 230000002159 abnormal effect Effects 0.000 description 5
- 230000001419 dependent effect Effects 0.000 description 5
- 230000008569 process Effects 0.000 description 5
- 238000004590 computer program Methods 0.000 description 4
- 230000008859 change Effects 0.000 description 3
- 230000008878 coupling Effects 0.000 description 3
- 238000010168 coupling process Methods 0.000 description 3
- 238000005859 coupling reaction Methods 0.000 description 3
- 230000003287 optical effect Effects 0.000 description 3
- 238000012545 processing Methods 0.000 description 3
- 238000004891 communication Methods 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 230000006870 function Effects 0.000 description 2
- 230000003993 interaction Effects 0.000 description 2
- 230000005856 abnormality Effects 0.000 description 1
- 230000006399 behavior Effects 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000004140 cleaning Methods 0.000 description 1
- 230000001186 cumulative effect Effects 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000008439 repair process Effects 0.000 description 1
- 230000004044 response Effects 0.000 description 1
- 238000004904 shortening Methods 0.000 description 1
- 238000007619 statistical method Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/24—Querying
- G06F16/245—Query processing
- G06F16/2458—Special types of queries, e.g. statistical queries, fuzzy queries or distributed queries
- G06F16/2462—Approximate or statistical queries
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/22—Indexing; Data structures therefor; Storage structures
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/24—Querying
- G06F16/248—Presentation of query results
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/28—Databases characterised by their database models, e.g. relational or object models
- G06F16/284—Relational databases
-
- G—PHYSICS
- G08—SIGNALLING
- G08B—SIGNALLING OR CALLING SYSTEMS; ORDER TELEGRAPHS; ALARM SYSTEMS
- G08B21/00—Alarms responsive to a single specified undesired or abnormal condition and not otherwise provided for
- G08B21/18—Status alarms
- G08B21/182—Level alarms, e.g. alarms responsive to variables exceeding a threshold
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- Databases & Information Systems (AREA)
- General Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Computational Linguistics (AREA)
- Software Systems (AREA)
- Probability & Statistics with Applications (AREA)
- Fuzzy Systems (AREA)
- Mathematical Physics (AREA)
- Business, Economics & Management (AREA)
- Emergency Management (AREA)
- Telephonic Communication Services (AREA)
Abstract
The application discloses a data statistics method, an electronic device and a readable storage medium, wherein the method comprises the following steps: the server receives at least one service data sent by the user terminal; performing statistical calculation on at least one service data in a memory of the server to obtain at least one corresponding statistical data, and storing the at least one statistical data in a memory of the server; at least one statistical datum in a memory of the server is saved to a database associated with the server at a first time interval. By means of the method, the real-time performance of the statistical data can be improved.
Description
Technical Field
The present application relates to the field of computer technologies, and in particular, to a data statistics method, an electronic device, and a readable storage medium.
Background
In recent years, with the continuous development of information technology, the types of application programs are more and more, and in order to analyze the advantages and the disadvantages of the application programs, the user terminal sends the relevant service data of the application programs to the background server for statistical calculation to obtain statistical results, and then improves the application programs according to the statistical results.
When data is counted, due to the fact that the types of application programs and services are large at present, the usage amount of the application programs is large, the traffic of generated service data is very large, and the conventional data counting device cannot count the data quickly, so that the real-time performance of the counted data is poor.
Disclosure of Invention
A first aspect of an embodiment of the present application provides a data statistics method, including: the server receives at least one service data sent by the user terminal; performing statistical calculation on at least one service data in a memory of the server to obtain at least one corresponding statistical data, and storing the at least one statistical data in a memory of the server; at least one statistical datum in a memory of the server is saved to a database associated with the server at a first time interval.
A second aspect of the embodiments of the present application provides an electronic device, which includes a processor and a memory connected to the processor, where the memory is used to store program data, and the processor is used to execute the program data to implement the foregoing method.
A third aspect of the embodiments of the present application provides a computer-readable storage medium, in which program data are stored, and when the program data are executed by a processor, the program data are used to implement the foregoing method.
The beneficial effect of this application is: different from the situation of the prior art, the server in the application can receive at least one service data sent by the user terminal in real time, perform real-time statistical calculation on the at least one service data in the memory of the server to obtain at least one corresponding statistical data, and store the at least one statistical data in the memory of the server, so that the loss of the statistical data can be avoided.
Drawings
In order to more clearly illustrate the technical solutions in the present application, the drawings required in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings described below are only some embodiments of the present application, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without inventive labor. Wherein:
FIG. 1 is a schematic flow chart diagram illustrating an embodiment of a method for data statistics provided herein;
FIG. 2 is another schematic flow chart diagram illustrating an embodiment of a method for data statistics provided herein;
FIG. 3 is a schematic flow chart diagram illustrating another embodiment of a method for data statistics provided herein;
FIG. 4 is a schematic flow chart diagram illustrating a method for data statistics provided herein;
FIG. 5 is a schematic flow chart diagram illustrating a method for data statistics provided herein;
FIG. 6 is a diagram illustrating a first display mode in the method for data statistics provided herein;
FIG. 7 is a diagram illustrating a second display mode in the method for data statistics provided herein;
FIG. 8 is a block diagram of an embodiment of an electronic device provided herein;
FIG. 9 is a block diagram of an embodiment of a computer storage medium provided herein.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The terms "first" and "second" in this application are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one such feature. In the description of the present application, "plurality" means at least two, e.g., two, three, etc., unless explicitly specifically limited otherwise. Furthermore, the terms "include" and "have," as well as any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, article, or apparatus that comprises a list of steps or elements is not limited to only those steps or elements listed, but may alternatively include other steps or elements not listed, or inherent to such process, method, article, or apparatus.
Reference in the specification to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the specification. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. It is explicitly and implicitly understood by one skilled in the art that the embodiments described herein can be combined with other embodiments.
Referring to fig. 1 to 2, fig. 1 is a schematic flow chart of an embodiment of a data statistics method provided by the present application, and fig. 2 is another schematic flow chart of an embodiment of the data statistics method provided by the present application. In this embodiment, the method may be applied to a server.
The method may comprise the steps of:
step S11: the server receives at least one service data sent by the user terminal.
In this embodiment, the user terminal is a terminal that performs various service processes and generates service data. The number of the user terminals is generally plural, and may be one. The user terminal can send the generated service data to the server in real time, and the server performs statistical calculation. The server can simultaneously receive a plurality of service data sent by a plurality of user terminals. Alternatively, the traffic data may be generated by a web application in the user terminal, the web application not being limited to PC pages, mobile H5 pages, applets, fast applications, etc. Alternatively, the user terminal may include a browser kernel compatible with the HTML5 JavaScript API, and the business data may be generated by the browser.
In some embodiments, since one user terminal may also generate a plurality of service data at the same time, the user terminal may also perform statistical calculation on the generated service data in real time to obtain preliminary statistical data, and then send the preliminary statistical data to the server for statistical calculation, and the server performs statistical calculation on the preliminary statistical data received in real time and sent by the plurality of user terminals to obtain statistical data. Since the statistical calculation is performed once at the user terminal, the amount of data transmitted to the server can be reduced, and secondly, the calculation pressure of the server can be reduced.
The service data is data related to the service, such as first screen time, interface time consumption, whether a reported interface is abnormal, whether a monitoring item occurs, and the like. In this embodiment, the service data may be digital service data. For example, the first screen time and the interface elapsed time may be real numbers greater than or equal to zero; if the reporting interface is abnormal, the reporting interface is marked as 1 if the reporting interface is successful, and the reporting interface is marked as 0 if the reporting interface is failed; whether the monitoring item occurs or not can be represented as that the monitoring item occurs, and then the monitoring item is recorded as 1, and if the monitoring item does not occur, then the monitoring item is recorded as 0. The service data can reflect the conditions of various services in the application program and the using modes and habits of the users, so that the server can monitor the services in real time by the users and background workers through carrying out real-time statistics on the service data, and when the services have problems, the background workers can repair the services in time.
Alternatively, in this embodiment, the server may be a distributed server, that is, the server is formed by combining a plurality of devices with storage and computing capabilities. For example, a server may be composed of multiple computers. In some embodiments, the server may also be a device with storage and computing capabilities.
Optionally, after receiving the at least one service data sent by the user terminal, the server performs a series of (e.g., data cleaning) processes on the service data, and then performs statistical calculation on the at least one service data in the memory of the server.
Step S12: and carrying out statistical calculation on at least one service data in a memory of the server to obtain at least one corresponding statistical data, and storing the at least one statistical data in a memory of the server.
Generally, a server receives a plurality of service data sent by a plurality of user terminals in real time at a time point, in addition, the server may also receive only one service data at a time point, and the server may perform statistical calculation on one or more service data in a memory in real time to obtain at least one statistical data corresponding to one or more service data. Optionally, the server may store the obtained at least one statistical data in the memory.
In this embodiment, the server may store at least one statistical data in the memory of the server, so as to avoid the loss of the statistical data in the memory. It can be understood that the background server stores the service data uploaded to the user terminal in the memory, and when the background server is releasing service or restarting, the data in the memory may be lost, but the data is not lost when being stored in the memory. In this embodiment, since the statistical data processed by the server in real time is stored in the storage, it is possible to avoid storing the service data uploaded by the user terminal by using the memory of the server, thereby reducing the occupation of the memory resources of the server, and secondly, avoiding the unreliability of the data caused by storing the data by using the memory.
Alternatively, the memory is not limited to floppy disk memory, hard disk memory, optical disk memory, and tape memory. In this embodiment, the storage may be a file system of the server, and data stored in the file system is not easily lost, specifically, the file system may be a magnetic disk of the server, and the magnetic disk may be a hard disk, a floppy disk, or another disk, so that after the statistical calculation is completed, the server may store the obtained statistical data in the magnetic disk of the server for storage. As shown in FIG. 2, the memory may be located in a server, such as may be the server's file system. In other embodiments, the memory may also be a database or the like associated with the server.
Step S13: at least one statistical datum in a memory of the server is saved to a database associated with the server at a first time interval.
After the server stores the statistical data in the memory in real time, the server also needs to store at least one statistical data in the memory of the server into a database associated with the server according to a first time interval. On one hand, at least one statistical data in the memory is stored in the database, and the database carries out statistical calculation on the statistical data which is calculated once again, so that the method is more convenient and quicker; on the other hand, when the server is a distributed server, the database can summarize statistical data in the memories of the multiple devices, and the server performs statistical calculation again to obtain a final first statistical result, so that the data integrity is improved, and the first statistical result is more accurate.
Alternatively, the database may be a relational database management system, such as MySQL.
Alternatively, the first time interval may be set according to actual conditions. In this embodiment, the first time interval is 5 minutes. In other embodiments, the first time interval may also be configured to be a smaller time, such as 4 minutes, 2 minutes, or 30 seconds, etc., or the first time interval may also be configured to be a larger time, such as 10 minutes, half an hour, or a day, etc. The server stores the statistical data in the memory into the memory in real time, and the data in the memory is not easy to lose, so that the server can upload the statistical data in the memory to the database according to the first time interval, the situation that the statistical data are directly uploaded to the database in real time by the memory is avoided, and the interaction times of the memory or the memory and the database can be reduced.
In the above manner, the server may receive at least one service data sent by the user terminal in real time, perform real-time statistical calculation on the at least one service data in the memory of the server to obtain at least one corresponding statistical data, and store the at least one statistical data in the memory of the server, which may avoid loss of the statistical data, and then the server stores the at least one statistical data in the memory of the server in the database associated with the server according to the first time interval, which may reduce interaction with the database, and the user may query the statistical data in the database with the first time interval as a granularity, thereby improving the real-time performance of the statistical data.
In addition, the following embodiment further provides a function of freely defining a monitoring item, that is, a user can freely define a service index and a statistical item to be monitored, so that the service index and a front-end abnormality concerned by the user or a background worker can be monitored, wherein the service index or the statistical item can be further reduced, so as to reduce the occupation of storage resources of a server and reduce the calculation pressure of the server.
Referring to fig. 3, fig. 3 is a schematic flow chart of another embodiment of a data statistics method provided in the present application. In this embodiment, the method may be applied to a server.
The method may comprise the steps of:
step S21: the server receives at least one service data sent by the user terminal.
In this embodiment, please refer to step S11 in the above embodiment for the description of step S21, which is not repeated herein.
Step S22: and receiving the service indexes and the statistical items corresponding to the service data.
It can be understood that, the sequence between steps S21 and S22 is not fixed, and the server may receive at least one service data or the service index and the statistical item corresponding to the service data sent by the user terminal first, or the server may receive at least one service data and the service index and the statistical item corresponding to the service data sent by the user terminal at the same time.
Optionally, the service indexes corresponding to different service data may be different, and the statistical items may also be different. A traffic indicator may have at least one statistical term. The service index is not limited to PV (Page Views, Page view volume), UV (Unique view, independent view volume), number of red packages issued, number of behavior clicks of a button, and the like. The statistical item may include at least one of a maximum value, a minimum value, an average value, a sum, a percentage, and a number of the at least one traffic data.
In some embodiments, the service data may carry a service identifier, and correspondingly, the service index and the statistical item also carry corresponding service identifiers, so that the server may pair the service data, the service index and the statistical item corresponding to the same service identifier after receiving a plurality of service data, service indexes and statistical items. The service identification may be a number, a character or a string of characters, such as fanngbao.
In an application scenario, a user terminal (front end) provides a front-end reporting component written by JavaScript (JS for short), and a business web application can report business data to an interface of a background server through XmlHttpRequest (a group of API function sets) by using a method provided by the front-end reporting component by introducing the reporting component. The server can provide an interface for applying for reporting the service index and an interface for reporting the service data for the web application of the user terminal, wherein the interface for applying for reporting the service index is used for increasing a field for reporting the service and a statistic item of the service field, and the interface for reporting the service data is used for receiving the data reported by the service. In another application scenario, optionally, whether the service index needs to be alarmed and an alarm threshold may also be configured by using an interface applying for reporting the service index.
Step S23: and judging whether the service data has corresponding service indexes and statistical items.
If yes, go to step S24.
And if not, ignoring the reported service data.
That is, in this embodiment, when it is determined that the service data has the corresponding service index and the statistical item, the statistical calculation is further performed on at least one service data in the memory of the server, otherwise, the reported service data is ignored, and the statistical calculation is not performed on the service data, so as to reduce the calculation pressure of the server.
Specifically, the server may search for a service index and a statistical item corresponding to the service data according to the service identifier, determine that the service data does not have the corresponding service index and statistical item if the service index and statistical item corresponding to the service identifier cannot be found, ignore the reported service data, otherwise determine that the service data has the corresponding service index and statistical item, and continue to execute step S24.
Step S24: and according to the service indexes and the statistical items corresponding to the service data, performing statistical calculation on at least one service data in a memory of the server to obtain at least one corresponding statistical data, and storing the at least one statistical data in a memory of the server.
In some embodiments, when the statistical item includes at least one of a maximum value and a minimum value of the at least one service data, the performing, according to the service index and the statistical item corresponding to the service data, a statistical calculation on the at least one service data in the memory of the server may be: judging the size of each service data and the size of the last service data in at least one service data; storing a larger and/or smaller service data as statistical data; and repeating the steps until all the service data participate in the statistical calculation. The above steps are repeated, that is, the size of each service data and the size of the last service data in at least one service data are repeatedly judged, and the larger and/or smaller service data are stored to be used as statistical data.
Specifically, when the statistical item is the maximum value, after the size of each service data in at least one service data and the size of the last service data are judged, the larger service data is stored to be used as statistical data, and the steps are repeated until all the service data participate in statistical calculation; and when the statistical item is the minimum value, after judging the size of each service data and the previous service data in at least one service data, storing the smaller service data as statistical data, and repeating the steps until all the service data participate in statistical calculation.
The server can obtain the last service data from the memory to perform judgment. Because the data in the memory may be lost or emptied, if the previous service data in the memory of the server is empty, that is, the corresponding previous service data cannot be found, the service data may be directly stored, or the corresponding previous service data may be acquired from the memory of the server.
For example, the server receives 5 pieces of service data at the same time at a certain time, where the service indexes of 1, 3, 5, 20, and 3 (units are all elements) are the amount of the received red packet, the statistical item is the minimum value, and the server obtains that the last service data corresponding to the 5 pieces of service data is 4, so when performing data statistics, the server determines the size of any one of the 5 pieces of service data and the size of the last service data, e.g., determines 1 and 4, and stores a smaller 1 because 1 is smaller than 4, and continues to determine the size of any one of the remaining 4 pieces of service data and the size of the last service data, e.g., determines 1 and 3, and stores a smaller 1, and so on, the above steps are repeated until the 5 pieces of service data participate in statistical calculation, and finally the minimum value of the amount of the received red packet is 1.
In other embodiments, when the statistical item includes at least one of a number, an average, a sum, and a percentage of the at least one service data, the performing the statistical calculation on the at least one service data in the memory of the server according to the service index and the statistical item corresponding to the service data may be: and calculating the number, the average value, the sum and the percentage of at least one service data, and storing the number, the average value, the sum and the percentage of at least one service data as statistical data.
When the statistical item includes at least one of an average value, a sum and a percentage of at least one service data, unlike the maximum value and the minimum value, the number of the service data needs to be statistically calculated and stored in the memory so as to be statistically calculated again later.
For example, when the server receives 5 pieces of service data at the same time, and the service indexes (units are all elements) of 1, 3, 5, 20, and 3 are the amount of the received red packet, and the statistical item is an average value, the average value and the number of the 5 pieces of service data are calculated, so that the average value is 8.4, and the number of the 5 pieces of service data is 5, and the average value 8.4 and the number of the 5 pieces of service data are stored in the memory as the statistical data of the 5 pieces of service data. Similarly, the sum is not described in detail. In addition, the service index is the report interface abnormal rate, the server receives 5 service data at the same time, which are respectively 1, 0, 1 and 1, wherein 1 represents the interface success, 0 represents the interface failure, the report interface abnormal rate is 40% by calculating the average value, and the number of services is 5.
Step S25: at least one statistical datum in a memory of the server is saved to a database associated with the server at a first time interval.
In this embodiment, please refer to step S13 in the above embodiment for the description of step S21, which is not repeated herein.
Optionally, in this embodiment, after at least one statistical data in the storage of the server is stored in the database associated with the server, the statistical data stored in the memory of the server may also be cleared. The statistical data in the memory is cleared to increase the available memory of the server because the statistical data in the memory is stored in the database.
By the mode, the service can self-define the reporting index, the user terminal does not need to apply for increasing fields on the table of the data warehouse in advance, does not need to write the corresponding SQL offline calculation statistical items to fall into the database, directly monitors the newly added reporting index, and has better expansibility.
In order to count the real-time performance of data, the service index and the statistical item reported by the front end need to be stored in the memory for calculation, but because the flow rate of the user terminal is large, the service index is more and more along with the expansion of the service, and meanwhile, the abnormal data of the user terminal cannot be estimated in advance, the memory of the server cannot meet the memory calculation of the full data. In the embodiment, after the real-time statistical calculation is performed in the memory of the server, the statistical data is stored in the memory, then the statistical data in the memory is stored in the database at the first time interval, and the database performs the calculation of the total data, so that the real-time performance of the statistical data is improved, and the calculation pressure of the memory is also reduced.
In addition, the following embodiment also provides a data statistics method of the custom alarm rule.
Referring to fig. 4, fig. 4 is a schematic flowchart illustrating a data statistics method according to another embodiment of the present application. In this embodiment, the method may be applied to a server.
The method may comprise the steps of:
this embodiment may further include steps S36, S37, S38, and S39 after step S25 in the above embodiment.
Step S36: and performing statistical calculation on the statistical data stored in the database at each first time interval to obtain a first statistical result corresponding to each first time interval.
In some embodiments, the server is a distributed server, i.e., a multiple device cluster deployment. The device may be a computer. Typically, each device includes a memory. The server uploads the statistical data in the database to a plurality of memories corresponding to the plurality of devices at each first time interval for statistical calculation, so that a first statistical result corresponding to each first time interval can be obtained.
For example, the first time interval is 5 minutes, the server uploads the statistical data in each memory to the database every 5 minutes, and the server queries all the statistical data of the 5 minutes and performs statistical calculation to obtain a first statistical result corresponding to the 5 minutes.
In one embodiment, since the average value and the corresponding number are stored in the statistical data, the statistical calculation can be performed again according to the average value and the corresponding number. For example, the average value and the number uploaded by 2 memories are 5 and 2, and 4 and 3 respectively, and the average value can be obtained to be 4.4 through statistical calculation.
In another embodiment, since the maximum value is stored in the statistical data, when the maximum value of all the statistical data corresponding to the service index in the first time interval is statistically calculated, after each statistical data of all the statistical data corresponding to the service index in the first time interval and the size of the last statistical data are judged, the larger statistical data is stored as the first statistical result, and the above steps are repeated until all the statistical data participate in the statistical calculation.
It can be understood that the method for the server to perform the statistical calculation according to the statistical data is similar to the statistical method in the foregoing embodiment, and therefore, details of the summation, the percentage calculation, the number calculation, the minimum calculation, and the like are not described herein again.
Optionally, after obtaining one first statistical result corresponding to each first time interval, the server may further display the first statistical result to the user. And the first statistical result is displayed to the user by taking the first time interval as granularity.
In some embodiments, the server may be an interface for displaying the first statistical result to the user in response to the user's instruction, for example, the server may provide an interface for querying the first statistical result of the service index, and when the server receives the instruction for querying the first statistical result of the service index from the user through the interface, the server queries the result and displays the first statistical result to the user through the management platform. Alternatively, the server may display the first statistical result to the user through the user terminal.
In other embodiments, the server may also automatically display the first statistical result to the user, for example, the first statistical result may be displayed to the user periodically, or the first statistical result may be displayed to the user when a certain threshold value is reached.
Step S37: and judging whether the service index corresponding to the service data needs to be alarmed or not.
If the service index corresponding to the service data needs to be alarmed, step S38 is executed.
And if the service index corresponding to the service data does not need to be alarmed, giving up the alarm.
Step S38: and judging whether the first statistical result reaches an alarm threshold value.
If the first statistical result reaches the alarm threshold, step S39 is executed.
And if the first statistical result does not reach the alarm threshold value, giving up the alarm.
Step S39: and (5) alarming.
In some embodiments, the server may store a correspondence between the service index and the alarm in advance, and an alarm threshold corresponding to the alarm when the alarm is required, and optionally, the correspondence between the service index and the alarm threshold may be stored in a table.
In other embodiments, the server may configure, through the interface for reporting the service index, whether the service index needs to be alarmed and an alarm threshold, so that a user may customize an alarm rule to receive an alarm notification when reporting the service index through the interface.
In the above manner, statistical calculation is performed on statistical data stored in the database at each first time interval to obtain a first statistical result corresponding to each first time interval, and whether a service index corresponding to the service data needs to be alarmed is judged, if yes, whether the first statistical result corresponding to the service data reaches an alarm threshold is further judged, and if yes, the service is alarmed, so that the real-time performance of service alarm can be improved.
Referring to fig. 5 to 7, fig. 5 is a schematic flowchart illustrating a data statistics method according to still another embodiment of the present disclosure, fig. 6 is a schematic diagram illustrating a first display manner in the data statistics method according to the present disclosure, and fig. 7 is a schematic diagram illustrating a second display manner in the data statistics method according to the present disclosure. In this embodiment, the method may be applied to a server.
In the present embodiment, after step S25 in the above-described embodiment, steps S46, S47, S48, and S49 may also be included.
S46: and performing statistical calculation on the statistical data stored in the database at each first time interval to obtain a first statistical result corresponding to each first time interval.
For the explanation of this step, please refer to step S36 in the above embodiment, which is not described herein again.
S47: and storing the first statistical result according to the time sequence.
Specifically, the server may store the first statistical result calculated every first time interval in chronological order from front to back. In other embodiments, the server may further store the first statistical result calculated every first time interval in a time sequence from back to front.
Alternatively, the server may store the first statistical result in a database or other storage space.
S48: and carrying out statistical calculation on the first statistical result stored in the second time interval to obtain a second statistical result.
Wherein the second time interval is greater than the first time interval. The second time interval is for example 1 week, 1 month or 1 year.
It can be understood that, since the server stores the first statistical result calculated every first time interval, not only the historical first statistical result can be obtained, but also when the second statistical result in the second time interval is calculated, the second statistical result corresponding to the second time interval can be obtained by simply calculating the first statistical result obtained by previous calculation, without traversing the database storing the statistical data, and performing statistical calculation by obtaining the statistical data in the second time interval, thereby greatly saving the calculation resources and shortening the waiting time of the user.
S49: and displaying the second statistical result to the user.
In this embodiment, the manner of displaying the second statistical result to the user is similar to the explanation of displaying the first statistical result to the user, and specific reference may be made to the corresponding position in the above embodiment.
In some embodiments, the server may obtain a result query instruction of the user, where the result query instruction includes a display type of the statistical result; and responding to a result query instruction of the user, and displaying the first statistical result and/or the second statistical result to the user according to the display type of the statistical result.
The display type may include characters, diagrams, audio and video, and the like. Optionally, the user may select the statistical result (the first statistical result and/or the second statistical result) to be queried and the display type of the statistical result by clicking a button on the query platform or by voice input, and correspondingly, the server generates a corresponding result query instruction according to the statistical result to be queried and the display type of the statistical result.
In some application scenarios, the server stores the first statistical result in chronological order, so that the user can select to obtain not only the latest first statistical result but also a plurality of historical first statistical results when obtaining the first statistical result. When the user selects to obtain the latest first statistical result, the server can display the latest first statistical result to the user in a text mode. When the user selects to acquire the plurality of historical first statistical results, the server can construct a corresponding chart according to the storage time and the plurality of historical first statistical results, and the plurality of historical first statistical results are displayed in a chart mode, so that the user can more intuitively view the change condition of the historical first statistical results.
Alternatively, when the display type is a graph, the user may also select an independent variable and a dependent variable, for example, one is the time and the dependent variable is the first statistical result, and the other is the time and the dependent variable is the sum of the first statistical result. For example, when the current time is 11:58am, the user selects and displays all the first statistical results within 20 minutes before the query in a graph mode, wherein the first statistical results are stored with 5 minutes as granularity, so that the server obtains the last four stored 4 first statistical results, which are (12:00, 1), (12:05, 2), (12:10, 3), (12:15, 4). If the statistic item is the maximum value, the minimum value, the percentage or the average value, the first display mode as shown in fig. 6 can be selected, the independent variable t1 is time, and the dependent variable y1 is the first statistic result, so that the change of the first statistic result in the 20 minutes can be visually seen. If the statistics are total and number, the second display mode shown in fig. 7 can be selected, the independent variable t2 is time, the dependent variable y2 is the sum of the first statistics and is (12:00, 1), (12:05, 3), (12:10, 6), (12:15, 10), respectively, so that the cumulative change of the first statistics in the 20 minutes can be reflected.
In some embodiments, the server may further store at least one service data sent by the user terminal, for example, in a database, for later use in checking and verifying the statistical result. It is understood that, in the present embodiment, the database storing the business data, the database storing the statistical data, and the database storing the first statistical result are different databases, so as to reduce the storage pressure of the databases.
Referring to fig. 8, fig. 8 is a schematic diagram of a frame of an embodiment of an electronic device provided in the present application. The electronic device 800 includes: the electronic device comprises a processor and a memory connected to the processor, the memory being adapted to store program data, the processor being adapted to execute the program data to implement the steps of any of the above-described method embodiments. The electronic device is, for example, a mobile phone, a computer, etc.
In particular, the processor 810 is configured to control itself and the memory 820 to implement the steps of any of the method embodiments described above. Processor 810 may also be referred to as a CPU (Central Processing Unit). Processor 810 may be an integrated circuit chip having signal processing capabilities. The Processor 810 may also be a general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic, discrete hardware components. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. Additionally, processor 810 may be commonly implemented by multiple integrated circuit chips.
Referring to fig. 9, fig. 9 is a block diagram illustrating an embodiment of a computer storage medium according to the present application. The computer readable storage medium 900 stores program data 910, and the program data 910 is used for implementing the steps of any of the above method embodiments when executed by a processor.
The computer-readable storage medium 900 may be a medium that can store a computer program, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, or may be a server that stores the computer program, and the server can send the stored computer program to another device for running or can run the stored computer program by itself.
In the several embodiments provided in the present application, it should be understood that the disclosed method and apparatus may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, a division of a module or a unit is merely a logical division, and an actual implementation may have another division, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection of devices or units through some interfaces, and may be in an electrical, mechanical or other form.
Units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be substantially implemented or contributed to by the prior art, or all or part of the technical solution may be embodied in a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, a network device, or the like) or a processor (processor) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The above description is only an example of the present application and is not intended to limit the scope of the present application, and all modifications of equivalent structures and equivalent processes, which are made by the contents of the specification and the drawings, or which are directly or indirectly applied to other related technical fields, are intended to be included within the scope of the present application.
Claims (12)
1. A method of data statistics, comprising:
the server receives at least one service data sent by the user terminal;
performing statistical calculation on the at least one service data in a memory of the server to obtain corresponding at least one statistical data, and storing the at least one statistical data in a memory of the server;
storing the at least one statistical datum in the memory of the server to a database associated with the server at a first time interval.
2. The method of claim 1, further comprising:
receiving a service index and a statistical item corresponding to the service data;
the performing statistical calculation on the at least one service data in the memory of the server to obtain corresponding at least one statistical data includes:
judging whether the service data has corresponding service indexes and statistical items;
if so, performing statistical calculation on the at least one service data in the memory of the server according to the service index and the statistical item corresponding to the service data to obtain corresponding at least one statistical data.
3. The method of claim 2,
the statistical item includes at least one of a maximum value, a minimum value, an average value, a sum, a percentage, and a number of the at least one traffic data.
4. The method of claim 3, wherein when the statistic includes at least one of a maximum value and a minimum value of the at least one traffic data,
the performing statistical calculation on the at least one service data in the memory of the server according to the service index and the statistical item corresponding to the service data to obtain the corresponding at least one statistical data includes:
judging the size of each service data and the size of the last service data in the at least one service data;
storing a larger and/or smaller service data as statistical data;
and repeating the steps until all the service data participate in the statistical calculation.
5. The method of claim 3, wherein when the statistic item comprises at least one of a number, an average, a sum, or a percentage of the at least one traffic data,
the performing statistical calculation on the at least one service data in the memory of the server according to the service index and the statistical item corresponding to the service data to obtain the corresponding at least one statistical data includes:
and calculating the number, the average, the sum or the percentage of the at least one service data, and storing the number, the average, the sum or the percentage of the at least one service data as statistical data.
6. The method of claim 1,
after the storing the at least one statistical datum in the memory of the server into the database associated with the server at the first time interval, the method further includes:
and clearing the statistical data stored in the memory of the server.
7. The method of claim 1,
after the storing the at least one statistical datum in the memory of the server into the database associated with the server at the first time interval, the method further includes:
performing statistical calculation on statistical data stored in the database at each first time interval to obtain a first statistical result corresponding to each first time interval;
displaying the first statistical result to the user.
8. The method of claim 7,
after the statistical calculation is performed on the statistical data stored in the database at each first time interval to obtain a first statistical result corresponding to each first time interval, the method further includes:
judging whether a service index corresponding to the service data needs to be alarmed or not;
if yes, judging whether the first statistical result reaches an alarm threshold value;
and when the first statistical result reaches the alarm threshold value, alarming.
9. The method of claim 7,
after the statistical calculation is performed on the statistical data stored in the database at each first time interval to obtain a first statistical result corresponding to each first time interval, the method further includes:
storing the first statistical result according to a time sequence;
performing statistical calculation on the first statistical result stored in a second time interval to obtain a second statistical result;
and displaying the second statistical result to the user.
10. The method of claim 9, further comprising:
acquiring a result query instruction of a user, wherein the result query instruction comprises a display type of a statistical result;
and responding to the result query instruction of the user, and displaying the first statistical result and/or the second statistical result to the user according to the display type of the statistical result.
11. An electronic device, comprising a processor and a memory coupled to the processor,
the memory is for storing program data, and the processor is for executing the program data to implement the method of data statistics of any of claims 1-10.
12. A computer-readable storage medium, in which program data are stored, which program data, when being executed by a processor, are adapted to carry out a method of data statistics according to any one of claims 1-10.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011031679.2A CN112131276A (en) | 2020-09-27 | 2020-09-27 | Data statistics method, electronic equipment and readable storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011031679.2A CN112131276A (en) | 2020-09-27 | 2020-09-27 | Data statistics method, electronic equipment and readable storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN112131276A true CN112131276A (en) | 2020-12-25 |
Family
ID=73839948
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202011031679.2A Pending CN112131276A (en) | 2020-09-27 | 2020-09-27 | Data statistics method, electronic equipment and readable storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112131276A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113778823A (en) * | 2021-08-23 | 2021-12-10 | 杭州安恒信息技术股份有限公司 | WAF equipment running state monitoring method and device and computer storage medium |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101557316A (en) * | 2009-05-14 | 2009-10-14 | 阿里巴巴集团控股有限公司 | Method and system for updating statistical data |
CN103310087A (en) * | 2012-03-16 | 2013-09-18 | 腾讯科技(深圳)有限公司 | Service data statistic analysis method and device |
WO2017133539A1 (en) * | 2016-02-02 | 2017-08-10 | 腾讯科技(深圳)有限公司 | Service data processing method, device and system |
CN107562809A (en) * | 2017-08-10 | 2018-01-09 | 广州视源电子科技股份有限公司 | Business datum statistical method, device, system and readable storage medium storing program for executing |
CN109377391A (en) * | 2018-09-26 | 2019-02-22 | 中国平安人寿保险股份有限公司 | A kind of tracking of information method, storage medium and server |
CN109840262A (en) * | 2018-12-29 | 2019-06-04 | 深圳云天励飞技术有限公司 | Data statistical approach and relevant apparatus |
CN110908886A (en) * | 2019-11-28 | 2020-03-24 | 北京达佳互联信息技术有限公司 | Data sending method and device, electronic equipment and storage medium |
-
2020
- 2020-09-27 CN CN202011031679.2A patent/CN112131276A/en active Pending
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101557316A (en) * | 2009-05-14 | 2009-10-14 | 阿里巴巴集团控股有限公司 | Method and system for updating statistical data |
CN103310087A (en) * | 2012-03-16 | 2013-09-18 | 腾讯科技(深圳)有限公司 | Service data statistic analysis method and device |
WO2017133539A1 (en) * | 2016-02-02 | 2017-08-10 | 腾讯科技(深圳)有限公司 | Service data processing method, device and system |
CN107562809A (en) * | 2017-08-10 | 2018-01-09 | 广州视源电子科技股份有限公司 | Business datum statistical method, device, system and readable storage medium storing program for executing |
CN109377391A (en) * | 2018-09-26 | 2019-02-22 | 中国平安人寿保险股份有限公司 | A kind of tracking of information method, storage medium and server |
CN109840262A (en) * | 2018-12-29 | 2019-06-04 | 深圳云天励飞技术有限公司 | Data statistical approach and relevant apparatus |
CN110908886A (en) * | 2019-11-28 | 2020-03-24 | 北京达佳互联信息技术有限公司 | Data sending method and device, electronic equipment and storage medium |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113778823A (en) * | 2021-08-23 | 2021-12-10 | 杭州安恒信息技术股份有限公司 | WAF equipment running state monitoring method and device and computer storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US20150170070A1 (en) | Method, apparatus, and system for monitoring website | |
CN106548402B (en) | Resource transfer monitoring method and device | |
CN110362455B (en) | Data processing method and data processing device | |
US11635985B2 (en) | Using degree of completeness of real-time data to maximize product revenue | |
CN112311617A (en) | Configured data monitoring and alarming method and system | |
CN110688277A (en) | Data monitoring method and device for micro-service framework | |
CN110609780A (en) | Data monitoring method and device, electronic equipment and storage medium | |
CN110262951A (en) | A kind of business second grade monitoring method and system, storage medium and client | |
CN110807050B (en) | Performance analysis method, device, computer equipment and storage medium | |
CN111339466A (en) | Interface management method and device, electronic equipment and readable storage medium | |
CN111061588A (en) | Method and device for locating database abnormal source | |
CN112131276A (en) | Data statistics method, electronic equipment and readable storage medium | |
US20090037210A1 (en) | System and method for real time monitoring of digital campaigns | |
CN113609409A (en) | Method and system for recommending browsing information, electronic device and storage medium | |
CN110097113B (en) | Method, device and system for monitoring working state of display information delivery system | |
CN107797924B (en) | SQL script abnormity detection method and terminal thereof | |
CN111242428A (en) | Microservice processing method, microservice processing device, microservice processing apparatus, and storage medium | |
CN110020166A (en) | A kind of data analysing method and relevant device | |
CN115185794A (en) | Analysis method and device of service call chain and electronic equipment | |
CN114390015A (en) | Data pushing system, method and equipment based on object model and storage medium | |
CN110633165B (en) | Fault processing method, device, system server and computer readable storage medium | |
CN112764992A (en) | Thread pool monitoring method, device and equipment | |
CN112581150A (en) | Information management method, device, equipment and storage medium | |
WO2018137110A1 (en) | Method for managing internet-of-things device, and server | |
CN115604668B (en) | Short message sending and pushing monitoring method, device, equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |