Method and system for tracking call link and related product

By adding trace information to EJB calls and using Corba interceptor function, the trace information of the EJB call link is passed to the tracking system, which solves the problem that EJB calls cannot be included in monitoring, and achieves complete monitoring and efficient EJB call link Troubleshooting.

CN119030853APending Publication Date: 2024-11-26SHENZHEN KINGDEE MIDDLEWARE
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411142718.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-19
Publication Date
2024-11-26

AI Technical Summary

Technical Problem

The prior art cannot incorporate EJB calls into the monitoring of distributed call links, resulting in incomplete call links and is difficult to ensure effective inspection and performance monitoring of EJB-related problems.

Method used

By distinguishing EJB call requests from the call requests initiated by the client, adding trace information, and intercepting them on the server to extract trace information, using Corba's interceptor function to pass the trace information to the tracking system, realizing the EJB call link to realize monitoring.

Benefits of technology

It breaks through the obstacle that the tracking information of EJB calls cannot be transmitted to the tracking system, so that EJB calls can be included in the monitoring of the tracking system, complete the monitoring map, and improve the efficiency of troubleshooting EJB-related issues.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119030853A_ABST
    Figure CN119030853A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a call link tracking method and system and related products, and the method comprises the steps: distinguishing an EJB call request from call requests initiated by a client, and adding tracking information to the EJB call request; the tracking information is at least used for identifying and tracking the EJB calling request; transmitting the tracking information to a server along with the EJB calling request; intercepting the EJB calling request transmitted to the server so as to extract tracking information to a tracking system; and running a tracking system based on the tracking information to track a call link passed by the EJB call request. Wherein the tracking information aiming at the request is transmitted to the server by means of the EJB calling request, so that the obstacle that the tracking information called by the EJB cannot be transmitted to the tracking system in the prior art is broken through, the EJB calling can be brought into monitoring of the tracking system, the monitoring layout of the tracking system is complemented, and the troubleshooting efficiency of EJB related problems is guaranteed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of computer technology, and in particular to a method, system, and related products for tracing a call link. Background Art

[0002] Enterprise JavaBeans (EJB) is a server-side component architecture that supports the rapid and simplified development of distributed, transactional, secure, and portable applications based on Java technology. EJB is usually deployed or run on a server and communicates with the client through a remote interface. By using EJB, developers can focus on the implementation of business logic without having to worry about complex issues such as underlying transaction management and security control.

[0003] In the current era of microservice architecture, due to the complex calling relationships between services, tracking the distributed call chain has become an indispensable technology for troubleshooting and performance monitoring. However, this technology currently cannot include EJB calls in chain monitoring.

[0004] For industries such as finance and insurance that use EJB technology more frequently, the inability to track distributed EJB calls will make the entire call chain incomplete and it will be difficult to ensure ideal calls to business methods. EJBs often bear important business logic, so it is necessary to implement tracking and monitoring of EJBs. Summary of the invention

[0005] The embodiments of the present application provide a method, system and related products for tracking call links, so that EJB calls can be included in the monitoring of the tracking system, completing the monitoring map of the entire business system and ensuring the efficiency of troubleshooting EJB-related problems.

[0006] A first aspect of an embodiment of the present application provides a method for tracking a call link, including:

[0007] Distinguishing an EJB call request from each call request initiated by the client, and adding tracking information to the EJB call request; the tracking information is at least used to identify and track the EJB call request;

[0008] Passing the tracking information along with the EJB call request to the server;

[0009] Intercepting the EJB call request transmitted to the server to extract the tracking information and send it to the tracking system;

[0010] The tracing system is run based on the tracing information to trace the call link that the EJB call request has gone through.

[0011] Optionally, distinguishing the EJB call request from each call request initiated by the client includes:

[0012] If a method in the EJB Stub class with the same name as the business method is added with a status information code, the call request for calling the business method is distinguished as an EJB call request; the EJB Stub class is a client proxy that forwards the call request to the server, and the method with the same name as the business method is used to call the business method on the server; the status information code is used to identify the business method as a method recorded in the EJB business method list.

[0013] Optionally, after differentiating the call request for calling the EJB business method as an EJB call request, the method further includes:

[0014] After the call to the EJB business method is completed, the state information code in the EJB Stub class is cleared to re-distinguish whether the next call request is an EJB call request.

[0015] Optionally, the step of transmitting the tracking information to the server along with the EJB call request includes:

[0016] At the start interception point of the client, the tracking information is assembled into a structure in a target format and transmitted to the server; the start interception point is a pre-stage before the EJB business method is called.

[0017] Optionally, intercepting the EJB call request transmitted to the server to extract the tracking information to a tracking system includes:

