Method, device, medium and electronic device for collecting C / S client software data
By converting metadata information into Protobuf data structures and uploading them, combined with dynamic compilation and upgrade package mechanisms, it solves the problems of slow data transmission and development requirements caused by software upgrades in the existing technology, and achieves efficient data collection and compatibility. .
Patent Information
- Application Number
- CN202011446072.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-08
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2040-12-08
AI Technical Summary
In the existing technology, when collecting invoice business data through XML data transmission protocol, the data transmission speed is slow and bandwidth is wasted, and the data collection software needs to be redeveloped after the application software database table structure is upgraded.
The Protobuf data structure is used to convert the collected metadata information into binary format messages and uploaded to the server through the server interface. The Protobuf model class library is dynamically compiled to adapt to software version changes, and the upgrade package is downloaded and upgraded when necessary.
It effectively reduces the bandwidth occupied by data transmission, increases the data transmission speed, and avoids the need for redevelopment of acquisition software due to database table structure upgrades.
Smart Images

Figure CN114625369B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a method, device, medium and electronic device for collecting C / S client software data. Background Art
[0002] With the development of information technology, paperless tax information is also developing rapidly. At present, various application software based on invoice data is in the ascendant, so there is an urgent need for effective solutions to automatically collect invoice business data.
[0003] In the related art, data collection software is developed, and the data of each application software is collected by the data collection software. After the application software data is collected, the collected data is usually uploaded to the server through the XML data transmission protocol. However, the data transmission speed of this method is slow and wastes bandwidth. Summary of the invention
[0004] The purpose of the present disclosure is to provide a method, device, medium and electronic device for collecting C / S client software data to solve the problems existing in the related technology.
[0005] In order to achieve the above-mentioned purpose, the first part of the embodiment of the present disclosure provides a method for collecting C / S client software data, the method is applied to collect service plug-ins, the method includes:
[0006] By calling the server interface, uploading the collected data file information of the target C / S client to the server, wherein the data file information includes at least one of the start and end time of the data recording of the target C / S client, the total data volume, and the data volume generated in each cycle;
[0007] Upon receiving the data collection parameters determined by the server according to the data file information, collecting target metadata information from a database of the target C / S client according to the target start and end times in the data collection parameters;
[0008] The collected target metadata information is converted into target data information of a Protobuf data structure corresponding to the Protobuf model class library of the target C / S client, and the target data information of the Protobuf data structure is converted into a binary format message, and the message is uploaded to the server, so that the server stores the target metadata information corresponding to the message in a database of the server.
[0009] Optionally, before uploading the collected data file information of the target C / S client to the server by calling the server interface, the method includes:
[0010] Acquire the identification information of the target C / S client, and search for a corresponding registry according to the identification information of the target C / S client, and determine the installation path information of the target C / S client from the registry;
[0011] The data file information of the target C / S client is obtained according to the installation path information.
[0012] Optionally, before converting the collected target metadata information into target data information of a corresponding Protobuf data structure in a Protobuf model class library of a target C / S client, the method includes:
[0013] Obtaining the software version information of the target C / S client, and determining the software version information of the acquisition service plug-in;
[0014] The software version information of the target C / S client and the software version information of the acquisition service plug-in are uploaded to the server, so that the server determines whether the Protobuf model class library of the target C / S client is dynamically recompiled according to the software version information of the target C / S client and the software version information of the acquisition service plug-in.
[0015] Optionally, the method further comprises:
[0016] Upon receiving an instruction from the server to determine the dynamic recompilation of the Protobuf model class library of the target C / S client, all metadata information in the database of the target C / S client is written into the xxfp.proto file, and the protoc program is called to compile the xxfp.proto file into a model class file in a first format and a model class file in a second format;
[0017] Dynamically compile the model class file in the first format, and if the dynamic compilation of the model class file in the first format is successful, obtain a new Protobuf model class library; and
[0018] The information indicating the success of the dynamic compilation and the model class file in the second format are uploaded to the server, so that when the server stores the target metadata information corresponding to the message into the database of the server, the server parses the message according to the model class file in the second format to obtain the target metadata information corresponding to the message, wherein the information indicating the success of the dynamic compilation is used by the server to determine whether the Protobuf model class library of the target C / S client should be dynamically recompiled the next time the server receives the software version information of the target C / S client and the software version information of the acquisition service plug-in.
[0019] Optionally, the step of converting the collected target metadata information into target data information of a corresponding Protobuf data structure in a Protobuf model class library of a target C / S client includes:
[0020] The collected target metadata information is converted into target data information of the corresponding Protobuf data structure in the new Protobuf model class library.
[0021] Optionally, the method further comprises:
[0022] In the case of failure in dynamic compilation of the model class file in the first format, uploading information indicating the failure of dynamic compilation to the server, and downloading an upgrade package of the acquisition service plug-in from the server, wherein the upgrade package is determined by the server according to the software version information of the target C / S client and the software version information of the acquisition service plug-in, wherein the information indicating the failure of dynamic compilation is used by the server to determine whether to dynamically recompile the Protobuf model class library of the target C / S client when the server receives the software version information of the target C / S client and the software version information of the acquisition service plug-in next time;
[0023] The acquisition service plug-in is upgraded according to the upgrade package, and the acquisition service plug-in is restarted.
[0024] Optionally, the data collection parameters further include a time period for indicating uploading the message and a data volume threshold for uploading the message at a single time;
[0025] The converting the target data information of the Protobuf data structure into a binary format message includes:
[0026] When the data volume of the target data information of the Protobuf data structure is greater than the data volume threshold of the message uploaded in a single time, converting the target data information of the Protobuf data structure into a message sequence including a plurality of messages, wherein the data volume of each message in the message sequence does not exceed the data volume threshold of the message uploaded in a single time;
[0027] The uploading of the message to the server includes:
[0028] During the time period for uploading the message, each message in the message sequence is uploaded in sequence.
[0029] The second part of the embodiment of the present disclosure provides a device for collecting C / S client software data, the device is applied to collect service plug-ins, including:
[0030] A first uploading module is configured to upload the collected data file information of the target C / S client to the server by calling the server interface, wherein the data file information includes at least one of the start and end time of the data recording of the target C / S client, the total data volume, and the data volume generated in each cycle;
[0031] A collection module, configured to collect target metadata information from a database of the target C / S client according to the target start and end time in the data collection parameters when receiving the data collection parameters determined by the server according to the data file information;
[0032] The second uploading module is configured to convert the collected target metadata information into target data information of a Protobuf data structure corresponding to the Protobuf model class library of the target C / S client, and convert the target data information of the Protobuf data structure into a binary format message, and upload the message to the server, so that the server stores the target metadata information corresponding to the message in the database of the server.
[0033] Optionally, the device further comprises:
[0034] A first acquisition module is configured to acquire identification information of the target C / S client, and search a corresponding registry according to the identification information of the target C / S client, and determine installation path information of the target C / S client from the registry;
[0035] The second acquisition module is configured to acquire the data file information of the target C / S client according to the installation path information.
[0036] Optionally, the device further comprises:
[0037] A third acquisition module is configured to acquire the software version information of the target C / S client and determine the software version information of the acquisition service plug-in;
[0038] The second uploading module is configured to upload the software version information of the target C / S client and the software version information of the acquisition service plug-in to the server, so that the server determines whether the Protobuf model class library of the target C / S client is dynamically recompiled according to the software version information of the target C / S client and the software version information of the acquisition service plug-in.
[0039] Optionally, the device further comprises:
[0040] The first compiling module is configured to write all metadata information in the database of the target C / S client into the xxfp.proto file, and call the protoc program to compile the xxfp.proto file into a model class file in a first format and a model class file in a second format, upon receiving an instruction fed back by the server to determine the Protobuf model class library of the target C / S client to be dynamically recompiled;
[0041] A second compiling module is configured to dynamically compile the model class file in the first format, and obtain a new Protobuf model class library when the model class file in the first format is dynamically compiled successfully;
[0042] The third uploading module is configured to upload information indicating the success of the dynamic compilation and the model class file in the second format to the server, so that when the server stores the target metadata information corresponding to the message into the database of the server, the server parses the message according to the model class file in the second format to obtain the target metadata information corresponding to the message, wherein the information indicating the success of the dynamic compilation is used by the server to determine whether the Protobuf model class library of the target C / S client should be dynamically recompiled the next time the software version information of the target C / S client and the software version information of the acquisition service plug-in are received.
[0043] Optionally, the second uploading module is further configured to convert the collected target metadata information into target data information of a corresponding Protobuf data structure in the new Protobuf model library.
[0044] Optionally, the device further comprises:
[0045] A download module, configured to upload information indicating the dynamic compilation failure to the server when the dynamic compilation of the model class file in the first format fails, and download an upgrade package of the acquisition service plug-in from the server, wherein the upgrade package is determined by the server according to the software version information of the target C / S client and the software version information of the acquisition service plug-in, wherein the information indicating the dynamic compilation failure is used by the server to determine whether to dynamically recompile the Protobuf model class library of the target C / S client when the server receives the software version information of the target C / S client and the software version information of the acquisition service plug-in next time;
[0046] The restart module is configured to upgrade the acquisition service plug-in according to the upgrade package and restart the acquisition service plug-in.
[0047] Optionally, the data collection parameters further include a time period for indicating uploading the message and a data volume threshold for uploading the message at a single time;
[0048] The second uploading module comprises:
[0049] a conversion submodule, configured to convert the target data information of the Protobuf data structure into a message sequence including a plurality of messages when the data amount of the target data information of the Protobuf data structure is greater than the data amount threshold of the message uploaded in a single time, wherein the data amount of each message in the message sequence does not exceed the data amount threshold of the message uploaded in a single time;
[0050] The uploading submodule is configured to upload each message in the message sequence in sequence within a time period for uploading the message.
[0051] The third part of the embodiments of the present disclosure provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the steps of any one of the methods described in the first part above are implemented.
[0052] The fourth embodiment of the present disclosure provides an electronic device, including:
[0053] a memory having a computer program stored thereon;
[0054] A processor is used to execute the computer program in the memory to implement the steps of any method described in the first part above.
[0055] By adopting the above technical solution, at least the following technical effects can be achieved:
[0056] The acquisition service plug-in uploads the collected data file information of the target C / S client to the server by calling the server interface. When the data acquisition parameters determined by the server according to the data file information are received, the target metadata information is collected from the database of the target C / S client according to the target start and end time in the data acquisition parameters. The collected target metadata information is converted into the target data information of the corresponding Protobuf data structure in the Protobuf model class library of the target C / S client, and the target data information of the Protobuf data structure is converted into a binary format message, and the message is uploaded to the server so that the server stores the target metadata information corresponding to the message in the database of the server. Since Protobuf (Google Protocol Buffer) is a lightweight and efficient structured data storage format, the collected target metadata information is converted into the target data information of the corresponding Protobuf data structure, which can greatly reduce the byte space occupied by the target data information of the converted Protobuf data structure. Therefore, compared with the related art, the method disclosed in the present invention can effectively reduce bandwidth occupancy and improve the speed of data transmission when uploading data to the server.
[0057] Other features and advantages of the present disclosure will be described in detail in the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS
[0058] The accompanying drawings are used to provide a further understanding of the present disclosure and constitute a part of the specification. Together with the following specific embodiments, they are used to explain the present disclosure but do not constitute a limitation of the present disclosure. In the accompanying drawings:
[0059] Figure 1 The present invention is a flowchart of a method for collecting C / S client software data according to an exemplary embodiment of the present invention.
[0060] Figure 2 The present invention is a roadmap showing another method for collecting C / S client software data according to an exemplary embodiment of the present invention.
[0061] Figure 3 The present invention is a block diagram of a device for collecting C / S client software data according to an exemplary embodiment of the present invention.
[0062] Figure 4 It is a block diagram of an electronic device according to an exemplary embodiment of the present disclosure.
[0063] Figure 5 is a block diagram of another electronic device according to an exemplary embodiment of the present disclosure. DETAILED DESCRIPTION
[0064] The specific implementation of the present disclosure is described in detail below in conjunction with the accompanying drawings. It should be understood that the specific implementation described herein is only used to illustrate and explain the present disclosure, and is not used to limit the present disclosure.
[0065] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0066] In the related art, data collection software is developed, and the data of each application software is collected by the data collection software. After the application software data is collected, the collected data is usually uploaded to the server through the XML data transmission protocol. However, the data transmission speed of this method is slow and wastes bandwidth.
[0067] Furthermore, after the database table structure of the application software is upgraded, the data collection software needs to be redeveloped to collect the data of the upgraded application software.
[0068] In view of this, the embodiments of the present disclosure provide a method, device, medium and electronic device for collecting C / S client software data to solve the problems existing in the related art.
[0069] In order to make it easier for those skilled in the art to understand the technical solutions of the present disclosure, the related technologies involved in the present disclosure are briefly explained below.
[0070] Microsoft Windows Services (or NT Services) enable you to create long-running executable applications in their own Windows session. These services can be started automatically when the computer boots, can be paused and restarted, and do not display any user interface. Such services are ideal for use on servers or any time you need long-running functionality without affecting other users working on the same computer. You can also run services in the security context of a specific user account or the default computer account that is different from the logged-on user.
[0071] Google Protocol Buffer (Protobuf for short) is a hybrid language data standard within Google. Protocol Buffers is a lightweight and efficient structured data storage format that can be used for structured data serialization, or serialization. It is very suitable for data storage or RPC data exchange format. It can be used as a language-independent, platform-independent, and extensible serialized structured data format in the fields of communication protocols and data storage. Currently, APIs in multiple languages such as C++, Java, C#, and Python are provided. Since it is a binary format, it is much faster than using XML for data exchange. That is, the bytes serialized using it take up 3-10 times less space than the bytes processed using XML, and the time efficiency of serialization using it is 20-100 times faster than the XML method.
[0072] Dynamic compilation technology has a more flexible operation mode than static compilation. Users can dynamically compile the written source code files into reusable binary files and store them in memory.
[0073] The technical solution of the present disclosure is described in detail below.
[0074] Figure 1 is a flowchart of a method for collecting C / S client software data according to an exemplary embodiment of the present disclosure, the method is applied to collect service plug-ins, such as Figure 1 As shown, the method includes:
[0075] S11. The collection service plug-in uploads the collected data file information of the target C / S client to the server by calling the server interface, wherein the data file information includes at least one of the data record start and end time, the total data volume, and the data volume generated in each cycle of the target C / S client.
[0076] The acquisition service plug-in is a Windows service program developed in C# based on Microsoft Windows service. The acquisition service plug-in and the target C / S client are hosted on the same terminal device.
[0077] The server is developed in Java language and corresponds to the service end of the collection service plug-in. In other words, the collection service plug-in is the client end corresponding to the server end.
[0078] The data record start and end time refers to the earliest date and the latest date (or the most recent date) of data stored in the database of the target C / S client.
[0079] The total data volume refers to the total amount of all data in the database of the target C / S client.
[0080] The amount of data generated in each cycle refers to the amount of new data stored in the database of the target C / S client in each cycle, such as every day.
[0081] Optionally, before uploading the collected data file information of the target C / S client to the server by calling the server interface, the method includes:
[0082] The identification information of the target C / S client is obtained, and a corresponding registry is searched according to the identification information of the target C / S client, and the installation path information of the target C / S client is determined from the registry; the data file information of the target C / S client is obtained according to the installation path information.
[0083] Specifically, the acquisition service plug-in obtains the identification information of the target C / S client, searches the corresponding registry according to the identification information of the target C / S client, and determines the installation path information of the target C / S client from the registry. The data file information of the target C / S client is obtained according to the installation path information. The acquisition service plug-in uploads the data file information to the server.
[0084] After receiving the data file information uploaded by the acquisition service plug-in, the server can determine the data not stored by the server according to the data record start and end time, total data volume, data volume generated in each cycle and the data of the target C / S client stored in the database of the server. The server generates data acquisition parameters based on the unstored data and feeds the generated data acquisition parameters back to the acquisition service plug-in.
[0085] S12: upon receiving the data collection parameters determined by the server according to the data file information, collecting target metadata information from the database of the target C / S client according to the target start and end times in the data collection parameters.
[0086] Among them, the target start and end time refers to the start and end time corresponding to the target C / S client's database storage of the collected data. It should be understood that when the target start and end time is the same as the target C / S client's data record start and end time, it indicates that the full amount of data of the target C / S client needs to be collected, that is, all the data in the target C / S client's database needs to be collected. When the time interval corresponding to the target start and end time is a subset of the time interval corresponding to the target C / S client's data record start and end time, it indicates that the incremental data of the target C / S client needs to be collected, that is, some data that exists in the target C / S client's database but does not exist in the server needs to be collected.
[0087] Specifically, after the collection service plug-in receives the data collection parameters determined by the server according to the data file information, the collection service plug-in collects the target metadata information from the database of the target C / S client according to the target start and end time in the data collection parameters.
[0088] S13, converting the collected target metadata information into target data information of a corresponding Protobuf data structure in a Protobuf model class library of a target C / S client, and converting the target data information of the Protobuf data structure into a binary format message, and uploading the message to the server, so that the server stores the target metadata information corresponding to the message in a database of the server.
[0089] The Protobuf model class library of the target C / S client is a pre-compiled dll file stored on the terminal device where the target C / S client is located.
[0090] Optionally, after the collection service plug-in converts the target data information of the Protobuf data structure into a binary format message, before uploading the message to the server, the collection service plug-in can further compress the message using the compression algorithm Gzip, and can also perform RSA asymmetric encryption on the compressed message, and use the private key of the collection service plug-in to perform SHA1 signature on the encrypted message. This method can ensure the security of the message uploaded by the collection service plug-in to the server.
[0091] Optionally, the collection service plug-in can upload the message to the server using http post.
[0092] In detail, the collection service plug-in converts the target metadata information collected from the database of the target C / S client into the target data information of the corresponding Protobuf data structure in the Protobuf model class library of the target C / S client, and converts the target data information of the Protobuf data structure into a binary format message, and uploads the message to the server.
[0093] After receiving the message, the server can store the target metadata information corresponding to the message into the server's database, thus completing the data collection process for the target C / S client.
[0094] By adopting this method, the acquisition service plug-in uploads the collected data file information of the target C / S client to the server by calling the server interface. When receiving the data acquisition parameters determined by the server according to the data file information, the target metadata information is collected from the database of the target C / S client according to the target start and end time in the data acquisition parameters. The collected target metadata information is converted into the target data information of the corresponding Protobuf data structure in the Protobuf model class library of the target C / S client, and the target data information of the Protobuf data structure is converted into a binary format message, and the message is uploaded to the server so that the server stores the target metadata information corresponding to the message in the database of the server. Since Protobuf (Google Protocol Buffer) is a lightweight and efficient structured data storage format, the collected target metadata information is converted into the target data information of the corresponding Protobuf data structure, which can greatly reduce the byte space occupied by the target data information of the converted Protobuf data structure. Therefore, compared with the related art, the method disclosed in the present invention can effectively reduce bandwidth occupancy and improve the speed of data transmission when uploading data to the server.
[0095] Optionally, before converting the collected target metadata information into target data information of a corresponding Protobuf data structure in a Protobuf model class library of a target C / S client, the following steps are included:
[0096] Obtain the software version information of the target C / S client and determine the software version information of the acquisition service plug-in; upload the software version information of the target C / S client and the software version information of the acquisition service plug-in to the server, so that the server determines whether the Protobuf model class library of the target C / S client is dynamically recompiled according to the software version information of the target C / S client and the software version information of the acquisition service plug-in.
[0097] The acquisition service plug-in obtains the software version information of the target C / S client and determines its own software version information. The acquisition service plug-in uploads the software version information of the target C / S client and its own software version information to the server.
[0098] After the server receives the software version information of the target C / S client uploaded by the acquisition service plug-in and its own software version information, the server determines whether the Protobuf model class library of the target C / S client should be dynamically recompiled based on the software version information of the target C / S client and the software version information of the acquisition service plug-in.
[0099] Specifically, if the server determines that the current version of the acquisition service plug-in has successfully compiled the database data of the current version of the target C / S client, it is determined that the Protobuf model class library of the target C / S client does not need to be dynamically compiled again. If the server determines that the current version of the acquisition service plug-in has not been successfully compiled or has not compiled the database data of the current version of the target C / S client, it is determined that the Protobuf model class library of the current version of the target C / S client needs to be dynamically compiled again.
[0100] After determining whether the Protobuf model class library of the target C / S client is to be recompiled dynamically, the server feeds back an instruction of whether the Protobuf model class library of the target C / S client is to be recompiled dynamically to the collection service plug-in.
[0101] Optionally, when the acquisition service plug-in receives the instruction fed back by the server to determine the Protobuf model class library of the target C / S client to be re-dynamically compiled, the acquisition service plug-in performs the following steps:
[0102] All metadata information in the database of the target C / S client is written into the xxfp.proto file, and the protoc program is called to compile the xxfp.proto file into a model class file in a first format and a model class file in a second format; the model class file in the first format is dynamically compiled, and when the dynamic compilation of the model class file in the first format is successful, a new Protobuf model class library is obtained; and information indicating the success of the dynamic compilation and the model class file in the second format are uploaded to the server, so that when the server stores the target metadata information corresponding to the message in the database of the server, the server parses the message according to the model class file in the second format to obtain the target metadata information corresponding to the message, wherein the information indicating the success of the dynamic compilation is used by the server to determine whether the Protobuf model class library of the target C / S client should be re-compiled dynamically when the software version information of the target C / S client and the software version information of the acquisition service plug-in are received next time.
[0103] The first format is a format corresponding to the development language of the acquisition service plug-in, that is, it can be C# format. The second format is a format corresponding to the development language of the server, that is, it can be Java format.
[0104] It is easy to understand that the information indicating the success of the dynamic compilation is used for the server to determine whether the Protobuf model library of the target C / S client should be dynamically recompiled when the server receives the software version information of the target C / S client and the software version information of the acquisition service plug-in next time.
[0105] For example, when the acquisition service plug-in receives the instruction of re-dynamically compiling the Protobuf model class library of the target C / S client fed back by the server, it writes the xxfp.proto file according to all metadata information in the database of the target C / S client, and calls the protoc program to compile the xxfp.proto file into a model class file in C# format and a model class file in Java format. The acquisition service plug-in stores the model class file in C# format and the model class file in Java format in the local disk.
[0106] Furthermore, the acquisition service plug-in dynamically compiles the model class file in C# format. When the dynamic compilation of the model class file in C# format is successful, a new Protobuf model class library can be obtained. The acquisition service plug-in stores the new Protobuf model class library in the local disk. In a possible implementation, the acquisition service plug-in can also delete the original Protobuf model class library, thereby retaining only the new Protobuf model class library.
[0107] Furthermore, the collection service plug-in uploads the information indicating the success of the dynamic compilation and the model class file in Java format to the server.
[0108] After receiving the model class file in Java format uploaded by the collection service plug-in, the server can dynamically compile the model class file in Java format and update the Protobuf model class library stored on the server. In this way, the server can parse the message uploaded by the collection service plug-in according to the updated Protobuf model class library, thereby obtaining and storing the target metadata information corresponding to the message.
[0109] Optionally, the step of converting the collected target metadata information into target data information of a corresponding Protobuf data structure in a Protobuf model class library of a target C / S client includes:
[0110] The collected target metadata information is converted into target data information of the corresponding Protobuf data structure in the new Protobuf model class library.
[0111] It is not difficult to understand that after the collection service plug-in updates the Protobuf model class library, when the collection service plug-in converts the collected target metadata information into the target data information of the corresponding Protobuf data structure in the Protobuf model class library, it converts the collected target metadata information into the target data information of the corresponding Protobuf data structure in the updated Protobuf model class library.
[0112] Optionally, when the acquisition service plug-in fails to dynamically compile the model class file in the first format, the acquisition service plug-in performs the following steps:
[0113] The acquisition service plug-in uploads information indicating the failure of dynamic compilation to the server, and downloads an upgrade package of the acquisition service plug-in from the server, wherein the upgrade package is determined by the server based on the software version information of the target C / S client and the software version information of the acquisition service plug-in, wherein the information indicating the failure of dynamic compilation is used by the server to determine whether to dynamically recompile the Protobuf model class library of the target C / S client the next time the server receives the software version information of the target C / S client and the software version information of the acquisition service plug-in; the acquisition service plug-in is upgraded according to the upgrade package, and the acquisition service plug-in is restarted.
[0114] It is easy to understand that the information characterizing the dynamic compilation failure is used by the server to determine whether the Protobuf model class library of the target C / S client needs to be dynamically recompiled when the server receives the software version information of the target C / S client and the software version information of the acquisition service plug-in next time.
[0115] Among them, the failure of the acquisition service plug-in to dynamically compile the model class file in the first format may be caused by the current version of the acquisition service plug-in being unable to compile the data in the database table structure of the current version of the target C / S client. Therefore, a feasible implementation method is that when the acquisition service plug-in fails to dynamically compile the model class file in the first format, the acquisition service plug-in will upload information representing the failure of the dynamic compilation to the server.
[0116] After receiving the information uploaded by the acquisition service plug-in indicating the failure of its dynamic compilation, the server determines the upgrade package of the acquisition service plug-in according to the current software version information of the target C / S client and the current software version information of the acquisition service plug-in, and feeds the upgrade package back to the acquisition service plug-in.
[0117] The collection service plug-in downloads the upgrade package of the collection service plug-in from the server, and automatically upgrades the collection service plug-in according to the upgrade package. After the upgrade is completed, the collection service plug-in is restarted and the software data of the target C / S client is restarted, that is, the above technical solution of the present disclosure is re-executed.
[0118] Optionally, the data collection parameters further include a time period for indicating uploading the message and a data volume threshold for uploading the message at a single time; the collection service plug-in converts the target data information of the Protobuf data structure into a binary format message, including:
[0119] When the data volume of the target data information of the Protobuf data structure is greater than the data volume threshold of the message uploaded in a single time, the target data information of the Protobuf data structure is converted into a message sequence including multiple messages, and the data volume of each message in the message sequence does not exceed the data volume threshold of the message uploaded in a single time.
[0120] Accordingly, the collection service plug-in uploads the message to the server, including:
[0121] During the time period for uploading the message, each message in the message sequence is uploaded in sequence.
[0122] In a feasible implementation manner, when the data volume of the target data information of the Protobuf data structure is greater than the data volume threshold of a single uploaded message, the collection service plug-in converts the target data information of the Protobuf data structure into a message sequence corresponding to multiple messages, wherein the data volume of each message in the message sequence does not exceed the data volume threshold of a single uploaded message. During the time period of uploading the message, the collection service plug-in sequentially uploads each message in the message sequence to the server.
[0123] Optionally, when the collection service plug-in uploads any message in the message sequence, if the upload times out, the message is stored in a local temporary file and waits for the next upload.
[0124] After receiving the message uploaded by the collection service plug-in, the server puts the message into the message queue, and the consumers of the message queue perform SHA1 signature verification on the messages in the queue in turn. If the verification is successful, the message is decompressed, and the target data information of the decompressed Protobuf data structure is deserialized according to the model class file in the second format to obtain the corresponding target metadata information, and the obtained target metadata information is saved in the server database. If the signature verification is unsuccessful, the message is discarded.
[0125] Figure 2 FIG. 1 is a roadmap of another method for collecting C / S client software data according to an exemplary embodiment of the present disclosure, such as Figure 2 As shown, the following steps are included:
[0126] S201, the collection service plug-in obtains the identification information of the target C / S client, searches for the corresponding registry according to the identification information of the target C / S client, and determines the installation path information of the target C / S client from the registry;
[0127] S202, the collection service plug-in obtains the data file information of the target C / S client according to the installation path information;
[0128] S203, the collection service plug-in calls the server interface to upload the collected data file information of the target C / S client to the server;
[0129] S204, the server receives the data file information, determines data collection parameters according to the data file information, and feeds back the data collection parameters to the collection service plug-in;
[0130] S205, the collection service plug-in receives the data collection parameters;
[0131] S206, the acquisition service plug-in obtains the software version information of the target C / S client, and determines the software version information of the acquisition service plug-in;
[0132] S207, the acquisition service plug-in uploads the software version information of the target C / S client and the software version information of the acquisition service plug-in to the server;
[0133] S208, the server determines whether the Protobuf model class library of the target C / S client needs to be dynamically recompiled according to the received software version information of the target C / S client and the software version information of the acquisition service plug-in;
[0134] S209, the server sends an instruction to the acquisition service plug-in indicating whether the Protobuf model class library of the target C / S client needs to be dynamically recompiled;
[0135] S210, when the acquisition service plug-in receives the instruction from the server that the Protobuf model class library of the target C / S client needs to be dynamically recompiled, all metadata information in the database of the target C / S client is written into the xxfp.proto file, and the protoc program is called to compile the xxfp.proto file into a model class file in the first format and a model class file in the second format;
[0136] S211, the acquisition service plug-in dynamically compiles the model class file in the first format, and when the dynamic compilation of the model class file in the first format is successful, a new Protobuf model class library is obtained;
[0137] S212, the acquisition service plug-in uploads the information indicating the success of the dynamic compilation and the model class file in the second format to the server;
[0138] S213, the server receives and stores the information indicating the success of the dynamic compilation and the model class file in the second format;
[0139] S214, the collection service plug-in collects target metadata information from the database of the target C / S client according to the data collection parameters;
[0140] S215, the acquisition service plug-in converts the collected target metadata information into target data information of the corresponding Protobuf data structure in the new Protobuf model library, and converts the target data information of the Protobuf data structure into a binary format message, and uploads the message to the server;
[0141] S216, the server receives the message, and parses the message according to the model class file in the second format to obtain the target metadata information corresponding to the message;
[0142] S217: The server stores the target metadata information in a database of the server.
[0143] Regarding the steps in the above embodiment, the specific implementation of each step has been described in detail in the embodiment of the method, and will not be elaborated here.
[0144] Figure 3 is a block diagram of a device for collecting C / S client software data according to an exemplary embodiment of the present disclosure, such as Figure 3 As shown, the device 300 includes:
[0145] The first uploading module 310 is configured to upload the collected data file information of the target C / S client to the server by calling the server interface, wherein the data file information includes at least one of the data recording start and end time, the total data volume, and the data volume generated in each cycle of the target C / S client;
[0146] The collection module 320 is configured to collect target metadata information from the database of the target C / S client according to the target start and end time in the data collection parameters when receiving the data collection parameters determined by the server according to the data file information;
[0147] The second uploading module 330 is configured to convert the collected target metadata information into target data information of a Protobuf data structure corresponding to the Protobuf model class library of the target C / S client, and convert the target data information of the Protobuf data structure into a binary format message, and upload the message to the server, so that the server stores the target metadata information corresponding to the message in the database of the server.
[0148] With this device, the acquisition service plug-in uploads the collected data file information of the target C / S client to the server by calling the server interface. When the data acquisition parameters determined by the server according to the data file information are received, the target metadata information is collected from the database of the target C / S client according to the target start and end time in the data acquisition parameters. The collected target metadata information is converted into the target data information of the corresponding Protobuf data structure in the Protobuf model class library of the target C / S client, and the target data information of the Protobuf data structure is converted into a message in binary format, and the message is uploaded to the server so that the server stores the target metadata information corresponding to the message in the database of the server. Since Protobuf (Google Protocol Buffer) is a lightweight and efficient structured data storage format, the collected target metadata information is converted into the target data information of the corresponding Protobuf data structure, which can greatly reduce the byte space occupied by the target data information of the converted Protobuf data structure. Therefore, compared with the relevant technology, this method can effectively reduce bandwidth occupancy and improve the speed of data transmission when uploading data to the server.
[0149] Optionally, the device 300 further includes:
[0150] A first acquisition module is configured to acquire identification information of the target C / S client, and search a corresponding registry according to the identification information of the target C / S client, and determine installation path information of the target C / S client from the registry;
[0151] The second acquisition module is configured to acquire the data file information of the target C / S client according to the installation path information.
[0152] Optionally, the device 300 further includes:
[0153] A third acquisition module is configured to acquire the software version information of the target C / S client and determine the software version information of the acquisition service plug-in;
[0154] The second uploading module is configured to upload the software version information of the target C / S client and the software version information of the acquisition service plug-in to the server, so that the server determines whether the Protobuf model class library of the target C / S client is dynamically recompiled according to the software version information of the target C / S client and the software version information of the acquisition service plug-in.
[0155] Optionally, the device 300 further includes:
[0156] The first compiling module is configured to write all metadata information in the database of the target C / S client into the xxfp.proto file, and call the protoc program to compile the xxfp.proto file into a model class file in a first format and a model class file in a second format, upon receiving an instruction fed back by the server to determine the Protobuf model class library of the target C / S client to be dynamically recompiled;
[0157] A second compiling module is configured to dynamically compile the model class file in the first format, and obtain a new Protobuf model class library when the model class file in the first format is dynamically compiled successfully;
[0158] The third uploading module is configured to upload information indicating the success of the dynamic compilation and the model class file in the second format to the server, so that when the server stores the target metadata information corresponding to the message into the database of the server, the server parses the message according to the model class file in the second format to obtain the target metadata information corresponding to the message, wherein the information indicating the success of the dynamic compilation is used by the server to determine whether the Protobuf model class library of the target C / S client should be dynamically recompiled the next time the software version information of the target C / S client and the software version information of the acquisition service plug-in are received.
[0159] Optionally, the second uploading module is further configured to convert the collected target metadata information into target data information of a corresponding Protobuf data structure in the new Protobuf model library.
[0160] Optionally, the device 300 further includes:
[0161] A download module, configured to upload information indicating the dynamic compilation failure to the server when the dynamic compilation of the model class file in the first format fails, and download an upgrade package of the acquisition service plug-in from the server, wherein the upgrade package is determined by the server according to the software version information of the target C / S client and the software version information of the acquisition service plug-in, wherein the information indicating the dynamic compilation failure is used by the server to determine whether to dynamically recompile the Protobuf model class library of the target C / S client when the server receives the software version information of the target C / S client and the software version information of the acquisition service plug-in next time;
[0162] The restart module is configured to upgrade the acquisition service plug-in according to the upgrade package and restart the acquisition service plug-in.
[0163] Optionally, the data collection parameters further include a time period for indicating uploading the message and a data volume threshold for uploading the message at a single time;
[0164] The second uploading module comprises:
[0165] a conversion submodule, configured to convert the target data information of the Protobuf data structure into a message sequence including a plurality of messages when the data amount of the target data information of the Protobuf data structure is greater than the data amount threshold of the message uploaded in a single time, wherein the data amount of each message in the message sequence does not exceed the data amount threshold of the message uploaded in a single time;
[0166] The uploading submodule is configured to upload each message in the message sequence in sequence within a time period for uploading the message.
[0167] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0168] Figure 4 FIG. 7 is a block diagram of an electronic device 700 according to an exemplary embodiment of the present disclosure. Figure 4 As shown, the electronic device 700 may include: a processor 701 and a memory 702. The electronic device 700 may also include one or more of a multimedia component 703, an input / output (I / O) interface 704, and a communication component 705.
[0169] The processor 701 is used to control the overall operation of the electronic device 700 to complete all or part of the steps in the above-mentioned method for collecting C / S client software data. The memory 702 is used to store various types of data to support the operation of the electronic device 700, and these data may include instructions for any application or method used to operate on the electronic device 700, and application-related data, such as contact data, sent and received messages, pictures, audio, video, etc. The memory 702 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (Static Random Access Memory, referred to as SRAM), electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory, referred to as EEPROM), erasable programmable read-only memory (Erasable Programmable Read-Only Memory, referred to as EPROM), programmable read-only memory (Programmable Read-Only Memory, referred to as PROM), read-only memory (Read-Only Memory, referred to as ROM), magnetic memory, flash memory, magnetic disk or optical disk. The multimedia component 703 may include a screen and an audio component. The screen may be, for example, a touch screen, and the audio component is used to output and / or input audio signals. For example, the audio component may include a microphone for receiving external audio signals. The received audio signal may be further stored in the memory 702 or sent through the communication component 705. The audio component also includes at least one speaker for outputting audio signals. The I / O interface 704 provides an interface between the processor 701 and other interface modules, and the other interface modules may be keyboards, mice, buttons, etc. These buttons may be virtual buttons or physical buttons. The communication component 705 is used for wired or wireless communication between the electronic device 700 and other devices. Wireless communication, such as Wi-Fi, Bluetooth, Near Field Communication (NFC), 2G, 3G, 4G, NB-IOT, eMTC, or other 5G, etc., or a combination of one or more of them, is not limited here. Therefore, the corresponding communication component 705 may include: Wi-Fi module, Bluetooth module, NFC module, etc.
[0170] In an exemplary embodiment, the electronic device 700 can be implemented by one or more application specific integrated circuits (ASIC), digital signal processors (DSP), digital signal processing devices (DSPD), programmable logic devices (PLD), field programmable gate arrays (FPGA), controllers, microcontrollers, microprocessors or other electronic components to execute the above-mentioned method for collecting C / S client software data.
[0171] In another exemplary embodiment, a computer-readable storage medium including program instructions is also provided, and when the program instructions are executed by a processor, the steps of the method for collecting C / S client software data are implemented. For example, the computer-readable storage medium can be the memory 702 including the program instructions, and the program instructions can be executed by the processor 701 of the electronic device 700 to complete the method for collecting C / S client software data.
[0172] Figure 5 1 is a block diagram of an electronic device 1900 according to an exemplary embodiment. For example, the electronic device 1900 may be provided as a server. Figure 5 The electronic device 1900 includes a processor 1922, which may be one or more, and a memory 1932 for storing a computer program executable by the processor 1922. The computer program stored in the memory 1932 may include one or more modules each corresponding to a set of instructions. In addition, the processor 1922 may be configured to execute the computer program to perform the above-mentioned Figure 2 Execute steps on the server side.
[0173] In addition, the electronic device 1900 may further include a power supply component 1926 and a communication component 1950. The power supply component 1926 may be configured to perform power management of the electronic device 1900, and the communication component 1950 may be configured to implement communication of the electronic device 1900, for example, wired or wireless communication. In addition, the electronic device 1900 may further include an input / output (I / O) interface 1958. The electronic device 1900 may operate based on an operating system stored in the memory 1932, such as Windows Server 2003. TM , Mac OS X TM , UnixTM , Linux TM etc.
[0174] In another exemplary embodiment, a computer-readable storage medium including program instructions is also provided, and when the program instructions are executed by a processor, the above-mentioned Figure 2 For example, the computer-readable storage medium may be the memory 1932 including the program instructions, and the program instructions may be executed by the processor 1922 of the electronic device 1900 to complete the above-mentioned Figure 2 The server executes the steps.
[0175] In another exemplary embodiment, a computer program product is also provided, which includes a computer program that can be executed by a programmable device, and the computer program has a code portion for executing the above-mentioned method for collecting C / S client software data when executed by the programmable device.
[0176] The preferred embodiments of the present disclosure are described in detail above in conjunction with the accompanying drawings; however, the present disclosure is not limited to the specific details in the above embodiments. Within the technical concept of the present disclosure, a variety of simple modifications can be made to the technical solution of the present disclosure, and these simple modifications all fall within the protection scope of the present disclosure.
[0177] It should also be noted that the various specific technical features described in the above specific embodiments can be combined in any suitable manner without contradiction. In order to avoid unnecessary repetition, the present disclosure will not further describe various possible combinations.
[0178] In addition, various embodiments of the present disclosure may be arbitrarily combined, and as long as they do not violate the concept of the present disclosure, they should also be regarded as the contents disclosed by the present disclosure.
Claims
1. A method for collecting C / S client software data, characterized in that: The method is applied to a collection service plug-in, and the method comprises: The collection service plug-in uploads the collected data file information of the target C / S client to the server by calling the server interface, wherein the data file information includes at least one of the start and end time of the data record of the target C / S client, the total data volume, and the data volume generated in each cycle; Upon receiving the data collection parameters determined by the server according to the data file information, collecting target metadata information from a database of the target C / S client according to the target start and end times in the data collection parameters; The collected target metadata information is converted into target data information of a Protobuf data structure corresponding to the Protobuf model class library of the target C / S client, and the target data information of the Protobuf data structure is converted into a binary format message, and the message is uploaded to the server, so that the server stores the target metadata information corresponding to the message in a database of the server.
2. The method according to claim 1, characterized in that Before uploading the collected data file information of the target C / S client to the server by calling the server interface, it includes: Acquire the identification information of the target C / S client, and search for a corresponding registry according to the identification information of the target C / S client, and determine the installation path information of the target C / S client from the registry; The data file information of the target C / S client is obtained according to the installation path information.
3. The method according to claim 1, characterized in that Before converting the collected target metadata information into target data information of a corresponding Protobuf data structure in a Protobuf model class library of a target C / S client, the method includes: Obtaining the software version information of the target C / S client, and determining the software version information of the acquisition service plug-in; The software version information of the target C / S client and the software version information of the acquisition service plug-in are uploaded to the server, so that the server determines whether the Protobuf model class library of the target C / S client is dynamically recompiled according to the software version information of the target C / S client and the software version information of the acquisition service plug-in.
4. The method according to claim 3, characterized in that The method further comprises: Upon receiving an instruction from the server to determine the dynamic recompilation of the Protobuf model class library of the target C / S client, all metadata information in the database of the target C / S client is written into the xxfp.proto file, and the protoc program is called to compile the xxfp.proto file into a model class file in a first format and a model class file in a second format; Dynamically compile the model class file in the first format, and if the dynamic compilation of the model class file in the first format is successful, obtain a new Protobuf model class library; and The information indicating the success of the dynamic compilation and the model class file in the second format are uploaded to the server, so that when the server stores the target metadata information corresponding to the message into the database of the server, the server parses the message according to the model class file in the second format to obtain the target metadata information corresponding to the message, wherein the information indicating the success of the dynamic compilation is used by the server to determine whether the Protobuf model class library of the target C / S client should be dynamically recompiled the next time the server receives the software version information of the target C / S client and the software version information of the acquisition service plug-in.
5. The method according to claim 4, characterized in that The step of converting the collected target metadata information into target data information of a corresponding Protobuf data structure in a Protobuf model class library of a target C / S client includes: The collected target metadata information is converted into target data information of the corresponding Protobuf data structure in the new Protobuf model class library.
6. The method according to claim 4, characterized in that The method further comprises: In the case of failure in dynamic compilation of the model class file in the first format, uploading information indicating the failure of dynamic compilation to the server, and downloading an upgrade package of the acquisition service plug-in from the server, wherein the upgrade package is determined by the server according to the software version information of the target C / S client and the software version information of the acquisition service plug-in, wherein the information indicating the failure of dynamic compilation is used by the server to determine whether to dynamically recompile the Protobuf model class library of the target C / S client when the server receives the software version information of the target C / S client and the software version information of the acquisition service plug-in next time; The acquisition service plug-in is upgraded according to the upgrade package, and the acquisition service plug-in is restarted.
7. The method according to any one of claims 1 to 6, characterized in that The data collection parameters also include a time period for uploading the message and a data volume threshold for uploading the message at a single time; The converting the target data information of the Protobuf data structure into a binary format message includes: When the data volume of the target data information of the Protobuf data structure is greater than the data volume threshold of the message uploaded in a single time, converting the target data information of the Protobuf data structure into a message sequence including a plurality of messages, wherein the data volume of each message in the message sequence does not exceed the data volume threshold of the message uploaded in a single time; The uploading of the message to the server includes: During the time period for uploading the message, each message in the message sequence is uploaded in sequence.
8. A device for collecting C / S client software data, characterized in that: The device is applied to a collection service plug-in, and includes: The first uploading module is configured to upload the collected data file information of the target C / S client to the server by calling the server interface of the collection service plug-in, wherein the data file information includes at least one of the start and end time of the data record of the target C / S client, the total data volume, and the data volume generated in each cycle; A collection module, configured to collect target metadata information from a database of the target C / S client according to the target start and end time in the data collection parameters when receiving the data collection parameters determined by the server according to the data file information; The second uploading module is configured to convert the collected target metadata information into target data information of a Protobuf data structure corresponding to the Protobuf model class library of the target C / S client, and convert the target data information of the Protobuf data structure into a binary format message, and upload the message to the server, so that the server stores the target metadata information corresponding to the message in the database of the server.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the method described in any one of claims 1 to 7 are implemented.
10. An electronic device, characterized in that: include: a memory having a computer program stored thereon; A processor, configured to execute the computer program in the memory to implement the steps of the method according to any one of claims 1 to 7.
