Operation recording method and system, electronic equipment, storage medium and product
By parsing the annotations and input parameters of the target business method in a distributed system to generate operation records in a unified format, the problem of inconsistent operation record formats across different microservices is solved, achieving efficient and unified management of operation records across services and reducing system maintenance costs.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- CHINA CONSTRUCTION BANK
- Filing Date
- 2025-12-25
- Publication Date
- 2026-04-10
Smart Images

Figure CN121833402A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] Embodiments of the present application relate to the technical field of computer, and particularly relate to an operation record method and system, an electronic device, a storage medium and a product. BACKGROUND
[0002] With the continuous deepening of informatization, enterprise business processes increasingly rely on information systems, and the importance of operation records gradually emerges. In order to meet the audit needs and clarify the operation responsibility, the system needs to provide perfect operation record function. These operation records not only can clearly show the behavior track of the operator in the system, but also can provide strong data support for enterprise management and decision-making, and improve the transparency and controllability of system operation.
[0003] The operation record of the system is usually in the form of operation log, and the forms of operation logs of different systems may be different. With the popularity of distributed systems, the system architecture becomes more complex, and a system is usually composed of multiple microservices, so the cross-service management of operation records has become an inevitable trend. However, since the forms of operation logs defined by different microservices may be different, the cross-service management of operation records is difficult. SUMMARY
[0004] Embodiments of the present application provide an operation record method and system, an electronic device, a storage medium and a product, which can use the proxy end to unify the operation record formats of different microservices in the same distributed system, and solve the problem of cross-service management of operation records.
[0005] To achieve the above purpose, embodiments of the present application adopt the following technical solutions: In a first aspect, an operation record method is provided, applied to an operation record system, the operation record system comprising a server and a plurality of proxy ends, the plurality of proxy ends being respectively deployed on a plurality of microservices of a same distributed system; the method comprising: The proxy end receives a target operation input by an operator, the target operation being used to operate a target input parameter; the proxy end calls a target business method in response to the target operation, and obtains operator information of the operator; the target business method is a business method marked with a target annotation; the proxy end determines first metadata information, a target field and a field value corresponding to the target field according to the target business method, the target annotation and the target input parameter; the first metadata information is used to indicate an operation object and an operation type of the target operation, and the target field corresponds to the target input parameter; the proxy end generates a first operation record according to the operator information, the first metadata information, the target field and the field value corresponding to the target field; and the proxy end reports the first operation record to the server.
[0006] In the scheme, since the target business method needs to record the operation record of the operator, the target annotation is marked on the target business method, and the target field corresponding to the target input parameter of the operator operation, the operation of the target input parameter of the target method by the operator through any micro service in the distributed system will be parsed by the proxy end corresponding to the micro service to generate the same format of the first operation record, which solves the problem of cross-service management of operation records. At the same time, since the multiple proxy ends are respectively deployed on multiple micro services in the same distributed system, the proxy end can directly capture the operation record of the operator on the corresponding micro service without cross-service calling, which is more suitable for the dispersion characteristics of the micro service in the distributed system, and effectively improves the generation efficiency of the first operation record.
[0007] In a possible implementation manner of the first aspect, the proxy end determines the first metadata information, the target field, and the field value corresponding to the target field according to the target business method, the target annotation, and the target input parameter, including: the proxy end parses the target annotation marked on the target business method to obtain the first metadata information; the proxy end parses the annotation of the parameter in the target business method to obtain the field mapping rule between the input parameter and the field of the target business method; and the proxy end determines the target field according to the field mapping rule and the target input parameter, and determines the parameter value of the target input parameter as the field value of the target field.
[0008] In the scheme, the proxy end corresponding to each micro service obtains the first metadata information by parsing the target annotation, ensures the uniform definition of the operation object and operation type of different micro services, obtains the field mapping rule by parsing the parameter annotation of the target business method, accurately associates the target input parameter and the target field, and ensures the consistency of the target field extracted by the operator in the operation record of different micro services. Thus, the operation record format is avoided to be chaotic due to the development difference of different micro services, the parameter operated by the operator is accurately converted to the target field through the field mapping rule, the data in the operation record is ensured to correspond to the operation content, the cross-micro service operation record aggregated by the server is finally standardized and unified, and the problem of cross-service management of operation records is solved.
[0009] In a possible implementation manner of the first aspect, the proxy end reports the first operation record to the server, including: the proxy end reports the first operation record according to the reporting mode marked in the target annotation; and the reporting mode is synchronous real-time reporting or asynchronous non-real-time reporting.
[0010] In the scheme, by marking the reporting mode in the target annotation, the reporting mode of the operation record of different micro services is unified, which is convenient for unified management, and additional development of reporting strategies suitable for different micro services is not required, thereby reducing the maintenance cost of the distributed system. At the same time, since the synchronous real-time reporting and the asynchronous non-real-time reporting can adapt to different system requirements, the adaptability of the scheme is enhanced.
[0011] In a possible implementation of the first aspect, the operation recording method provided in the first aspect of the present application further includes: receiving, by the server, the first operation record; determining, by the server, a target operation record snapshot according to the business data in the first operation record, and storing the operator information and the first metadata information in the first operation record in association with the target operation record snapshot in the database; the business data in the first operation record refers to a target field and a field value corresponding to the target field.
[0012] In this solution, after the server receives the first operation record, the server generates a target operation record snapshot according to the first operation record, and stores the operator information and the first metadata information in the first operation record in association with the target operation record snapshot in the database, so as to facilitate the manager to trace and analyze the operation record of the operator. At the same time, since the operation records corresponding to different agent ends are all processed by the server, the computing overhead of the agent end in the distributed system is reduced, and the overall performance of the distributed system is effectively improved.
[0013] In a possible implementation of the first aspect, the server determines the target operation record snapshot according to the business data in the first operation record, including: the server converts the business data in the first operation record into a first operation record snapshot; the server determines, according to the first metadata information, whether there is a second operation record snapshot with the same metadata information as the first metadata information in the database; the database stores historical operation record snapshots, as well as operator information and metadata information corresponding to the historical operation record snapshots; if there is the second operation record snapshot, the server combines the first operation record snapshot and the second operation record snapshot to obtain the target operation record snapshot.
[0014] In this solution, the server combines the first operation record snapshot and the second operation record snapshot to generate the target operation record snapshot, which not only avoids repeated storage of the same operation record and saves the storage space of the database, but also completely retains the operation record of the operator for the target business method, facilitating the manager to trace.
[0015] In a possible implementation manner of the first aspect, the merging of the first operation record snapshot and the second operation record snapshot to obtain the target operation record snapshot comprises: comparing target fields in the first operation record snapshot with target fields in the second operation record snapshot to obtain first target fields and second target fields; the first target fields refer to target fields in the first operation record snapshot that are the same as the target fields in the second operation record snapshot, and the second target fields refer to target fields in the first operation record snapshot that are not the same as the target fields in the second operation record snapshot; for the first target fields, comparing field values of the first target fields in the first operation record snapshot and the second operation record snapshot; if the field values of the first target fields in the first operation record snapshot and the second operation record snapshot are not the same, taking the field value of the first target field in the first operation record snapshot as the field value of the first target field in the target operation record snapshot; and for the second target fields, taking the field value of the second target field in the first operation record snapshot as the field value of the second target field in the target operation record snapshot.
[0016] In the scheme, the first operation record snapshot and the second operation record snapshot are compared according to the target fields, the first target fields with the same target fields take the corresponding field values in the first operation record snapshot, and the second target fields newly added in the first operation record snapshot are directly reserved, which not only avoids repeated storage of the same operation and saves the storage space of the database, but also ensures that the target record snapshot can completely record the operation of the operator on the target business method, and facilitates the manager to trace back.
[0017] In a possible implementation manner of the first aspect, the comparison of whether the field values of the first target fields in the first operation record snapshot and the second operation record snapshot are same includes: converting the first operation record snapshot and the second operation record snapshot into a first json object and a second json object in a json format respectively; and for each first target field, using the following method to determine whether the field values of the first target field in the first json object and the second json object are same: if the field value of the first target field is an array of key-value pairs, comparing the key values of corresponding keys in the field values of the first target field in the first json object and the second json object according to a preset key order, and if the key values of all the keys are same, determining that the field values of the first target field in the first json object and the second json object are same; if there is a key whose key values are different, determining that the field values of the first target field in the first json object and the second json object are different; if the field value of the first target field is a splicing array, comparing whether the splicing arrays of the first target field in the first json object and the second json object are same, and if the splicing arrays are same, determining that the field values of the first target field in the first json object and the second json object are same; if the splicing arrays are different, determining that the field values of the first target field in the first json object and the second json object are different; if the field value of the first target field is a single value, comparing whether the single values of the first target field in the first json object and the second json object are same, and if the single values are same, determining that the field values of the first target field in the first json object and the second json object are same; if the single values are different, determining that the field values of the first target field in the first json object and the second json object are different.
[0018] In the scheme, after the first operation record snapshot and the second operation record snapshot are converted into the first json object and the second json object respectively, different comparison strategies are set for different types of field values of the target fields, so as to ensure the accuracy of the determination result of whether the field values are same and avoid the deviation of the merging of the first operation record snapshot and the second operation record snapshot caused by the complex data format of the field values.
[0019] In a second aspect, an operation record system is provided, which includes: a server and at least one agent, and the multiple agents are respectively deployed on multiple microservices of the same distributed system. The agent includes a target operation receiving module, an operator information obtaining module, an operation information obtaining module, an operation record generating module and an operation record reporting module. The target operation receiving module is configured to receive a target operation input by an operator, and the target operation is used to operate a target input parameter. An operator information obtaining module is configured to obtain operator information of an operator according to a target service method invoked by the first device in response to the target operation; and the target service method is a service method marked with a target annotation. An operation information obtaining module is configured to determine first metadata information, a target field, and a field value corresponding to the target field according to the target service method, the target annotation, and a target input parameter; the first metadata information is used to indicate an operation object of the target operation, and the target field corresponds to the target input parameter. An operation record generating module is configured to generate a first operation record according to the operator information, the first metadata information, the target field, and the field value corresponding to the target field. An operation record reporting module is configured to report the first operation record to a server.
[0020] In a third aspect, an electronic device is provided, and the electronic device includes a memory and at least one processor. The memory is in communication with the processor. The memory is configured to store computer program code including computer instructions. When the processor executes the computer instructions, the electronic device performs the method according to the first aspect and any possible implementation manner thereof.
[0021] In a fourth aspect, a computer readable storage medium is provided, and the computer readable storage medium stores computer instructions. When the computer instructions are executed by a processor, the computer instructions are used to implement the method according to the first aspect and any possible implementation manner thereof.
[0022] In a fifth aspect, a computer program product is provided, and when the computer program product is run on a computer / executed by a processor of the computer, the computer program product implements the method according to the first aspect and any possible implementation manner thereof. The computer can be the electronic device according to the third aspect and any possible implementation manner thereof.
[0023] It can be understood that the beneficial effects achieved by the operation record device according to the second aspect, the electronic device according to the third aspect, the computer readable storage medium according to the fourth aspect, and the computer program product according to the fifth aspect can refer to the beneficial effects according to the first aspect and any possible implementation manner thereof, and details are not repeated here. BRIEF DESCRIPTION OF DRAWINGS
[0024] Figure 1 A scene architecture schematic diagram of an operation record method according to an embodiment of the present application is provided. Figure 2 A flowchart of an operation record method according to an embodiment of the present application is provided. Figure 3 A flowchart of a data reporting method according to an embodiment of the present application is provided. Figure 4 A flowchart illustrating a data receiving method provided in an embodiment of this application; Figure 5 A flowchart illustrating a method for determining a target operation record snapshot provided in an embodiment of this application; Figure 6 A flowchart illustrating a data import method provided in an embodiment of this application; Figure 7 A flowchart illustrating a field value comparison method provided in an embodiment of this application; Figure 8 This is a schematic diagram of the structure of an operation recording system provided in an embodiment of this application; Figure 9 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0025] Hereinafter, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this embodiment, unless otherwise stated, "a plurality of" means two or more.
[0026] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.
[0027] The technical solutions provided in this application, including the collection, storage, use, processing, transmission, provision, and disclosure of financial data or operator data, comply with relevant laws and regulations and do not violate public order and good morals.
[0028] It should be noted that in the embodiments of this application, certain software, components, models and other existing solutions in the industry may be mentioned. These should be regarded as exemplary and are only intended to illustrate the feasibility of implementing the technical solution of this application. However, it does not mean that the applicant has used or necessarily used the solution.
[0029] With the deepening of informatization, enterprise business processes increasingly rely on information systems, and the importance of operation records is gradually highlighted. In order to meet the audit needs and clarify the operation responsibility, the business system of the enterprise needs to provide perfect operation record function. Operation record not only can clearly show the behavior track of the operator in the system, but also can provide strong data support for enterprise management and decision-making, and improve the transparency and controllability of system operation.
[0030] In recent years, information security incidents such as hacker attacks and data leaks have occurred frequently, causing serious threats to the reputation and economic interests of enterprises. In order to cope with these challenges, enterprises have increased the supervision of operators' operations. By recording operation records, business systems can timely detect abnormal behavior, locate potential threats, and quickly take countermeasures. At the same time, operation records can also meet the compliance requirements and provide reliable basis for security audit and event tracing.
[0031] Specifically, operation records have the following functions: First, operation records are an important means to meet legal and regulatory compliance requirements. For example, the financial industry may need to record all key operations of operators to meet audit requirements. Second, when a security incident (such as data leakage or unauthorized access) occurs, operation records can be used to trace the behavior of operators, locate the source of the problem, and help take remedial measures. Third, operation records can be used as evidence to prevent or detect malicious tampering of data. Fourth, when the business system has problems (such as data anomalies or function failures), operation records can help the development and operation team analyze whether the operator's operation is the source of the problem. Fifth, by analyzing the frequency and pattern of operator operations, the performance of the business system can be optimized; for example, identifying high-frequency operation points and adjusting the resource allocation of the business system accordingly. Sixth, after recording the operations of operators, statistical analysis of operation data can be performed to help enterprises understand the behavior habits of operators and optimize operator experience and business function design. Seventh, by accumulating operator operation data through operation records, data support can be provided for precision marketing, etc. Eighth, by recording the key operations (such as deleting or modifying data) of each operator, the operation responsibility can be clearly defined in the event of a problem, preventing problems caused by improper operations from being left unattended. Ninth, by regularly checking operation records, abnormal behavior such as unauthorized access or operation can be discovered and handled. Tenth, some businesses require operation records. For example, in the approval process, it is necessary to check who, when, and what operations were performed. Eleventh, analyzing operation records can help identify inefficiencies in business processes and improve business system and business process design, etc.
[0032] Currently, a common operation record can include operator information of an operator, an operation object operated by the operator, a target type operated by the operator, business data operated by the operator, an operation result operated by the operator, and the like. Specifically, the operator information of the operator can include a time of operation of the operator, an identity of the operator such as a user identifier (ID), a name of the operator, an organization to which the operator belongs, and the like. The operation object operated by the operator is used to indicate that the operation of the operator is directed to a specific business process, for example, a business system of an enterprise is an audit system, and the operation object of the operator can be a user (auditor) maintenance in the audit process. The specific operation type can be adding a user or deleting a user, and the like. The business data operated by the operator is specific user information such as a user ID and a user name, and the like.
[0033] With the popularity of distributed systems and Internet applications, the architecture of a business system becomes more complex, and the traditional single node cannot meet the needs of modern applications. Therefore, at present, a business system is usually composed of multiple microservices (or service nodes). By using distributed log management technology, the recorded operation record can cover each microservice in this complex architecture, helping enterprises to build a global user behavior view.
[0034] However, because the formats of the operation records specified by different microservices constituting a business system can be different (for example, for operator information, some microservices specify using an operator ID to represent operator information, and some microservices specify using an operator name to represent operator information), the cross-service management of operation records is difficult.
[0035] The development of cloud computing, big data, and artificial intelligence technologies further broadens the application scenarios of operation records, enabling them to evolve from simple security management tools to important foundations for business optimization and user behavior analysis. Through the mining of operation record data, enterprises can gain a deep understanding of user behavior patterns, optimize product design and user experience, improve system performance, and predict business trends, thereby providing important support for digital transformation.
[0036] At the same time, the widespread adoption of microservices, containerization, and serverless architecture makes cross-service and cross-platform unified management of log records an inevitable trend. This unified log management mechanism not only improves operational efficiency, but also provides comprehensive support for business process optimization, security control, and sustainable development of the system through data linkage, further strengthening the security, maintainability, and scalability of enterprise information systems.
[0037] To solve the above problems, the embodiments of the present application provide an operation record method, system, electronic device, storage medium and product. The operation record method provided by the embodiments of the present application can be executed by an operation record system. The computing unit of the operation record system can be a server cluster composed of multiple servers of an enterprise, or a single server, or a computer, or a processor or processing chip in the server or computer, etc. The embodiments of the present application do not limit the form of the operation record system.
[0038] In an exemplary embodiment, the present application also provides a scenario architecture diagram of an operation record method, as shown in Figure 1 The scenario architecture diagram of the operation record method specifically includes: multiple microservices 101, multiple agent ends 102, a central operation and maintenance service 103, a server end 104, a database 105 and a front-end component 106.
[0039] The business methods deployed on the multiple microservices 101 and the central operation and maintenance service 103 cooperatively implement the business of the enterprise. For example, the multiple microservices 101 include a user management and control system (UMCS), a workflow management and control system (WFMCS), an eXtended management and service center (XMSC) and a cloud operation and yield management system (CYZT). The central operation and maintenance service 103 can be an operations management and control system (OPSMCS). It should be noted that the introduction of the microservice here is only an example, and the application scenario of the present application scheme is not limited thereto.
[0040] The number of the agent ends 102 is the same as the number of the microservices, and one agent end is deployed on each microservice. The agent end is used to generate operation records of the operations of an operator on the corresponding microservice. The server end 104 is deployed on the central operation and maintenance service 103.
[0041] The operation record system mentioned in the present application can include the multiple agent ends 101 and the server end 104.
[0042] The agent end 102 receives a target operation input by the operator, and the target operation is used to operate a target input parameter. Secondly, the agent end 102 responds to a target business method of the target operation call to obtain operator information of an operator; the target business method is a business method marked with a target annotation; Thirdly, the agent end 102 determines first metadata information, a target field and a field value corresponding to the target field according to the target business method, the target annotation and the target input parameter; the first metadata information is used to indicate an operation object and an operation type of the target operation, and the target field corresponds to the target input parameter; Fourthly, the agent end 102 generates a first operation record according to the operator information, the first metadata information, the target field and the field value corresponding to the target field; Then, the agent end 102 reports the first operation record generated above to the server end 104.
[0043] The agent end 102 can report the first operation record generated by itself to the server end 104 in a synchronous real-time reporting mode or an asynchronous non-real-time reporting mode. It should be noted that the reporting modes for different micro services can be different. Specifically, the agent end 102 can report the first operation record to the server end 104 in an asynchronous non-real-time reporting mode through a Remote Dictionary Server (Redis) component or a Message Queue (MQ) component.
[0044] After the server end 104 receives the first operation record, the server end 104 determines a target operation record snapshot according to business data in the first operation record, and stores the operator information and the first metadata information in the first operation record in association with the target operation record snapshot in the database 105; the business data in the first operation record refers to the target field and the field value corresponding to the target field.
[0045] The front-end component 106 can be a component used by an operator who views operation records. The operator who views operation records can view the target operation record snapshot in the database 105 through the front-end component 106. For example, the front-end component 106 can view the target operation record snapshot in the database 105 through the central operation and maintenance service 103. The central operation and maintenance service 103 can include an Application Programming Interface (API) required for the front-end component 106 to display content.
[0046] In this embodiment, the method of collecting operation records through the aforementioned agent-server model can be referred to as the Agent-Server model. The operation records in this embodiment can also be called user operation records, without specific limitations. It is understood that the Agent-Server model provided in this embodiment combines the advantages of distributed collection and centralized processing, reducing the pressure on the central service while improving the efficiency of data transmission and processing, and simultaneously ensuring the scalability, reliability, and security of the system. This model is very suitable for distributed application scenarios that require processing large-scale data, such as monitoring systems, logging systems, and business analysis systems. Of course, this is merely an example; the operation recording method provided in this embodiment is not limited to these application scenarios, and the solution provided in this application is applicable to all scenarios requiring operation record collection.
[0047] In one embodiment, Figure 2 This is a flowchart illustrating an operation recording method provided in an embodiment of this application. Figure 2 As shown, this method is applied to an operation logging system, which includes a server and multiple proxy servers. The multiple proxy servers are deployed on multiple microservices within the same distributed system. The method includes: S201, the agent receives the target operation input by the operator.
[0048] In some embodiments, the proxy can be a self-running software entity capable of being aware of its environment, executing tasks, and communicating with the server. The proxy can be a software entity running within a microservice. The proxy can interact with the server via APIs or message queues to exchange requests and results.
[0049] A server-side component can provide services, handle requests from proxy clients, and return results. It can store and manage global data, perform complex calculations, and handle business logic. The server can receive requests from proxy clients, parse the data, and return a response. Microservices can break down an application into multiple independent, autonomous units, each of which can be deployed, scaled, and maintained independently. Business methods, or business functions, can be deployed on microservices to provide functionality to users.
[0050] Operators (or users) can perform operations on the business methods of microservices, such as target operations, and the corresponding agent of the microservice can receive the target operations.
[0051] The target operation can be a specific action performed by the operator, which may include actions taken in response to the operating environment and information. For example, the target operation could be a user logging into a microservice, a user data supplementation operation within a specific business function of the microservice, or a user data confirmation operation within the microservice.
[0052] The target input parameter can be input data inputted when an interface or a method is called, and used to drive business logic processing.
[0053] In some embodiments, an operator operates a business method deployed by a microservice through an input component of the microservice. The specific operation performed by the operator on the business method deployed by the microservice is a target operation. Taking a method of adding a user deployed in a microservice as an example, the target operation performed by the operator can be a user ID, a user name, and the like of the user to be added inputted by the operator through the input component of the corresponding microservice. The user ID and the user name are target input parameters of the method of adding a user.
[0054] In some embodiments, the agent end can be deployed on the corresponding microservice in the form of a jar package (Java Archive, a software package based on a ZIP format), and locate a target business method that needs to be recorded through aspect-oriented programming technology or bytecode enhancement technology, and read an annotation in the target business method through a reflection mechanism in the aspect-oriented programming technology or the bytecode enhancement technology.
[0055] S202, the agent end calls the target business method in response to the target operation, and obtains operator information of the operator.
[0056] The target business method is a business method annotated with a target annotation.
[0057] In some embodiments, a business method can be a specific operation process or a specific means to achieve a business goal, and an annotation can be data used to mark a specific function or object in a business method.
[0058] The target annotation can be a specific identifier used to annotate a business method. For example, the target annotation can be a unique identifier (Record ID, RID).
[0059] The operator information can be identification information to which the operator belongs. For example, the operator information can include a user identifier, an organization identifier, a tenant identifier, and the like. The organization identifier can be an identifier of an organization to which a user belongs, and the tenant identifier can be a unique identifier used to identify a tenant (an organization or a user).
[0060] In one possible implementation, the agent end can call the target business method in response to the target operation, and obtain the operator information of the operator.
[0061] For example, in combination with the foregoing Figure 3As shown, S201 can include S301 and S302. For example, S301 intercepts the business method containing the target annotation in the case where the target operation calls the business method with the target annotation; and S302 obtains the operator information of the operator. For example, the user identifier, organization identifier, tenant identifier, and the like of the current user are obtained.
[0062] Specifically, first, the agent end can obtain the mapping relationship between the annotation and the user identifier. Second, the agent end can determine the user identifier (uid, User Identification) corresponding to the operator according to the mapping relationship and the target annotation. Finally, the agent end can determine the identifier (orgid, Organization Identifier) of the organization to which the user belongs and the unique identifier (ptid, Product Type Identification) for identifying the user or the organization according to the user identifier.
[0063] S203, the agent end determines the first metadata information, the target field, and the field value corresponding to the target field according to the target business method, the target annotation, and the target input parameter.
[0064] The first metadata information is used to indicate the operation object and the operation type of the target operation. The target field corresponds to the target input parameter.
[0065] In some embodiments, the first metadata information can be information about the organization of data, data fields, and their relationships in the agent end. The first metadata information is used to indicate the operation object and the operation type of the target operation.
[0066] The operation object of the target operation can be the target of the record operation impact, for example, a data record or a module.
[0067] The operation type of the target operation can be the specific operation type of the operation performed by the operator, for example, a login operation, an addition operation, a deletion operation, a modification operation, a query operation, and the like.
[0068] The target field can be a specific field of the business data. For example, the target field can be various ids in the case where a certain business data includes various ids and values corresponding to the ids.
[0069] The field value corresponding to the target field can be a specific field value of the business data. For example, the target field value can be the value corresponding to each id in the case where a certain business data includes various ids and values corresponding to the ids.
[0070] In one possible implementation, the agent end can determine the first metadata information, the target field, and the field value corresponding to the target field according to the target business method, the target annotation, and the target input parameter.
[0071] In a possible implementation, the agent end can parse the target annotation marked by the target business method to obtain the first metadata information.
[0072] Specifically, the agent end can obtain the respective annotations corresponding to the respective parameters, and the respective return values corresponding to the respective annotations. The agent end can parse the target annotation marked by the target business method to obtain the return value corresponding to the target annotation, which can include an operation object and an operation type. The agent end can determine the target annotation, the operation object, and the operation type as the first metadata information.
[0073] In a possible implementation, the agent end can parse the target annotation marked by the target business method to obtain an operation object and an operation type matched with the target annotation. The agent end can splice the target annotation, the operation object, and the operation type according to a preset data splicing manner to obtain the first metadata information.
[0074] In a possible implementation, the agent end can parse the annotation of the parameter in the target business method to obtain a field mapping rule between the parameters and the fields of the target business method. The agent end can determine a target field according to the field mapping rule and the target parameter, and determine the parameter value of the target parameter as the field value of the target field.
[0075] The parameter can be a virtual variable used when a function is defined in programming, for receiving an actual parameter (argument) passed in when the function is called. The parameter can also be a declared parameter when the function is defined. It can be understood that the parameter and the argument can represent different expressions of the same concept.
[0076] The annotation of the parameter can be used to indicate a field mapping rule between the parameters and the fields included in the business method.
[0077] The mapping rule between the parameters and the fields can represent a mapping rule between the parameters and the fields in the business.
[0078] For example, the field mapping rule between the parameters and the fields can include a simple field mapping rule, a dictionary field mapping rule, and a nested object mapping rule. The agent end can parse the annotation of the parameter in the target business method to obtain the simple field mapping rule, the dictionary field mapping rule, and the nested object mapping rule.
[0079] The simple field mapping rule can be that, for a name type parameter, the field corresponding to the parameter includes a username and a real name. For example, the simple field mapping rule includes that the parameter of the new personnel entity class is converted into the real name field realName. For another example, the simple field mapping rule can also include that the parameter of the modified personnel entity class is converted into the username field userName and the real name field realName.
[0080] The dictionary field mapping rule can be that, for the input parameter of the certificate type, the field corresponding to the input parameter includes the identification type. For example, the dictionary field mapping rule includes that the input parameter of the certificate type is converted into the identification type idType and the identification type field idTypeName attribute.
[0081] The nested object mapping rule can be that, for the input parameter of the nested object type, the field corresponding to the input parameter includes the organization identification, the organization name, the post identification, the post name, and the combination relationship between the fields. For example, the nested object mapping rule includes that the input parameter of the nested object is converted into the organization identification, the organization name, the post identification, and the post name.
[0082] For example, the agent end can determine the target rule corresponding to the target input parameter in the simple field mapping rule, the dictionary field mapping rule, and the nested object mapping rule. The agent end determines the target field based on the target rule and the target input parameter, and determines the input parameter value of the target input parameter as the field value of the target field.
[0083] For example, in the case where the target rule corresponding to the target input parameter is the nested object mapping rule, the agent end can obtain the field value of the target field according to the combination relationship between the fields in the nested object mapping rule, the target field, and the input parameter value of the target input parameter. The obtained field value of the target field contains the combination relationship (data nesting relationship) between the target fields. The combination relationship between the target fields can be “housing bureau one (post one, post two)” or “housing bureau two (post three)”. The combination relationship can represent the arrangement relationship between the housing bureau one, the housing bureau two, the post one, and the post two, and the setting position of the symbol, etc.
[0084] In one possible implementation, S201, in the case where the target operation calls a business method marked with a target annotation, the business method containing the target annotation is intercepted; S202, the operator information of the operator is obtained, that is, the user identification, the organization identification, the tenant identification, etc. of the current user are obtained.
[0085] Continue to combine Figure 3 As shown in the figure, S203, the agent end determines the first metadata information, the target field, and the field value corresponding to the target field according to the target business method, the target annotation, and the target input parameter. S203 specifically includes: S303, the target annotation and the target input parameter are obtained.
[0086] S304, the target annotation marked by the target business method is parsed to obtain the first metadata information.
[0087] S305, the field mapping rule corresponding to the target input parameter is returned.
[0088] S306, Based on the field mapping rules and the target input parameters, determine the target field corresponding to the target input parameters.
[0089] Each microservice's corresponding proxy obtains primary metadata information by parsing target annotations, ensuring consistent definitions of operation objects and operation types across different microservices. It also obtains field mapping rules by parsing target business method parameter annotations, ensuring precise association between target inputs and target fields. This guarantees consistency in target field extraction across operation records for different microservices. This avoids formatting issues caused by development differences between microservices and ensures accurate conversion between operator inputs and target fields through field mapping rules, guaranteeing that data in operation records accurately corresponds to the operation content. Ultimately, this standardizes and unifies cross-microservice operation records aggregated on the server side, resolving the difficulty of cross-service operation record management.
[0090] S204, the agent generates the first operation record based on the operator information, the first metadata information, the target field and the field value corresponding to the target field.
[0091] In some implementations, the first operation record can be a record whose data format conforms to the server's data reception format. The first operation record can also be information obtained by encapsulating operator information, first metadata information, the target field, and the field values corresponding to the target field.
[0092] In one possible implementation, the agent can concatenate the operator information, the first metadata information, the target field and the field value corresponding to the target field according to a preset data assembly method to obtain the first operation record.
[0093] For example, in combination Figure 3 As shown, S204 includes: S307, generating a new snapshot field based on the current user information, the first metadata information, the target field and the field value corresponding to the target field.
[0094] The operator information includes the current user information. The first operation record can be a snapshot-style field.
[0095] S205, the agent reports the first operation record to the server.
[0096] In one possible implementation, the proxy could directly report the first operation record to the server.
[0097] In one possible implementation, the proxy can also upload the first operation record to a remote dictionary server component, or to a message queue component. The first operation record is then forwarded to the server via either the remote dictionary server component or the message queue component.
[0098] In a possible implementation, the agent end reports the first operation record according to a reporting mode marked in the target annotation. The reporting mode is synchronous real-time reporting or asynchronous non-real-time reporting.
[0099] The synchronous real-time reporting can mean that the agent end sends the first operation record to the server immediately after obtaining the first operation record, and waits for a response from the server before continuing execution (next reporting or other data processing procedures).
[0100] The synchronous real-time reporting has the advantages of high data real-time performance and strong data consistency.
[0101] The high data real-time performance can mean: fast response to business needs; real-time uploaded data can be immediately used for analysis, display or event processing, suitable for scenarios that require immediate feedback, such as real-time monitoring and alarm systems. The high data real-time performance can also mean: timely detection of abnormalities; through real-time reporting, the system can quickly capture and locate abnormal operations or security threats, and shorten the problem response time.
[0102] The strong data consistency can mean: immediate confirmation and processing; the server returns the processing result immediately after receiving the data, ensuring the completeness and accuracy of data upload. The strong data consistency can also mean: early detection of faults; if the upload fails (such as network problems or server failure), the agent end can immediately perceive it for quick processing.
[0103] The asynchronous non-real-time reporting can mean that the agent end caches or processes the first operation record locally first, and then sends it to the server in batches according to a certain strategy. The data upload and collection are not directly coupled.
[0104] The asynchronous non-real-time reporting has the advantages of small impact on system performance and improved system fault tolerance.
[0105] The small impact on system performance can mean: reducing the blocking of main processes; the agent end can continue to process subsequent tasks without waiting for the server response, reducing the impact of reporting on the performance of the business system. The small impact on system performance can also mean: batch processing optimization transmission; batch uploading reduces communication times and network overhead, suitable for scenarios with large amounts of data.
[0106] The improved system fault tolerance can mean: breakpoint resume; the local caching mechanism allows data to be temporarily stored when the network is interrupted or the server is unavailable, and the data is uploaded again after recovery, avoiding data loss. The improved system fault tolerance can also mean: smooth peak traffic; delayed uploading during traffic peaks can avoid overload and improve system stability.
[0107] Exemplarily, in a case that the reporting manner marked in the target annotation is synchronous real-time reporting, the agent end can report the first operation record after generating the first operation record, and in a case that the agent end receives a response message of the first operation record, perform next data reporting. In a case that the reporting manner marked in the target annotation is asynchronous non-real-time reporting, the agent end can delay reporting the first operation record.
[0108] Exemplarily, a scene with high requirements for data real-time performance and consistency can use a synchronous real-time interface, and a scene with lower requirements for real-time performance but higher requirements for performance and stability can use an asynchronous non-real-time interface. The agent end can report the first operation record according to the reporting manner marked in the target annotation (i.e., a manner corresponding to the synchronous real-time interface or the asynchronous real-time interface).
[0109] In one possible implementation, for a case of reporting the operation record by the synchronous real-time reporting manner, the agent end can encapsulate the first operation record according to a preset encapsulation manner, and then send a message corresponding to the encapsulated first operation record to the server. The preset encapsulation manner can include Http (Hypertext Transfer Protocol, HyperText Transfer Protocol) message encapsulation, Https (Hypertext Transfer Protocol Secure, HyperText Transfer Protocol Secure) message encapsulation, etc. Exemplarily, taking the Http message encapsulation manner as an example, the Http request includes a request line, a request header, and a request body. The agent end can encapsulate the first operation record as the request body and the identifier of the agent end as the request header to obtain an encapsulated message, and the agent end can send the encapsulated message to the server.
[0110] Exemplarily, continuing to combine Figure 3 As shown in FIG. 5, S205, the agent end reports the first operation record to the server, specifically including: S308, data reporting. Specifically, the data reporting can actually be that the agent end reports the first operation record to the server.
[0111] By marking the reporting manner in the target annotation, not only can the reporting manner of the operation record of different microservices be unified for unified management, but also there is no need to additionally develop a reporting strategy adapted to different microservices, thereby reducing the maintenance cost of the distributed system. Meanwhile, since the synchronous real-time reporting and the asynchronous non-real-time reporting can adapt to different system requirements, the adaptability of the scheme is enhanced.
[0112] In the embodiment, since the target business method needs to record the operation record of the operator, the target annotation is marked on the target business method, and the target parameter operated by the operator corresponds to the target field, therefore, the operation of the target parameter of the target method by the operator through any microservice in the distributed system will be parsed by the proxy corresponding to the microservice to generate the first operation record in the same format, solving the problem of cross-service management of operation records. At the same time, since the multiple proxy ends are respectively deployed on multiple microservices in the same distributed system, the proxy end can directly capture the operation record of the operator on the corresponding microservice without cross-service calling, which is more suitable for the dispersion characteristics of the microservice in the distributed system, and effectively improves the generation efficiency of the first operation record.
[0113] After the proxy end reports the operation record such as the first operation record to the service end, the service end can receive and store the operation record. The following will be introduced in combination with Figure 4 and Figure 5 .
[0114] In one embodiment, as shown in Figure 4 , the method comprises the following steps S401-S402.
[0115] S401, the service end receives the first operation record.
[0116] S402, the service end determines the target operation record snapshot according to the business data in the first operation record, and stores the operator information and the first metadata information in the first operation record in association with the target operation record snapshot in the database.
[0117] Among them, the business data in the first operation record refers to the target field and the field value corresponding to the target field.
[0118] In some embodiments, the target operation record snapshot can be a data snapshot containing the target operation. The data snapshot can be used for data backup and recovery of the data of the target operation.
[0119] The target operation record snapshot can be stored in the form of a table. It can be understood that the target operation record snapshot can be a table containing the target field and the field value corresponding to the target field.
[0120] In one possible implementation, the service end can receive the first operation record from the proxy end. The service end can determine the target operation record snapshot according to the business data in the first operation record. The service end can store the operation information and the first metadata information in the first record in association with the target operation record snapshot in the database.
[0121] In one possible implementation, the service end can associate and store the first metadata information and the operator information with the target operation record snapshot in the database in sequence.
[0122] In one possible implementation, as shown in Figure 5 The server in S402 determines the target operation record snapshot according to the service data in the first operation record, specifically including: S501, the server converts the service data in the first operation record into the first operation record snapshot.
[0123] The first operation record snapshot can be a data snapshot generated according to the service data.
[0124] S502, the server determines whether there is a second operation record snapshot with the same first metadata information as the first metadata information in the database according to the first metadata information.
[0125] The database stores historical operation record snapshots, as well as operator information and metadata information corresponding to the historical operation record snapshots.
[0126] The second operation record snapshot can be a data snapshot corresponding to the first operation record snapshot with the same first metadata information.
[0127] S503, if there is a second operation record snapshot, the server merges the first operation record snapshot and the second operation record snapshot to obtain the target operation record snapshot.
[0128] The historical operation record snapshot can be a data snapshot that has been stored in the database, and the historical operation record snapshot corresponds to operator information and metadata information.
[0129] If there is a second operation record snapshot, it means that there is a historical snapshot of the first operation record snapshot in the database. Conversely, if there is no second operation record snapshot, it means that there is no historical snapshot of the first operation record snapshot in the database.
[0130] Specifically, the server can obtain multiple historical operation record snapshots in the database, as well as operator information and metadata information corresponding to each historical operation record snapshot. The server can filter the second operation record snapshot with the same metadata information as the first metadata information from the historical operation record snapshots. The server can merge the first operation record snapshot and the second operation record snapshot to obtain the target operation record snapshot.
[0131] Specifically, as shown in Figure 6 The flowchart of the data warehousing method, specifically including: S601, querying the latest operation record snapshot according to record_id and modular_id; The first metadata information in the first operation record includes identification information record_id and module code modular_id.
[0132] Specifically, in the case that the server receives the first operation record (http request or consumption queue), it can be determined according to the record_id and modular_id whether there is a second operation record snapshot in the latest operation record snapshot that has the same metadata information as the first metadata information.
[0133] S602, whether the second operation record snapshot is queried; If the second operation record snapshot is queried, S603 is executed, and if the second operation record snapshot is not queried, S604 is executed.
[0134] S603, in the first operation record snapshot and the second operation record snapshot, the fields to be compared are compared and merged into the target operation record snapshot; S604, data is stored in the database.
[0135] Specifically, in the case that the second operation record snapshot is not queried, the server can determine the target operation record snapshot according to the business data in the first operation record, and store the operator information and the first metadata information in the first operation record in association with the target operation record snapshot in the database.
[0136] Specifically, in the case that the second operation record snapshot is queried, the first operation record snapshot and the second operation record snapshot can be merged to obtain the target operation record snapshot. The server can store the target operation record snapshot in the database.
[0137] The server merges the first operation record snapshot and the second operation record snapshot to generate the target operation record snapshot, which not only avoids repeated storage of the same operation record and saves the storage space of the database, but also completely retains the operation record of the operator for the target business method, which is convenient for managers to trace.
[0138] In a possible implementation, the merging of the first operation record snapshot and the second operation record snapshot to obtain the target operation record snapshot includes: comparing target fields in the first operation record snapshot with target fields in the second operation record snapshot to obtain first target fields and second target fields; the first target fields refer to target fields in the first operation record snapshot that are the same as the target fields in the second operation record snapshot, and the second target fields refer to target fields in the first operation record snapshot that are not the same as the target fields in the second operation record snapshot. For the first target fields, the server compares field values of the first target fields in the first operation record snapshot and the second operation record snapshot; if the field values of the first target fields in the first operation record snapshot and the second operation record snapshot are not the same, the server sets the field value of the first target field in the first operation record snapshot as the field value of the first target field in the target operation record snapshot. For the second target fields, the server sets the field value of the second target field in the first operation record snapshot as the field value of the second target field in the target operation record snapshot.
[0139] The first operation record snapshot is shown in the following Table 1.
[0140] Table 1: First operation record snapshot table
[0141] The second operation record snapshot can be shown in the following Table 2.
[0142] Table 2: Second operation record snapshot table
[0143] Specifically, the first target fields can be target fields in the first operation record snapshot that are the same as the target fields in the second operation record snapshot, i.e., is_useful. The second target fields can be target fields in the first operation record snapshot that are not the same as the target fields in the second operation record snapshot, i.e., ext_attr.
[0144] Specifically, for the first target fields, the server can compare field values of the first target fields in the first operation record snapshot and the second operation record snapshot. If the field values of the first target fields in the first operation record snapshot and the second operation record snapshot are not the same, the server sets the field value of the first target field in the first operation record snapshot (the field value "0" of the field "is_useful") as the field value of the first target field in the target operation record snapshot.
[0145] Specifically, for the second target fields, the server sets the field value of the second target field in the first operation record snapshot (the field value "Zhang Sanfeng" of the field "ext_attr") as the field value of the second target field in the target operation record snapshot.
[0146] The target operation record snapshot is shown in the following table 3.
[0147] Table 3 Target operation record snapshot table
[0148] The field value of the first target field is_useful in the target operation record snapshot is 0, and the field value of the second target field ext_attr is Zhang Sanfeng.
[0149] Further, the server can store the operator information (zhangsan, Zhang San, Housing Bureau) in the first operation record, the first metadata information (record_id, not shown in the table), and the target operation record snapshot in the database in association. For example, the full table stored in the database is shown in the following table 4.
[0150] Table 4 Full table
[0151] The full table includes operator information, first metadata information, and target operation record snapshot.
[0152] According to the comparison of the first operation record snapshot and the second operation record snapshot according to the target field, the first target field with the same target field takes the corresponding field value in the first operation record snapshot, and the second target field newly added in the first operation record snapshot is directly retained, which not only avoids repeated storage of the same operation and saves the storage space of the database, but also ensures that the target record snapshot can completely record the operation of the operator on the target business method, and facilitates the manager to trace back.
[0153] In a possible implementation, the comparison of whether the field values of the first target fields in the first operation record snapshot and the second operation record snapshot are same includes: converting the first operation record snapshot and the second operation record snapshot into json formats respectively to obtain a first json object and a second json object. For each first target field, the following method is used to determine whether the field values of the first target field in the first json object and the second json object are same. If the field value of the first target field is an array of key-value pairs, the key values of the corresponding keys in the field values of the first target field in the first json object and the second json object are compared according to a preset key order. If the key values of all the keys are same, it is determined that the field values of the first target field in the first json object and the second json object are same. If there is a key whose key values are different, it is determined that the field values of the first target field in the first json object and the second json object are different. If the field value of the first target field is a concatenation array, whether the concatenation arrays of the first target field in the first json object and the second json object are same is compared. If the concatenation arrays are same, it is determined that the field values of the first target field in the first json object and the second json object are same. If the concatenation arrays are different, it is determined that the field values of the first target field in the first json object and the second json object are different. If the field value of the first target field is a single value, whether the single values of the first target field in the first json object and the second json object are same is compared. If the single values are same, it is determined that the field values of the first target field in the first json object and the second json object are same. If the single values are different, it is determined that the field values of the first target field in the first json object and the second json object are different.
[0154] The array of key-value pairs can be an array with the target field as the primary key, and the field value of the target field in the array is the key value of the primary key.
[0155] Specifically, the server can determine whether the field value of the first target field is an array of key-value pairs. If yes, the server can compare the key values of the keys in the first target field in the first json object with the key values of the keys in the first target field in the second json object according to a preset key order. If the key values of all the keys are same, it is determined that the field values of the first target field in the first json object and the second json object are same. If there is a key whose key values are different, it is determined that the field values of the first target field in the first json object and the second json object are different.
[0156] The preset key order can be the order among the target fields. For example, the preset key order can be the order of id. Specifically, the server can first sort the key orders of the multiple arrays of key-value pairs contained in the first json object and the second json object.
[0157] The splicing array can be an array with multiple target fields as splicing primary keys, and each target field in the array corresponds to a splicing key value.
[0158] Specifically, in the case where the field value of the first target field is not a key-value pair array, the server can determine whether the field value of the first target field is a splicing array. If the field value of the first target field is a splicing array, the server compares the splicing arrays of the first target field in the first and second JSON objects. If the splicing arrays are the same, it is determined that the field values of the first target field in the first and second JSON objects are the same. If the splicing arrays are not the same, it is determined that the field values of the first target field in the first and second JSON objects are not the same.
[0159] The single value can be a value indicating that the field value of the target field is a single value. For example, the single value can be a single field value corresponding to a target field, and the target field has no nested relationship with other fields.
[0160] Specifically, in the case where the field value of the first target field is not a key-value pair array, and the field value of the first target field is not a splicing array, the server can determine whether the field value of the first target field is a single value. If the field value of the first target field is a single value, the server compares the single values of the first target field in the first and second JSON objects. If the single values are the same, it is determined that the field values of the first target field in the first and second JSON objects are the same. If the single values are not the same, it is determined that the field values of the first target field in the first and second JSON objects are not the same.
[0161] Further, in the case where the field value of the first target field is a single value, the server can determine whether the single value needs to be displayed specially. If so, the configuration text is displayed. If not, the above determination of whether the single values are equal is performed. The display configuration text can be index information of the single value or other configuration information.
[0162] For example, as shown in the flowchart of the field value comparison method Figure 7 As shown in the flowchart of the field value comparison method S701, querying the latest two records according to the front-end query condition; The latest two records can be the first and second operation record snapshots.
[0163] S702, converting the data snapshots of the two records into JSON objects; Specifically, the server can convert the first operation record snapshot and the second operation record snapshot into json format respectively to obtain a first json object and a second json object.
[0164] S703, comparing the latest record according to the field information; S704, whether the type is a key-value pair array; Specifically, the server can determine whether the field value of the first target field is a key-value pair array. If yes, S705 is executed; if no, S706 is executed.
[0165] S705, sorting according to a preset key and comparing the key values of the corresponding keys; Specifically, the server can compare the key values of the corresponding keys in the field value of the first target field in the first json object and the second json object according to the preset key order. If the key values of all the keys are the same, it is determined that the field values of the first target field in the first json object and the second json object are the same. If there is a key whose key values are different, it is determined that the field values of the first target field in the first json object and the second json object are different.
[0166] S706, whether the type is a splicing array; Specifically, the server can determine whether the field value of the first target field is a splicing array. If yes, S707 is executed; if no, S708 is executed.
[0167] S707, directly comparing the spliced array values; Specifically, the server can compare whether the spliced arrays of the first target field in the first json object and the second json object are the same. If the spliced arrays are the same, it is determined that the field values of the first target field in the first json object and the second json object are the same. If the spliced arrays are not the same, it is determined that the field values of the first target field in the first json object and the second json object are different.
[0168] S708, whether the type is a single value; Specifically, the server can determine whether the field value of the first target field is a single value. If yes, S509 is executed; if no, the process is ended.
[0169] S709, whether special display is needed; Specifically, the server can determine whether special display is needed. If yes, S711 is executed; if no, S710 is executed.
[0170] S710, directly comparing the field values; Specifically, the server can compare whether the single values of the first target field in the first and second JSON objects are the same. If the single values are the same, it is determined that the field values of the first target field in the first and second JSON objects are the same. If the single values are not the same, it is determined that the field values of the first target field in the first and second JSON objects are not the same.
[0171] S711, display the configuration file (display).
[0172] Specifically, the server can display the configuration text. The display configuration text can be index information of the single value or other configuration information. The user is provided with a reference, which can improve the user experience of the user.
[0173] After the first and second operation record snapshots are converted into the first and second JSON objects, different comparison strategies are set for different types of field values of the target field to ensure the accuracy of the determination result of whether the different types of field values are the same, and to avoid the deviation of the merging of the first and second operation record snapshots caused by the complex data format of the field values.
[0174] In this embodiment, after the server receives the first operation record, the target operation record snapshot is generated according to the first operation record, and the operator information and the first metadata information in the first operation record are stored in the database in association with the target operation record snapshot, so as to facilitate the manager to trace and analyze the operation record of the operator. At the same time, since the operation records corresponding to different proxy ends are processed by the server, the computing overhead of the proxy end in the distributed system is reduced, and the overall performance of the distributed system is effectively improved.
[0175] In one embodiment, as shown in Figure 8 An operation record system is provided, which includes at least one proxy end 800 and a server 810: a plurality of proxy ends are respectively deployed on a plurality of microservices of the same distributed system; The proxy end 800 includes a target operation receiving module 801, an operator information obtaining module 802, an operation information obtaining module 803, an operation record generating module 804, and an operation record reporting module 805. The target operation receiving module 801 is configured to receive a target operation input by an operator, and the target operation is used to operate a target input parameter. The operator information obtaining module 802 is configured to obtain operator information of the operator according to a target business method called by the first device in response to the target operation; and the target business method is a business method marked with a target annotation. The operation information obtaining module 803 is configured to determine first metadata information, a target field, and a field value corresponding to the target field according to a target service method, target annotations, and target parameters; the first metadata information is used to indicate an operation object of the target operation, and the target field corresponds to the target parameters; The operation record generation module 804 is configured to generate a first operation record according to operator information, the first metadata information, the target field, and the field value corresponding to the target field. The operation record reporting module 805 is configured to report the first operation record to a server.
[0176] In some other embodiments, the operation information obtaining module 803 is further configured to parse the target annotations marked by the target service method to obtain the first metadata information; parse annotations of parameters in the target service method to obtain a field mapping rule between the parameters and fields of the target service method; determine the target field according to the field mapping rule and the target parameters, and determine a parameter value of the target parameters as a field value of the target field.
[0177] In some other embodiments, the operation record reporting module 805 is further configured to report the first operation record according to a reporting mode marked in the target annotations; the reporting mode is synchronous real-time reporting or asynchronous non-real-time reporting.
[0178] In some other embodiments, the server 810 includes an operation record receiving module 811 and a snapshot storage module 812.
[0179] The operation record receiving module 811 is configured to receive the first operation record. The snapshot storage module 812 is configured to determine a target operation record snapshot according to service data in the first operation record, and store operator information and first metadata information in the first operation record in association with the target operation record snapshot in a database; the service data in the first operation record refers to the target field and the field value corresponding to the target field.
[0180] In some other embodiments, the snapshot storage module 812 is further configured to convert the service data in the first operation record into a first operation record snapshot; determine, according to the first metadata information, whether there is a second operation record snapshot with the same metadata information as the first metadata information in the database; the database stores historical operation record snapshots, and operator information and metadata information corresponding to the historical operation record snapshots; if there is the second operation record snapshot, merge the first operation record snapshot and the second operation record snapshot to obtain the target operation record snapshot.
[0181] In some embodiments, the snapshot storage module 812 is further configured to compare the target field in the first operation record snapshot with the target field in the second operation record snapshot to obtain a first target field and a second target field; the first target field refers to a target field in the first operation record snapshot that is the same as the target field in the second operation record snapshot, and the second target field refers to a target field in the first operation record snapshot that is not the same as the target field in the second operation record snapshot; for the first target field, compare the field values of the first target field in the first operation record snapshot and the second operation record snapshot; if the field values of the first target field in the first operation record snapshot and the second operation record snapshot are not the same, the field value of the first target field in the first operation record snapshot is taken as the field value of the first target field in the target operation record snapshot; and for the second target field, the field value of the second target field in the first operation record snapshot is taken as the field value of the second target field in the target operation record snapshot.
[0182] In some embodiments, the snapshot storage module 812 is further configured to convert the first operation record snapshot and the second operation record snapshot into a json format respectively to obtain a first json object and a second json object; for each first target field, the following method is used to determine whether the field values of the first target field in the first json object and the second json object are the same: if the field value of the first target field is an array of key-value pairs, the key values of the corresponding keys in the field values of the first target field in the first json object and the second json object are compared according to a preset key order; if all the key values are the same, it is determined that the field values of the first target field in the first json object and the second json object are the same; if there is a key whose key values are not the same, it is determined that the field values of the first target field in the first json object and the second json object are not the same; if the field value of the first target field is a concatenation array, the concatenation arrays of the first target field in the first json object and the second json object are compared; if the concatenation arrays are the same, it is determined that the field values of the first target field in the first json object and the second json object are the same; if the concatenation arrays are not the same, it is determined that the field values of the first target field in the first json object and the second json object are not the same; if the field value of the first target field is a single value, the single values of the first target field in the first json object and the second json object are compared; if the single values are the same, it is determined that the field values of the first target field in the first json object and the second json object are the same; if the single values are not the same, it is determined that the field values of the first target field in the first json object and the second json object are not the same.
[0183] Figure 9 A structural schematic diagram of an electronic device is provided for the embodiments of the present application. As shown in FIG. 1, the electronic device includes a processor 100, a memory 200, a communication interface 300, a display 400, and a sensor 500. Figure 9As shown, the electronic device includes a memory 901 and at least one processor 902.
[0184] The memory 901 is configured to store computer program code including computer instructions. The computer instructions run in the electronic device described above to implement the method shown in the method embodiment described above. For example, the memory can include a random access memory (RAM), and can also include a non-volatile memory (NVM), such as at least one disk memory, and can also be a U disk, a mobile hard disk, a read-only memory, a magnetic disk or an optical disk, etc.
[0185] The processor 902 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component. The processor 902 can also be other general-purpose processors. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor.
[0186] The memory 901 and the processor 902 are in communication connection. For example, the memory 901 can be connected with the processor 902 through a system bus and complete mutual communication. The system bus can be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, an industry standard architecture (ISA) bus, etc. The system bus can be divided into an address bus, a data bus, a control bus, etc. For the convenience of representation, only one thick line is shown in the figure, but it does not mean that there is only one bus or only one type of bus.
[0187] Optionally, the memory 901 can be independent or integrated with the processor 902. When the memory 901 is independently arranged, the memory 901 and the processor 902 are connected through a system bus.
[0188] The embodiment of the present application further provides a chip for running instructions, which is used for executing the technical solution of the operation recording method in the above embodiment.
[0189] The embodiment of the present application further provides a computer readable storage medium, which stores computer instructions. When the computer instructions are executed by a processor, the technical solution of the operation recording method in the above embodiment is implemented. Specifically, when the computer instructions are executed by the processor, the electronic device can execute the technical solution of the operation recording method in the above embodiment.
[0190] The embodiment of the present application further provides a computer program product, which includes a computer program stored in a computer readable storage medium. At least one processor can read the computer program from the computer readable storage medium, and when the at least one processor executes the computer program, the technical solution of the operation recording method in the above embodiment can be implemented. The computer readable storage medium can be realized by any type of volatile or nonvolatile storage devices or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk or optical disk. The computer readable storage medium can be any available medium that can be accessed by a general or special purpose computer.
[0191] An exemplary computer readable storage medium is coupled to the processor, so that the processor can read information from the storage medium and write information to the computer readable storage medium. Of course, the computer readable storage medium can also be an integral part of the processor. The processor and the computer readable storage medium can be located in an application specific integrated circuit (ASIC). Of course, the processor and the computer readable storage medium can also exist as discrete components in an electronic control unit or a host device, and the embodiment of the present application does not limit this.
[0192] In several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other manners. For example, the division of the above-described device embodiments is merely a logical function division, and there can be another division manner for the actual implementation, for example, multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the displayed or discussed mutual couplings or direct couplings or communication connections between different modules can be indirect couplings or communication connections through some interfaces, devices or modules, and can be electrical, mechanical or in other forms.
[0193] The modules illustrated as separated components can or can not be physically separated, and the components illustrated as modules can or can not be physical units, i.e., can be located in one place, or can be distributed on multiple network units. Some or all of the modules can be selected according to actual needs to implement the embodiments of the present application.
[0194] In addition, each functional module in the embodiments of the present application can be integrated in one processing unit, or each module can be physically present separately, or two or more modules can be integrated in one unit. The above-mentioned units can be realized in the form of hardware, or in the form of hardware plus software functional units.
[0195] The integrated modules realized in the form of software functional modules can be stored in a computer readable storage medium. The software functional modules stored in the storage medium include a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor to execute some steps of the embodiments of the present application.
[0196] It should be understood that the steps of the method disclosed in the embodiments of the present application can be directly embodied as hardware processor execution, or executed by a combination of hardware and software modules in the processor.
[0197] It can be understood that all or part of the steps of the above-mentioned method embodiments can be completed by program instruction related hardware. The foregoing program can be stored in a computer readable storage medium. The program, when executed, executes steps including the above-mentioned method embodiments; and the foregoing storage medium includes: ROM, RAM, magnetic disk or optical disk, and various media that can store program codes.
[0198] Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, but not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood that: it can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacement for part or all of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present application.
Claims
1. An operation recording method characterized by comprising: The method is applied to an operation recording system, the operation recording system comprises a server and a plurality of agent ends, the plurality of agent ends are respectively deployed on a plurality of micro services of a same distributed system, and the method comprises the following steps: The agent end receives a target operation input by an operator, the target operation being used for operating a target input parameter; The agent end calls a target business method in response to the target operation, and obtains operator information of the operator; the target business method being a business method marked with a target annotation; The agent end determines first metadata information, a target field and a field value corresponding to the target field according to the target business method, the target annotation and the target input parameter; the first metadata information being used for indicating an operation object and an operation type of the target operation, and the target field corresponding to the target input parameter; The agent end generates a first operation record according to the operator information, the first metadata information, the target field and the field value corresponding to the target field; The agent end reports the first operation record to the server.
2. The method of claim 1, wherein, The agent end determines the first metadata information, the target field and the field value corresponding to the target field according to the target business method, the target annotation and the target input parameter, and comprises the following steps: The agent end parses the target annotation marked in the target business method to obtain the first metadata information; The agent end parses an annotation of a parameter in the target business method to obtain a field mapping rule between an input parameter and a field of the target business method; The agent end determines the target field according to the field mapping rule and the target input parameter, and determines an input parameter value of the target input parameter as a field value of the target field.
3. The method of claim 1, wherein, The agent end reports the first operation record to the server, and comprises the following steps: The agent end reports the first operation record according to a reporting mode marked in the target annotation; The reporting mode is synchronous real-time reporting or asynchronous non-real-time reporting.
4. The method according to any one of claims 1 to 3, characterized in that, The method further comprises the following steps: The server receives the first operation record; The server determines a target operation record snapshot according to business data in the first operation record, and stores the operator information and the first metadata information in the first operation record in association with the target operation record snapshot in a database; the business data in the first operation record refers to the target field and the field value corresponding to the target field.
5. The method of claim 4, wherein, The server determines a target operation record snapshot according to business data in the first operation record, and comprises the following steps: The server converts the business data in the first operation record into a first operation record snapshot; The server determines whether there is a second operation record snapshot with the same first metadata information in the database according to the first metadata information; the database stores historical operation record snapshots, and operator information and metadata information corresponding to the historical operation record snapshots; If the second operation record snapshot exists, the server combines the first operation record snapshot and the second operation record snapshot to obtain the target operation record snapshot.
6. The method of claim 5, wherein, The merging the first operation record snapshot and the second operation record snapshot to obtain the target operation record snapshot comprises: comparing target fields in the first operation record snapshot with target fields in the second operation record snapshot to obtain first target fields and second target fields; the first target fields refer to target fields in the first operation record snapshot that are the same as target fields in the second operation record snapshot, and the second target fields refer to target fields in the first operation record snapshot that are not the same as target fields in the second operation record snapshot; for the first target fields, comparing field values of the first target fields in the first operation record snapshot and the second operation record snapshot; if the field values of the first target fields in the first operation record snapshot and the second operation record snapshot are not the same, taking the field values of the first target fields in the first operation record snapshot as the field values of the first target fields in the target operation record snapshot; for the second target fields, taking the field values of the second target fields in the first operation record snapshot as the field values of the second target fields in the target operation record snapshot.
7. The method of claim 6, wherein, The comparing the field values of the first target fields in the first operation record snapshot and the second operation record snapshot comprises: respectively converting the first operation record snapshot and the second operation record snapshot into json formats to obtain a first json object and a second json object; for each first target field, the following method is used to determine whether the field values of the first target fields in the first json object and the second json object are the same: if the field values of the first target fields are key-value pair arrays, the key values of corresponding keys in the field values of the first target fields in the first json object and the second json object are compared according to a preset key order; if all key values are the same, it is determined that the field values of the first target fields in the first json object and the second json object are the same; if there is a key with different key values, it is determined that the field values of the first target fields in the first json object and the second json object are not the same; if the field values of the first target fields are splicing arrays, whether the splicing arrays of the first target fields in the first json object and the second json object are the same is compared; if the splicing arrays are the same, it is determined that the field values of the first target fields in the first json object and the second json object are the same; if the splicing arrays are not the same, it is determined that the field values of the first target fields in the first json object and the second json object are not the same; If the field value of the first target field is a single value, then compare whether the single values of the first target field in the first and second JSON objects are the same, if the single values are the same, it is determined that the field values of the first target field in the first and second JSON objects are the same, if the single values are not the same, it is determined that the field values of the first target field in the first and second JSON objects are not the same.
8. An operation recording system characterized by comprising: The system comprises a server and at least one agent, wherein the agents are deployed on microservices of a same distributed system; The agent comprises a target operation receiving module, an operator information obtaining module, an operation information obtaining module, an operation record generating module and an operation record reporting module; The target operation receiving module is configured to receive a target operation input by an operator, wherein the target operation is used to operate a target input parameter; The operator information obtaining module is configured to obtain operator information of the operator according to a target business method called by the first device in response to the target operation, wherein the target business method is a business method marked with a target annotation; The operation information obtaining module is configured to determine first metadata information, a target field and a field value corresponding to the target field according to the target business method, the target annotation and the target input parameter; The first metadata information is used to indicate an operation object of the target operation, and the target field corresponds to the target input parameter; The operation record generating module is configured to generate a first operation record according to the operator information, the first metadata information, the target field and the field value corresponding to the target field; The operation record reporting module is configured to report the first operation record to the server.
9. An electronic device, comprising: The system comprises: a memory and at least one processor; the memory is in communication connection with the processor; the memory is used to store computer program codes, the computer program codes comprise computer instructions; when the processor executes the computer instructions, the electronic device executes the method in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer readable storage medium stores computer instructions, and the computer instructions are executed by the processor to implement the method in any one of claims 1 to 7.
11. A computer program product, characterised in that, When the computer program product runs on the computer / is executed by the processor of the computer, the method in any one of claims 1 to 7 is implemented.