[0018] The structure is extracted at the start interception point of the server, and the content of the structure is decoded to restore the tracking information and transmit it to the tracking system.

[0019] Optionally, if it is limited to intercept twice on the server side to count the execution time of the EJB business method, then after intercepting the EJB call request transmitted to the server side to extract the tracking information to the tracking system, the method further includes:

[0020] An end method is called at the end interception point of the server to record the end time when the EJB business method is called; the end interception point is the post-stage after the EJB business method is called, and the end time is used to count the execution time of the EJB business method.

[0021] Optionally, if it is limited to intercept once at the server to count the execution time of the EJB business method, then after intercepting the EJB call request transmitted to the server to extract the tracking information to the tracking system, the method further includes:

[0022] The extracted tracking information is transmitted to a method to be intercepted, so as to count the execution time of the EJB business method through the method to be intercepted;

[0023] The method to be intercepted is intercepted to record the time when the EJB business method required by the EJB call request starts to be called, and to record the time when the EJB business method ends to be called.

[0024] When the method described in the first aspect of the present application is implemented, the content described in the second aspect of the present application can be adopted to achieve it.

[0025] A second aspect of an embodiment of the present application provides a system for tracking a call link, including:

[0026] A processing unit, used to distinguish an EJB call request from various call requests initiated by a client, and add tracking information to the EJB call request; the tracking information is at least used to identify and track the EJB call request;

[0027] A transmission unit, used to transmit the tracking information along with the EJB call request to the server;

[0028] The processing unit is further used to intercept the EJB call request transmitted to the server to extract the tracking information to the tracking system;

[0029] The processing unit is further configured to run the tracing system based on the tracing information to trace the call link that the EJB call request has gone through.

[0030] A third aspect of an embodiment of the present application provides an electronic device, including: a processor and a memory;

[0031] The processor is configured to communicate with the memory and execute instructions in the memory to implement the method described in the first aspect of the embodiment of the present application or any specific implementation of the first aspect.

[0032] A fourth aspect of an embodiment of the present application provides a computer-readable storage medium, which stores computer instructions. When the computer instructions are executed by a processor, they implement the method described in the first aspect of the embodiment of the present application or any specific implementation of the first aspect.

[0033] A fifth aspect of an embodiment of the present application provides a computer program product, which includes computer instructions. When the computer instructions are executed by a processor, they implement the method described in the first aspect of the embodiment of the present application or any specific implementation of the first aspect.

[0034] It can be seen from the above technical solutions that the embodiments of the present application have at least the following advantages:

[0035] The embodiment of the present application uses an EJB call request to pass the tracking information of the request to the server, breaking through the obstacle in the prior art that the tracking information of the EJB call cannot be passed to the tracking system, enabling the EJB call to be included in the monitoring of the tracking system, completing the monitoring map of the tracking system, and ensuring the efficiency of troubleshooting EJB-related problems. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present application. For ordinary technicians in this field, other drawings can also be obtained based on these drawings.

[0037] It should be noted that, although the steps in the process diagrams (if any) involved in the embodiments are drawn in sequence as indicated by the arrows, unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and these steps can be executed in other orders. Moreover, at least a portion of the steps in the flowcharts involved in the embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least a portion of the steps or stages in other steps.

[0038] Figure 1 A flowchart of a method for tracking a call link according to an embodiment of the present application;

[0039] Figure 2 , Figure 3 A flowchart of a method for tracking a call link according to an embodiment of the present application;

[0040] Figure 4 A schematic diagram of the structure of a system for tracking call links according to an embodiment of the present application;

[0041] Figure 5 A schematic diagram of the structure of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION

[0042] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings. The described embodiments should not be regarded as limiting the present application. All other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of this application.

[0043] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims and drawings of the present application are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0044] In the following description, similar expressions such as "a specific implementation" or "a specific example" are involved, which describe a subset of all possible embodiments, but it can be understood that "a specific implementation" or "a specific example" can be the same subset or different subsets of all possible embodiments, and can be combined with each other without conflict. In the following description, the term multiple refers to at least two. In some specific examples, the numerical value mentioned in this application reaches the threshold value (if any), which may include the case where the former is greater than the latter of the threshold value; if similar expressions such as "any" or "at least one" are mentioned, it can specifically refer to any one of the listed examples or any combination of these examples.

[0045] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.

