Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the technical solutions of the present application will be described in detail and completely with reference to the following specific embodiments of the present application and the accompanying drawings. It should be apparent that the described embodiments are only some of the embodiments of the present application, and not all of the embodiments. All other embodiments obtained by a person skilled in the art based on the embodiments in the present specification without any inventive step are within the scope of the present application.
As described above, in the current SOA Service system adopting an SOA Architecture, the whole system is often divided into a plurality of functional units based on Service functions, each functional unit provides a Service, i.e. is regarded as a Service node, and each Service node is in a loosely coupled state, so that the whole system is convenient to perform distributed deployment, combination and application. Thus, at the time of service invocation, the operation state of each service node is recorded, and a service log for each node can be generated. As shown in fig. 1, fig. 1 is a schematic diagram related to generating a service log in the prior art. In this way, each node has a corresponding service log, and the running state of the corresponding service node is stored in each log, and if it is desired to perform management and control and analysis for each specific call (for example, in a payment application, no error occurs in each call, and if a problem occurs, it is also desired to perform log query for the call quickly to determine the problem location), it is necessary to perform cross-node log query according to related information (for example, a payment order number) provided by a user, and efficiency is low.
Based on this, the embodiments of the present specification provide a method for generating a service log, where service nodes experienced by each service invocation are monitored, and relevant information of all invoked service nodes in a service invocation chain is printed in one service log, so as to perform log collection, facilitate subsequent management and control analysis, and improve overall efficiency.
As shown in fig. 2, fig. 2 is a schematic flow chart of a service log generation method provided in the embodiment of the present specification, and the method includes:
s201, for any service request, monitoring the service node experienced by the service request.
The service request is implemented by a series of calls to the service node. The manner of monitoring the service nodes may be determined on its own based on the manner in which the actual service is provided. In practical application, in order to distinguish service nodes corresponding to different service requests, a corresponding process can be created for each service request to process, and the service nodes related in the process are monitored, so that different service requests can be monitored respectively.
In the above process, there may be a mutual nested call relationship between the service nodes, for example, the service request sequentially passes through A, B and the C node, wherein the a node calls the B node, the D node and the E node in the process of providing service, and then the D node and the E node are also confirmed as the service node passed through by the service request.
S203, acquiring relevant information of the service node for any service node experienced by the service request, where the relevant information at least includes a node identifier and a service parameter.
In addition to the node identification (node identification is typically one-to-one and non-repeating) and the service parameter, the related information may also include information such as the name of the service node, the service name of the service node, and so on. The service parameters may include relevant parameters such as time to join, leave, or call by the node, etc. The related information generated by the service node when providing service is generally stored in a memory and can be directly extracted. As shown in fig. 3, fig. 3 is a schematic diagram of relevant information of a service node provided in the embodiment of the present disclosure.
S205, generating a service log containing the related information of all service nodes experienced by the service request.
And synchronously printing the generated logs according to the extracted relevant information of the service nodes. Or storing the extracted data into a specially created queue, and asynchronously generating a log including all nodes after all nodes are processed.
In the scheme, the service nodes which are called by each service call are monitored, the related information of all the called service nodes in the service call chain is printed in one service log, log collection is carried out, the collected service log can conveniently and completely show the related nodes included in the call, a data analysis basis is provided for the system control of a subsequent service system, the service system can be favorably and finely controlled according to the log (namely, the places where the service system is possibly problematic can be quickly positioned in each service), and the method is a more effective log collection mode.
In practical application, the method for generating the service log can adopt a virtual node mode to perform asynchronous processing. Aiming at any service node, based on the obtained relevant information of the service node, a virtual node corresponding to the service node is created
In particular, the nature of a business call is the stacking and unstacking of a series of service methods. "push" means the start of a call to the node, and "pop" means the end of a call to the node. And creating a virtual node before calling (before stacking) by using a proxy mode for each called service node, and after calling (during stacking), acquiring the access parameters, time consumption and other information of the service method in the memory.
For example, before the service call starts, a queue is created, and the queue corresponds to the service call. When a service node is determined to be called, a virtual node with a null value is created to occupy a position in the queue, and the collected related information is written into the virtual node during pop. As shown in fig. 4, fig. 4 is a schematic flowchart of a process for collecting relevant information by a virtual node according to an embodiment of the present disclosure. In this process, for the service node in which the nested call occurs, a recursive manner may be adopted in the process of acquiring the relevant information of the virtual node until the service node is the root node. That is, if a new service is entered when the call is not popped, a new node is created in the node queue. For example, when calling an F node, a G node needs to be called in a nested manner. Then in the process of popping and popping, the sequence of actual execution is "F push → call G → G push → G end → G pop → F end → F pop". In the node queue, it appears as "F → G". When the related information is acquired, the recursion may be started from the "G node", and if the acquisition of the related information of the G node is completed, the recursion is performed to the "F node", until the acquisition of the related information of the root node (i.e., the F node in this example) is completed, the recursion is stopped.
When the service call is completely finished, all virtual nodes corresponding to the service call are obtained from the node queue at the moment, each virtual node corresponds to one real node and stores related information such as the ID, the name and the service parameters of the real node, and therefore the service log corresponding to the service call can be generated according to the virtual nodes in the node queue. When the service log is generated, format setting can be performed based on actual needs, so that a service log is output according to a certain format. In practical application, if one piece of data is synchronously recorded through each node, a log is generated in real time, high calculation performance is needed, subsequent processing is not facilitated, and the influence on system performance can be reduced by adopting asynchronous aggregation to generate the log.
In addition, when monitoring the service nodes, the sequence of each node can be determined to determine the call link of the whole service node, so that when generating the service log, the service log containing the link information of the service node and the related information of all the service nodes is generated.
Specifically, for any called service node, the order of each node may be determined according to the information of the upstream and downstream nodes of the node and the nested calling situation, so as to obtain the calling link information. For example, when a service call corresponding to a service request is obtained, a node queue is created, in the node queue, the starting node H (also referred to as root node) is determined to have a sequence number of "1", if the root node H initiates calls to the nodes I, J and K at the same time, the node queue I, J and K may be determined to have a sequence number of "1.1", "1.2" and "1.3", respectively, the L and M nodes called by I may be determined to have a sequence number of "1.1.1" and "1.1.2", and the node queue N called by K may be determined to have a sequence number of "1.3.1". As shown in fig. 5, fig. 5 is a schematic diagram of a service node link corresponding to a service invocation provided in the embodiment of the present specification. When the log is generated, the serial numbers of the nodes can be included, so that the node link experienced by the call can be conveniently confirmed according to the serial numbers, the positions of the service nodes in the whole call link and the service nodes on the upstream and downstream of the call link can be conveniently searched, and the subsequent management and control analysis is further facilitated. Obviously, the above-mentioned serial number is written as an example, and in practical applications, the serial number may also be sorted in other manners, for example, by using ordered letters or other symbols or mixed numerical symbols, and the like.
After the service node link sequence is generated in the above manner, the generated service log may display link information including the node called this time, for example, directly display the link information in a form of a record or a tree diagram; the link information may be implicitly included in the service log, for example, when recording the service node identifier, the serial number of each service node identifier is recorded together, so that the link information may be determined according to the serial number in the following.
In practical applications, the relevant information collected by the service nodes can also be selected through a form such as configuration files or codes, and the information collection performed on which service nodes is determined, and the data collection performed on which information is performed. For example, in the simplest collection mode, the determination of the configuration file based on manual instructions is time-consuming to collect only the identity of each service node and the node. Through a background configuration mode, the information of each calling node can be adjusted in real time and dynamically acquired, and a targeted service log can be conveniently generated based on actual service needs.
Based on the same idea, an embodiment of the present specification further provides a service log generating device, as shown in fig. 6, where fig. 6 is a schematic structural diagram of the service log generating device provided in the embodiment of the present specification, and the schematic structural diagram includes:
the monitoring module 601 is configured to monitor a service node that is passed by a service request, for any service request;
an obtaining module 603, configured to obtain, for any service node experienced by the service request, relevant information of the service node, where the relevant information at least includes a node identifier and a service parameter;
the generating module 605 generates a service log containing the related information of all service nodes experienced by the service request.
Further, the apparatus further includes a virtual node module 607, which creates a virtual node corresponding to any service node based on the obtained relevant information of the service node, and the generating module 605 generates a service log including relevant information of all service nodes according to the virtual node.
Further, the monitoring module 601 determines all service nodes experienced by the service request, and determines the call sequence of all service nodes; the generating module 605 generates service node link information corresponding to the service invocation according to the invocation sequence of all the service nodes; and generating a service log containing the link information of the service nodes and the related information of all the service nodes.
Further, the apparatus further includes a configuration module 609, which receives an instruction of a user, and configures the relevant information of the service node to be acquired; the obtaining module 603 obtains relevant information of the service node, which is determined based on pre-configuration.
Correspondingly, an embodiment of the present specification further provides a service log generating device, including:
a memory storing a service log generation program;
the processor calls the service log generation program in the memory and executes:
aiming at any service request, monitoring a service node passed by the service request;
acquiring relevant information of the service node aiming at any service node experienced by the service request, wherein the relevant information at least comprises a node identifier and a service parameter;
and generating a service log containing the related information of all service nodes experienced by the service request.
Based on the same inventive concept, embodiments of the present specification further provide a corresponding non-volatile computer storage medium, in which computer-executable instructions are stored, where the computer-executable instructions are configured to:
aiming at any service request, monitoring a service node passed by the service request;
acquiring relevant information of the service node aiming at any service node experienced by the service request, wherein the relevant information at least comprises a node identifier and a service parameter;
and generating a service log containing the related information of all service nodes experienced by the service request.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. Especially, as for the device, apparatus and medium type embodiments, since they are basically similar to the method embodiments, the description is simple, and the related points may refer to part of the description of the method embodiments, which is not repeated here.
The foregoing description has been directed to specific embodiments of this disclosure. Other embodiments are within the scope of the following claims. In some cases, the actions or steps or modules recited in the claims may be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing may also be possible or may be advantageous.
In the 90 s of the 20 th century, improvements in a technology could clearly distinguish between improvements in hardware (e.g., improvements in circuit structures such as diodes, transistors, switches, etc.) and improvements in software (improvements in process flow). However, as technology advances, many of today's process flow improvements have been seen as direct improvements in hardware circuit architecture. Designers almost always obtain the corresponding hardware circuit structure by programming an improved method flow into the hardware circuit. Thus, it cannot be said that an improvement in the process flow cannot be realized by hardware physical modules. For example, a Programmable Logic Device (PLD), such as a Field Programmable Gate Array (FPGA), is an integrated circuit whose Logic functions are determined by programming the Device by a user. A digital system is "integrated" on a PLD by the designer's own programming without requiring the chip manufacturer to design and fabricate application-specific integrated circuit chips. Furthermore, nowadays, instead of manually making an Integrated Circuit chip, such Programming is often implemented by "logic compiler" software, which is similar to a software compiler used in program development and writing, but the original code before compiling is also written by a specific Programming Language, which is called Hardware Description Language (HDL), and HDL is not only one but many, such as abel (advanced Boolean Expression Language), ahdl (alternate Hardware Description Language), traffic, pl (core universal Programming Language), HDCal (jhdware Description Language), lang, Lola, HDL, laspam, hardward Description Language (vhr Description Language), vhal (Hardware Description Language), and vhigh-Language, which are currently used in most common. It will also be apparent to those skilled in the art that hardware circuitry that implements the logical method flows can be readily obtained by merely slightly programming the method flows into an integrated circuit using the hardware description languages described above.
The controller may be implemented in any suitable manner, for example, the controller may take the form of, for example, a microprocessor or processor and a computer-readable medium storing computer-readable program code (e.g., software or firmware) executable by the (micro) processor, logic gates, switches, an Application Specific Integrated Circuit (ASIC), a programmable logic controller, and an embedded microcontroller, examples of which include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320, the memory controller may also be implemented as part of the control logic for the memory. Those skilled in the art will also appreciate that, in addition to implementing the controller as pure computer readable program code, the same functionality can be implemented by logically programming method steps such that the controller is in the form of logic gates, switches, application specific integrated circuits, programmable logic controllers, embedded microcontrollers and the like. Such a controller may thus be considered a hardware component, and the means included therein for performing the various functions may also be considered as a structure within the hardware component. Or even means for performing the functions may be regarded as being both a software module for performing the method and a structure within a hardware component.
The systems, devices, modules or units illustrated in the above embodiments may be implemented by a computer chip or an entity, or by a product with certain functions. One typical implementation device is a computer. In particular, the computer may be, for example, a personal computer, a laptop computer, a cellular telephone, a camera phone, a smartphone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
For convenience of description, the above devices are described as being divided into various units by function, and are described separately. Of course, the functions of the units may be implemented in the same software and/or hardware or in one or more pieces of software and/or hardware when implementing the embodiments of the present description.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include transitory computer readable media (transient media) such as modulated data signal numbers and carrier waves.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
As will be appreciated by one skilled in the art, one or more embodiments of the present description may be provided as a method, system, or computer program product. Accordingly, embodiments of the present description may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, embodiments of the present description may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and so forth) having computer-usable program code embodied therein.
Embodiments of the present description may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular transactions or implement particular abstract data types. Embodiments of the present description may also be practiced in distributed computing environments where transactions are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.