[0046] In order to better implement the method of tracking call links of this application, the following is now provided: Figure 1The system architecture diagram of the method for tracking call links shown in the figure. The system for tracking call links may include at least one terminal device 101 and a server 102; different types of applications may be installed on the terminal device 101, for example, instant messaging applications, live broadcast applications, conference communication applications, etc. may be installed on the terminal device 101; the terminal device 101 may be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart car, etc. The server 102 may be used to store application data and image data generated by different types of applications of the terminal device 101, as well as various business methods required to be called by the terminal device 101. The server 102 may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms, etc.

[0047] The above-mentioned method of tracking the call link can be executed by either the terminal device 101 or the server 102, or by both parties. The specific details can be determined according to the actual application scenario and are not limited here. The server 102 can be deployed with a tracking system, which can be used to monitor the call link, count the execution time of the business method, etc. For example, the server 102 distinguishes the EJB call request and adds tracking information to the EJB call request. The distinction process here can also be performed by the client, and the process of adding tracking information can also be specifically performed by the tracking system. Afterwards, the terminal device 101 can be driven to pass the tracking information to the server along with the EJB call request; the EJB call request transmitted to the server is intercepted to extract the tracking information to the tracking system; the server 102 can run the tracking system based on the tracking information to track the call link that the EJB call request has gone through.

[0048] It should be noted that EJB components are usually deployed or run on the server and communicate with the client through remote interfaces (such as RMI-IIOP, HTTP, etc.). Therefore, the client does not call the business method directly. Instead, the client calls through the EJB stub class or proxy class. The Stub class is the client proxy generated by the EJB container for the remote EJB interface. It is responsible for handling network communication details and forwarding the client's call to the EJB instance on the server. Corba, which is different from EJB: The full name is Common Object Request Broker Architecture, which can be translated as the common object request broker architecture. It is a standard object-oriented application system specification formulated by the OMG organization; in other words, the Corba architecture is a solution proposed by the OMG to solve the interconnection of hardware and software systems in the distributed computing environment (DCE); Corba aims to enable objects written in different languages ​​to interact seamlessly in a heterogeneous environment. ORB is responsible for transmitting requests and responses between the client and the server.

[0049] Since the communication protocol of EJB is the Internet Inter-ORB Protocol (IIOP), the most intuitive traditional idea is to modify the IIOP protocol to support the propagation of tracing information, which is the existing defect of being unable to transmit tracing information for EJB calls and the fact that EJB calls cannot be monitored. However, such a modification is relatively large and will cause IIOP protocol incompatibility. Therefore, the inventor has found through research that the interceptor function of Corba can be used to realize the propagation of tracing information for EJB calls. For details, please refer to the following detailed description of the method of the present application.

[0050] See also Figure 2 In a first aspect, the present application provides a specific embodiment of a method for tracing a call link, and the embodiment includes the following steps:

[0051] Step S21: distinguish EJB call requests from various call requests initiated by the client, and add tracking information to the EJB call requests.

[0052] In actual situations, EJB calls are a type of Corba calls, but not all Corba method calls require the transmission of tracking information. Generally, tracking information is only required when calling EJB methods (that is, EJB calls), so it is necessary to distinguish EJB call requests.

[0053] Among them, the above-mentioned tracking information is at least used to identify and track EJB call requests. The identifier can be recorded as a global unique identifier of the call request (which can be called Trace ID), that is, each call request can have its own unique Trace ID. Through this Trace ID, all call links of a call request in a distributed system can be connected in series to form a complete call link diagram, which is convenient for quickly locating the specific request and call link where the problem occurs, and completing problem tracking and performance analysis in a targeted manner. Of course, the tracking information can also include other information besides the Trace ID, such as the name of the EJB business method called by the request, the service name and its address, etc., which can help monitor the call link in some examples.

[0054] Step S22: passing the tracking information to the server along with the EJB call request.

[0055] The server (or application server) of the embodiment of the present application is a basic software located on top of the operating system. Because it is located between the operating system and the business application, it is also called a middleware. This server can be used to provide an execution environment for the application, as well as security, transactions, data and other common underlying services that are independent of each application, so that developers can focus on the development of business logic.

[0056] Step S22 can be called processing of the client. In some examples, the server can drive the client to pass the tracking information to the server along with the EJB call request. Of course, the server can also autonomously call the EJB call request to pass the tracking information. In actual situations, the tracking information can be included in the EJB call request and carried and passed to break the barrier of being unable to pass the tracking data to the tracking system during the existing call process.

[0057] Step S23: intercept the EJB call request transmitted to the server to extract the tracking information and send it to the tracking system.

[0058] Specifically, after receiving the EJB call request from the client, the server-side interceptor may be enabled to intercept the EJB call request, so as to parse out the tracking information carried in the EJB call request and send it to the tracking system.

[0059] Step S24: Run the tracking system based on the tracking information to track the call link that the EJB call request has gone through.

[0060] The tracking system monitors EJB calls through the received tracking information, which helps to comprehensively evaluate the performance of the call link and the EJB business methods that need to be called, identify performance bottlenecks and optimize them, and improve business processing capabilities.

[0061] In summary, the embodiment of the present application uses the EJB call request to pass the tracking information of the request to the server, breaking through the obstacle in the prior art that the tracking information of the EJB call cannot be passed to the tracking system, enabling the EJB call to be included in the monitoring of the tracking system, completing the monitoring map of the tracking system, and ensuring the efficiency of troubleshooting EJB-related problems.

[0062] As explained above, Corba's interceptor function can be used to propagate tracking information. For example, when creating an object request broker (ORB, Object RequestBroker), you can set an org.omg.PortableIntercepter.ORBInitializer instance for the ORB (used to assist the client to transparently call methods on remote or local service objects) by specifying parameters, and add client-side request interceptors and server-side request interceptors to the ORB in the post_init method of the instance, thereby realizing the transmission of tracking information for EJB calls. Figure 3 As shown, some specific possible implementation examples will be provided below for illustration. In actual applications, the implementation contents between these examples can be combined or implemented separately as needed according to the corresponding functional principles and application logics. If implemented in combination, the execution order between the combined examples can be determined according to their respective processing logics, which can be determined by the actual scenario.

[0063] based on Figure 2 In some specific examples, the process of "distinguishing EJB call requests from various call requests initiated by the client" in step S21 may specifically include the following operations: if a method in the EJB Stub class with the same name as the business method is added with a status information code, the call request requesting to call the business method is distinguished as an EJB call request; the EJB Stub class is a client proxy that forwards the call request to the server, and the status information code is used to identify that the business method is a method recorded in the EJB business method list. In other words, the status information code can be used to identify that the current call belongs to an EJB call.

[0064] The above Stub can be understood as a proxy of the remote service on the client side, which implements the interface of the remote service and has all the business methods of the remote service. After the client gets the Stub, it can think that it is the remote object to be called and directly call its business method. The Stub completes the actual remote call and returns the call result to the caller, shielding all the complex underlying operations. Stub is usually a code dynamically generated by the program. It knows the address of the remote server. Through the Stub client, the remote object can be used like a local object, which provides great convenience for users to make remote calls.

[0065] Because business methods usually refer specifically to methods that actually execute business on the server side, and the method with the same name in the Stub (with the same name as the business method) is the client method used to call the business method with the same name on the server side, the above "the method with the same name as the business method in the EJB Stub class adds status information code" can actually be understood as a method with the same name in the client's EJB Stub class that contains status information.

[0066] As shown in the above example, the EJB business method list and the status information code added to the EJB Stub can be used in combination to distinguish whether the current call is an EJB call, and if it is an EJB call, tracking and monitoring can be performed. Specifically, the server generally has an EJB business method list itself. For example, the server can obtain the EJB business method list from the business interface of the EJB, thereby distinguishing which are EJB business methods, that is, the methods recorded in the EJB business method list can be classified as EJB business methods. In view of the fact that the effect to be achieved in the embodiment of the present application is to be able to pass tracking information only when calling the EJB method; the Stub class is divided into EJB Stub and other Stubs, and not all methods in the EJB Stub can call the EJB business method, so the status information code (or code enhancement) can be added to a calling method of the generated EJB Stub class, so that the client can distinguish that the current call is an EJB call when calling the EJB business method, and needs to be tracked, and then perform subsequent operations such as adding tracking information. In this way, when calling ordinary Corba methods other than EJB, tracking information will not be passed to avoid wasting resources.

[0067] It should be noted that ThreadLocal is a way to implicitly pass data across method calls in the same thread in Java; by saving data in a ThreadLocal variable in the current thread, the data previously placed in the ThreadLocal variable can be obtained in the same thread no matter how many methods are called later. Therefore, the status information code added to the above EJB Stub can be saved in ThreadLocal, so that in the same thread, the status information code can be used to know that it is currently in an EJB call and needs to pass tracking information. For example, in Corba's client interceptor, it is necessary to decide whether to pass tracking information to the server based on this status information code.

[0068] In practice, there are the following situations: if the current call is an EJB call, but the next call is a non-EJB call, then it is necessary to clear the status information code added to the current EJB Stub class for the previous EJB call, so as to avoid mistakenly thinking that the EJB call is still in progress and still executing subsequent operations such as passing tracking information, which wastes system resources; on the other hand, whether it is an EJB call mainly depends on the judgment of the application server. After completing the previous EJB call, if the current EJB call status (such as the status information code) is not cleared, the application server will make a wrong judgment, which will affect the tracking system and mistakenly treat the non-EJB call as an EJB call, causing the tracking system to make a wrong judgment. Therefore, based on Figure 2 In some specific examples, after step S21, the method of the embodiment of the present application may further include the following operation (clearing the status information code): after the call to the EJB business method is completed, the status information code in the EJB Stub class is cleared to re-distinguish whether the next call request is an EJB call request. Specifically, the functional code "for clearing the aforementioned status information code" may be added to the original code of the EJB Stub class to prevent subsequent non-EJB calls from mistakenly adopting the process of tracking EJB calls in this application, resulting in invalid cost investment.

[0069] based on Figure 2 In some specific examples, the specific operation process of step S22 may include (processing of the client): at the starting interception point of the client, assembling the tracking information into a structure in the target format and passing it to the server; the starting interception point is the pre-stage before the EJB business method is called.

[0070] Specifically, on the client side, a method can be provided for the tracing system to intercept, such as the encodeTraceContext(TraceContext) method. Initially, the parameter of this method is an empty TraceContext (i.e., tracing context) instance, and the return value is a byte array converted from the TraceContext instance filled with tracing information. For example, this method can be called in the starting interception point of the client interceptor, and then the software component Agent of the tracing system can intercept this method and add tracing information to the TraceContext instance. The format of this tracing information can be a key-value pair. Generally, it is required that both key and value are string types, because this is the most common type in all systems, which is easy to convert into a byte array and convenient for network transmission. After obtaining the byte array returned by the encodeTraceContext method, the byte array can be assembled into the Corba ServiceContext structure, and transmitted to the server side with the call request through the Corba mechanism, thereby realizing the transmission of tracing information.

[0071] The ServiceContext structure mechanism is a convenient way provided by Corba to transmit additional information without changing the IIOP protocol. Because the IIOP protocol does not recognize TraceContext, if the byte array converted from TraceContext is not placed in ServiceContext, the byte array cannot be directly transmitted without changing the protocol. Therefore, the byte array is assembled into Corba's ServiceContext structure for transmission.

[0072] To facilitate understanding, we now explain what it means for a method to be intercepted by the Agent. Take the encodeTraceContext(TraceContext) method as an example. The application server will call this method, and because this method is called, this method can be used as an interception point for the Agent. When this method is called by the application server, the Agent enters this method, which is called the method being intercepted by the Agent. At this point, it can be understood that calling and intercepting are not the same thing.

[0073] Although both are interceptions, the interception (1) in the "starting interception point" and the interception (2) in the "an interception point provided to the Agent" are also different. Interception 1 refers to a mechanism defined in the Corba specification, which can provide a pluggable structure somewhere in the code for adding some executable code. Interception 2 means that the application server provides certain methods for the Agent of the tracing system to intercept at the bytecode level, so that the tracing system can dynamically intervene in the execution of the application server code. The difference is that Interception 1 is actively called by the application server, while Interception 2 allows the Agent code of the tracing system to be executed at this point without the application server's knowledge. The interception method "Interception 2" is definitely also called by the application server, but is intercepted by the Agent.

[0074] The following will explain the server-side processing process in order to achieve the propagation of tracking information.

[0075] based on Figure 2 In some specific examples, the specific operation process of step S23 may include: extracting the structure at the start interception point of the server, and decoding the content of the structure (ie, the byte array) to restore the tracking information to the tracking system.

[0076] Specifically, after receiving the call request (carrying tracing information) from the client, the server-side interceptor can be called to intercept the method at the starting interception point. For example, at the starting interception point, the ServiceContext sent by the client can be obtained, and the byte array inside can be taken out and passed to a method for interception by the tracing system, such as the TraceContext decodeTraceContext(byte[]bytes,String operationName) method. This method will restore the byte array to a TraceContext instance object, and its return value is the restored TraceContext instance object. The tracing system can intercept this method to obtain tracing information and the name of the business method from TraceContext.

[0077] As a possible implementation, if the tracking system wants to know the execution time of the EJB business method in addition to the call link, the execution time can be the time difference from the start to the end of the business method execution. Then the tracking system can be required to intercept twice before and after the execution of the EJB business method on the server side, such as intercepting at the starting interception point and the ending interception point of the request interceptor on the server side. In other words, it can be understood that the tracking system calls the method twice: the method call at the starting interception point as above can be regarded as one of the interceptions (used to obtain tracking information), and the method call at the ending interception point described in detail below can be regarded as another interception (used to count the execution time of the EJB business method).

[0078] As another possible implementation, if the tracking system is forced to intercept only once, the execution time of the EJB business method can be counted. However, it is often difficult to surround the business method in one method because the timing of obtaining tracking information and execution time in the interceptor on the server side is not appropriate. Therefore, it is necessary to modify the implementation of Corba to obtain tracking information in advance. Please see below for details.

[0079] (1) Perform the other of the two interceptions on the server side.

[0080] based on Figure 2 In some specific examples, if it is limited to two interceptions on the server side to count the execution time of the EJB business method, then after step S23, the embodiment of the present application may also include the following operations: calling an end method at the end interception point of the server side to record the end time when the EJB business method is called; the end interception point is the post-stage after the EJB business method is called, and the end time is used to count the execution time of the EJB business method.

[0081] Specifically, if the tracking system needs to count the execution time of the EJB business method, the application server can call an ending method, such as the endCall() method, at the ending interception point of the server interceptor for the tracking system to intercept. The use of this endCall() method can, on the one hand, indicate the end of the EJB call, such as the EJB call request has received a response or result returned, and on the other hand, can record the end time of the EJB business method being called, so as to comprehensively count the execution time of the EJB business method. Among them, the start time of the EJB business method being executed can be recorded at the starting interception point.

[0082] Generally, for the tracing system, its starting point can only be the interception point provided by the application server to its agent, so the start time of the EJB business method can only be recorded by the agent at its first interception method (such as the starting interception point). As for an interception point between the starting interception point and the ending interception point, if no interception point is provided to the agent, the agent will have no way to record the start time of the EJB business method.

[0083] It should be noted that the above-mentioned starting interception point, ending interception point, and interception point provided to the agent, although they all have "interception" in their names, are completely different and cannot be compared. Starting interception point and ending interception point are concepts of application servers and Corba, and are interception points defined by the IIOP protocol Corba specification, and have nothing to do with the agent.

[0084] (2) Only one interception is performed on the server side.

[0085] based on Figure 2 In some specific examples, if it is limited to perform one interception on the server side to count the execution time of the EJB business method, then after step S23, the embodiment of the present application may also include the following operations: passing the extracted tracking information to a method to be intercepted, so as to count the execution time of the EJB business method through the method to be intercepted; the method to be intercepted is intercepted to record the time when the EJB business method required by the EJB call request is started to be called, and to record the time when the EJB business method is finished being called.

[0086] Specifically, if the tracking system requires that there can only be one interception point on the server side, then the two interception methods mentioned above cannot be used (which is easier to implement than the one interception method). In this case, it is not suitable to use the request interceptor on the server side, because if the Corba implementation obtains the tracking information at the starting interception point in the code structure, it is not easy to form a separate interception method that wraps the business method, so the tracking information must be obtained in advance before the starting interception point. Therefore, for example, after receiving the request sent by the client, the server can first parse the request header of the EJB call request according to the IIOP protocol specification, obtain the ServiceContext sent by the client, take out the byte array inside, and then restore it to a TraceContext instance object (carrying tracking information) and pass it to a method for the tracking system to intercept, such as the invoke method; the principle of restoring the tracking information on the server side here is similar to the above-mentioned method interception process at the starting interception point of the server, and the details are not repeated here.

[0087] The restored TraceContext instance object can be used as the first parameter of the invoke method, so that the tracking system can intercept the method and obtain the tracking information. After that, the invoke method (which can be regarded as a proxy) calls the EJB business method associated with the server, obtains the execution result of the EJB business method, and returns it to the client through the network. The invoke method here completely wraps the EJB business method, which makes it easy for the tracking system to intercept it once and calculate the execution time of the business method. The wrapping or encirclement of the embodiment of the present application can be understood as the difference in time from the beginning of the invoke method to the end of the processing of the EJB call, which can be approximately recorded as the execution time of the EJB business method; because the time difference between the two actions of "the invoke method just starts to process the EJB call" and "the EJB business method is started to be called" is small, it can be considered that the start time of the two is almost the same.

[0088] As mentioned above, the embodiment of the present application is only for monitoring EJB calls. If it is a normal Corba call of non-EJB, because the client does not send tracking information, the server will not receive the tracking information sent by the client. Therefore, the interception methods provided to the tracking system in the embodiment of the present application are not called, that is, the embodiment of the present application may not track these non-EJBs. Of course, if it is necessary to track non-EJB calls, it can also be expanded on the basis of the embodiment of the present application.

[0089] In summary Figure 3 As shown, the embodiment of the present application:

[0090] 1. You can enhance the code of EJB Stub, such as adding status information code for identifying EJB calls, so as to distinguish EJB calls from all Corba calls and track them specifically.

[0091] 2. You can register and use the Corba client's request interceptor, so that tracking information can be passed from the client to the server. That is, an interception point is provided for the tracking system on the client side to collect tracking information and facilitate the distributed call tracking system.

[0092] 3. You can register and use the Corba server's request interceptor (two or one interception) as needed. It has strong scalability, so that the tracking system can receive the tracking information sent by the client. That is, you can provide an interception point for the tracking system on the server side to restore the tracking information and provide it to the tracking system.

[0093] Among them, a suitable interception method that can wrap the business method can be provided to the tracking system to facilitate the statistics of the execution time of the EJB business method. If necessary, the server can provide a single interception point that wraps the business method, such as a third interception point in addition to the starting interception point and the ending interception point, and parse the request header in advance to obtain tracking information.

[0094] It can be seen that the embodiment of the present application enables EJB calls to be included in the monitoring of the distributed call tracking system, completing the monitoring map of the entire business system, and realizing distributed call tracking for EJB calls that carry important business logic, which is of great significance for the troubleshooting of EJB-related problems in system operation and performance monitoring.

[0095] Compared to Figure 2 The examples shown illustrate that the above-mentioned additional or detailed example contents or possible implementation methods do not necessarily have to be executed during the specific implementation. If more than two examples or possible implementation methods are added, these examples or possible implementation methods can be implemented in combination or separately. If implemented in combination, the execution order between the combined examples can be determined according to their respective processing logic, which can be determined according to the actual scenario.

[0096] See also Figure 4 The second aspect of the present application provides a specific embodiment of a system for tracing a call link, the system comprising:

[0097] The processing unit 401 is used to distinguish the EJB call request from the call requests initiated by the client, and add tracking information to the EJB call request; the tracking information is at least used to identify and track the EJB call request;

[0098] A transmission unit 402 is used to transmit the tracking information to the server along with the EJB call request;

[0099] The processing unit 401 is also used to intercept the EJB call request transmitted to the server to extract the tracking information to the tracking system;

[0100] The processing unit 401 is further configured to run a tracing system based on the tracing information to trace the call link that the EJB call request has gone through.

[0101] In some examples, the processing unit 401 is specifically configured to:

[0102] If a method in the EJB Stub class with the same name as the business method is added with a status information code, the call request for calling the business method will be distinguished as an EJB call request; the EJB Stub class is a client proxy that forwards the call request to the server, and the status information code is used to identify the business method as a method recorded in the EJB business method list.

[0103] In some examples, the processing unit 401 is further configured to:

[0104] After the call to the EJB business method is completed, the state information code in the EJB Stub class is cleared to re-distinguish whether the next call request is an EJB call request.

[0105] In some examples, the transmission unit 402 is specifically configured to:

[0106] At the start interception point of the client, the tracking information is assembled into a structure in the target format and passed to the server; the start interception point is the pre-stage before the EJB business method is called.

[0107] In some examples, the processing unit 401 is specifically configured to:

[0108] The structure is extracted at the start interception point of the server, and the content of the structure is decoded to restore the tracking information and pass it to the tracking system.

[0109] In some examples, if it is limited to perform two interceptions on the server side to count the execution time of the EJB business method, the processing unit 401 is further used to:

[0110] An end method is called at the end interception point of the server to record the end time of the EJB business method being called; the end interception point is the post-stage after the EJB business method is called, and the end time is used to count the execution time of the EJB business method.

[0111] In some examples, if it is limited to perform one interception on the server side to count the execution time of the EJB business method, the processing unit 401 is further used to:

[0112] The extracted tracking information is passed to a method to be intercepted, so as to count the execution time of the EJB business method through the method to be intercepted;

[0113] The method to be intercepted is intercepted to record the time when the EJB business method required by the EJB call request starts to be called, and to record the time when the EJB business method ends to be called.

[0114] In the embodiment of the present application, the operations performed by each unit of the system for tracking the call link are similar to the operations described in the first aspect or any specific method embodiment of the first aspect, and will not be described in detail here. Of course, the specific implementation process of each operation in the first aspect of the present application can also refer to the relevant description of the second aspect.

[0115] See also Figure 5The electronic device 500 of the embodiment of the present application may include one or more processors (such as central processing units (CPU)) 501 and a memory 505, in which one or more applications or data are stored.

[0116] The memory 505 may be a volatile storage or a persistent storage. The program stored in the memory 505 may include one or more modules, each of which may include a series of instruction operations in the electronic device. Furthermore, the processor 501 may be configured to communicate with the memory 505 and execute a series of instruction operations in the memory 505 on the electronic device 500.

[0117] The electronic device 500 may also include one or more power supplies 502, one or more wired or wireless network interfaces 503, one or more input and output interfaces 504, and / or one or more operating systems, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.

[0118] The processor 501 can execute the operations performed by the aforementioned first aspect or any specific method embodiment of the first aspect, and the details will not be repeated here.

[0119] The present application provides a computer-readable storage medium, comprising instructions, which, when executed on a computer, enable the computer to execute the method described in the first aspect or any specific implementation of the first aspect.

[0120] The present application provides a computer program product comprising instructions or a computer program. When the computer program product is run on a computer, the computer is enabled to execute the method described in the first aspect or any specific implementation of the first aspect.

[0121] It is understood that in various embodiments of the present application, the sequence number of each step does not mean the order of execution, and the execution order of each step should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application. The operation content added or refined in each example scheme of the above method, system or device (if any) does not necessarily have to be executed in the specific implementation. If more than two operations are added, these operations can be implemented in combination or separately, depending on the actual scenario.

[0122] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the system (if any) and device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.

[0123] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system or device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0124] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0125] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0126] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product. The computer software product (or computer program product) is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a business server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, read-only memory), random access memory (RAM, random access memory), disk or optical disk and other media that can store program code.

Claims

1. A method for tracking a call link, characterized in that: include: Distinguishing EJB call requests from various call requests initiated by the client, and adding tracking information to the EJB call requests; The tracking information is at least used to identify and track the EJB call request; Passing the tracking information along with the EJB call request to the server; Intercepting the EJB call request transmitted to the server to extract the tracking information and send it to the tracking system; The tracing system is run based on the tracing information to trace the call link that the EJB call request has gone through.

2. The method for tracing a call link according to claim 1, characterized in that: The step of distinguishing the EJB call request from the call requests initiated by the client includes: If a method in the EJB Stub class with the same name as the business method is added with a state information code, the call request for calling the business method is distinguished as an EJB call request; The EJB Stub class is a client proxy that forwards the call request to the server, and the status information code is used to identify that the business method is a method recorded in the EJB business method list.

3. The method for tracing a call link according to claim 2, characterized in that: After differentiating the call request for calling the EJB business method as an EJB call request, the method further includes: After the call to the EJB business method is completed, the state information code in the EJB Stub class is cleared to re-distinguish whether the next call request is an EJB call request.

4. The method for tracing a call link according to claim 1, characterized in that: The step of transmitting the tracking information along with the EJB call request to the server includes: At the start interception point of the client, the tracking information is assembled into a structure in a target format and transmitted to the server; the start interception point is a pre-stage before the EJB business method is called.

5. The method for tracing a call link according to claim 4, characterized in that: The intercepting of the EJB call request transmitted to the server to extract the tracking information to the tracking system includes: The structure is extracted at the start interception point of the server, and the content of the structure is decoded to restore the tracking information and transmit it to the tracking system.

6. The method for tracing a call link according to claim 1, characterized in that: If it is limited to intercept twice at the server end to count the execution time of the EJB business method, then after intercepting the EJB call request transmitted to the server end to extract the tracking information to the tracking system, the method further includes: Calling an end method at the end interception point of the server to record the end time when the EJB business method is called; The end interception point is a post-stage after the EJB business method is called, and the end time is used to count the execution time of the EJB business method.

7. The method for tracing a call link according to claim 1, characterized in that: If it is limited to intercept once at the server to count the execution time of the EJB business method, then after intercepting the EJB call request transmitted to the server to extract the tracking information to the tracking system, the method further includes: The extracted tracking information is transmitted to a method to be intercepted, so as to count the execution time of the EJB business method through the method to be intercepted; The method to be intercepted is intercepted to record the time when the EJB business method required by the EJB call request starts to be called, and to record the time when the EJB business method ends to be called.

8. A system for tracking call links, characterized in that: include: A processing unit, used to distinguish an EJB call request from various call requests initiated by the client, and add tracking information to the EJB call request; The tracking information is at least used to identify and track the EJB call request; A transmission unit, used to transmit the tracking information along with the EJB call request to the server; The processing unit is further used to intercept the EJB call request transmitted to the server to extract the tracking information to the tracking system; The processing unit is further configured to run the tracing system based on the tracing information to trace the call link that the EJB call request has gone through.

9. An electronic device, characterized in that: include: Processor and memory; The processor is configured to communicate with the memory and execute instructions in the memory to implement the method according to any one of claims 1 to 7.

10. A readable storage medium, characterized in that: The readable storage medium stores computer instructions, and when the computer instructions are executed by a processor, the method according to any one of claims 1 to 7 is implemented.

11. A computer program product, characterized in that The computer program product comprises computer instructions, which implement the method according to any one of claims 1 to 7 when executed by a processor.