# Patent

## Title
Application instrumentation code extension

## Abstract

The embodiments provide an application diagnostics apparatus including an instrumentation engine configured to monitor one or more methods of a call chain of the application in response to a server request according to an instrumentation file specifying which methods are monitored and which methods are associated with a code extension, an extension determining unit configured to determine that at least one monitored method is associated with the code extension based on code extension identification information, a class loading unit configured to load the code extension from a resource file when the at least one monitored method associated with the code extension is called within the call chain, a code extension execution unit configured to execute one or more data collection processes, and a report generator configured to generate at least one report for display based on collected parameters.

## Background
CROSS-REFERENCE TO RELATED APPLICATIONS
This application claims the benefit under 35 U.S.C. §119(e) of U.S. Provisional Patent Application Ser. No. 61/618,755, filed on Mar. 31, 2012. The disclosure of U.S. Provisional Application Ser. No. 61/618,755 is incorporated by reference herein in its entirety.


TECHNICAL FIELD
The present disclosure relates generally to application monitoring.
BACKGROUND
In most cases, a relatively large concern for customer facing Internet based applications (e.g., banking, retail, services) is the quality of service and/or end user experience for their customers. This service generally translates into server requests, e.g., associated with web-based applications, which are the entry points for customer-based transactions, and generally impact a company's ability to generate revenue. Currently, there are a number of methods that may monitor the performance of such web-based applications. However, most conventional monitoring products have a fixed set of instrumentation that is applied to measuring the round trip (and associated dependencies) for an individual server request. For example, a monitoring product may measure the incremental flow through the actual application method calls that service that request. The classes containing the method calls are generally instrumented in such a way that the instrumentation (which is inserted for interception) is called when the method is entered and called when the method is exited. The instrumentation in most cases is based on a descriptive file (e.g., instrumentation file, recording file, etc.) that essentially identifies the particular classes and methods to be monitored, as well as how they should be handled and what information should be collected.
However, in the event that the customer wishes to change the instrumentation and/or has a new set of customized methods that the customer wishes to monitor, implementing dynamic/custom changes in a timely manner without affecting the application is a difficult challenge. For example, in order to deploy a customized change to the underlying instrumentation, the application may have to be shut down for a lengthy period of time, which may be cost prohibitive and/or disadvantageous when assisting customers who desire to minimize downtime (e.g., some restarts can be excess of 45 minutes to complete). Further, making changes to the underlying instrumentation is a complex process that requires a relatively significant amount of time to implement, and often involving a highly skilled person with an in-depth understanding of the instrumentation product and/or the underlying server application.
SUMMARY
Embodiments provide an application diagnostics apparatus for monitoring performance of an application executing on an application server. The application diagnostics apparatus includes at least one processor and a non-transitory computer-readable storage medium including instructions executable by the at least one processor. The instructions are configured to implement an instrumentation engine configured to monitor one or more methods of a call chain of the application in response to a server request according to an instrumentation file. The instrumentation file specifies which methods are monitored and which methods are associated with a code extension. The instructions are configured to implement an extension determining unit configured to determine that at least one monitored method is associated with the code extension based on code extension identification information being included in the instrumentation file, a class loading unit configured to load the code extension from a resource file storing a plurality of code extensions using the code extension identification information when the at least one monitored method associated with the code extension is called within the call chain, a code extension execution unit configured to execute one or more data collection processes specified by the code extension at an exit point of the at least one monitored method including obtaining at least one parameter related to the at least one monitored method, and a report generator configured to generate at least one report for display based on the obtained at least one parameter.
The application diagnostics apparatus also includes a code extension updating unit configured to update the code extension or add one or more new code extensions based on information received via a code extension interface. In one embodiment, the code extension updating unit is configured to update the code extension or add the one or more new code extensions without restarting the application.
The instrumentation engine configured to monitor one or more methods of a call chain of the application in response to a server request according to an instrumentation file may include intercepting the one or more methods according to the instrumentation file, interjecting code at entries and exits of the one or more methods, and monitoring the one or more methods in response to the server request during runtime of the call chain.
According to one embodiment, the instrumentation file may include a plurality of rules, and each rule specifies at least one method to be monitored. At least one of the rules may include information identifying the at least one monitored method, tier information identifying which tier the at least one monitored method is located, signature information, and the code extension identification information. The code extension identification information includes information identifying the code extension and location information specifying the resource file.
The class loading unit may be configured to load the code extension from the resource file using a same class loader that was used to load the application. According to an embodiment, the class loading unit may be configured to rename a class associated with code extension to a unique class name, and call the same class loader that was used to load the application. The at least one parameter may include an argument and return value of the at least one monitored method.
The report generator may include a parameter map generator configured to generate a parameter map based on the obtained at least one parameter, where the parameter map includes at least one key-value pair representing a parameter and associated value, and an analysis unit configured to analyze the parameter map and generate the at least one report based on the analyzed parameter map.
The embodiments provide a method for monitoring performance of an application executing on an application server performed by one or more processors. The method may include monitoring one or more methods of a call chain of the application in response to a server request according to an instrumentation file, where the instrumentation file specifies which methods are monitored and which methods are associated with a code extension, determining that at least one monitored method is associated with the code extension based on code extension identification information being included in the instrumentation file, loading the code extension from a resource file storing a plurality of code extensions using the code extension identification information when the at least one monitored method associated with the code extension is called within the call chain, executing one or more data collection processes specified by the code extension at an exit point of the at least one monitored method including obtaining at least one parameter related to the at least one monitored method, and generating at least one report for display based on the obtained at least one parameter.
The method may further include updating the code extension or adding one or more new code extensions based on information received via a code extension interface. According to one embodiment, the updating/adding step may update the code extension or adds the one or more new code extensions without restarting the application.
The instrumentation file may include a plurality of rules, and each rule may specify at least one method to be monitored. At least one of the rules may include information identifying the at least one monitored method, tier information identifying which tier the at least one monitored method is located, signature information, and the code extension identification information.
In one embodiment, the loading step may load the code extension from the resource file using a same class loader that was used to load the application. Also, the generating step may include generating a parameter map based on the obtained at least one parameter, where the parameter map includes at least one key-value pair representing a parameter and associated value, and generating the at least one report based on the parameter map.
The embodiments provide a non-transitory computer-readable medium storing instructions that when executed cause one or more processors to perform a monitoring process. The instructions comprising instructions to monitor one or more methods of a call chain of the application in response to a server request according to an instrumentation file, where the instrumentation file specifies which methods are monitored and which methods are associated with a code extension, determine that at least one monitored method is associated with the code extension based on code extension identification information being included in the instrumentation file, load the code extension from a resource file storing a plurality of code extensions using the code extension identification information when the at least one monitored method associated with the code extension is called within the call chain, execute one or more data collection processes specified by the code extension at an exit point of the at least one monitored method including obtaining at least one parameter related to the at least one monitored method, and generate at least one report for display based on the obtained at least one parameter.
The instructions may include instructions to update the code extension or add one or more new code extensions based on information received via a code extension interface. In one embodiment, the code extension(s) is/are updated or added without restarting the application.



BRIEF DESCRIPTION OF THE DRAWINGS
FIG. 1 illustrates an application diagnostics apparatus for monitoring performance of application executing on an application server according to an embodiment;
FIG. 2 is a flowchart illustrating example operations of the application diagnostics apparatus of FIG. 1 according to an embodiment;
FIG. 3 illustrates an application flow report provided by the application diagnostic apparatus of FIG. 1 according to an embodiment;
FIG. 4 illustrates a code level report provided by the application diagnostic apparatus of FIG. 1 according to an embodiment; and
FIG. 5 illustrates an overview report provided by the application diagnostic apparatus of FIG. 1 according to an embodiment.



DESCRIPTION OF EXAMPLE EMBODIMENTS
The embodiments provide an application diagnostics apparatus for monitoring performance of an application executing on an application server. The application diagnostics apparatus allows a user to dynamically extend the functionality of an application diagnostics module without requiring the application to be restarted and alter the monitoring effectiveness with “surgical” precision. The extension of the application diagnostics module may be implemented via one or more code extensions within an instrumentation file. The instrumentation file may specify, in part, which methods are monitored and which methods are associated with the code extension. The code extension itself provides the logic for performing one or more data collection processes such as the capturing of parameters (e.g., key parameter indicators (KPIs)) as well as potentially altering the application flow itself during runtime of the application. The code extensions may be able to dynamically insert themselves into the application in an accurate manner (e.g., loaded with an appropriate class loader) without the need to restart the application. Also, developers of the code extensions do not necessarily have to have in-depth knowledge of the instrumentation product. Rather, the development of the code extensions may be accomplished via an extensions code interface, and, when implemented, may permit virtually any programmer with sufficient domain knowledge to create and maintain the code extensions without requiring in-depth knowledge of the inner workings of the instrumentation engine, which is generally the most complex part of these types of products.
Furthermore, because the modification or the addition of code extensions do not require application restart (e.g., some applications may take over 45 minutes to restart) and the development of the code extension may not require in-depth knowledge of the underlying instrumentation, the amount of time required to make a change/modification/addition from proof of concept (POC) to development may be significantly decreased. The data collection processes specified by the code extensions may obtain valuable information regarding the operations of the methods calls initiated by the server requests, which may be actual new KPIs or contextual information specific to such methods. This information may be analyzed and presented to the user in the form of reports that may provide useful insight in evaluating the performance of an application such as the amount of time to execute certain method calls, the arguments and/or return values for the methods calls, and/or other information (e.g., the latencies within each tier of an application and other server performance metrics). In short, the application diagnostics apparatus may have the ability to provide customized instrumentation (e.g., code extensions) that are implemented on the fly without requiring in-depth expertise of the instrumentation product and without being invasive to the operation of the application.
FIG. 1 illustrates an application diagnostics apparatus 102 for monitoring performance of application 104 executing on an application server 100 according to an embodiment. The application server 100 may include an application 104 that performs a series of methods 105 such as method 105-1, method 105-2 and method 105-3, for example. The application 104 may be executing on an operating system of the application server 100, and may be any type of application that provides a service, such as internet-based web applications in the areas of banking, retail and/or any other type of business area. In one embodiment, the application 104 may be a Java EE (J2EE) or .Net based application.
The application server 100 may include the application diagnostics apparatus 102 configured to monitor the performance of the application 104 executing on the application server 100. For example, the application 104 may receive a server request that starts or prompts the execution of the methods 105 according to a call chain initiated by the server request. The server requests may be in the form of general Hypertext Transfer Protocol (HTTP) posts, Java Message Service (JMS) messaging, or Representational State Transfer (REST)/Remote Procedure Calls (RPC) based web service requests, and are, generally, the entry points into the application 105. In one example, the server request may be a login to a banking transaction, for example.
The application diagnostics apparatus 102 may monitor the performance of the application 104, such as the entries into the methods 105 and the exits out of the methods 105, and create a call chain including the methods which were entered and exited in the course of the server request. Generally, the application diagnostics apparatus 102 may measure the amount of time spent in each part of the call chain, and collect information regarding the specific attributes of each part of the application that was utilized by the called methods 105. In particular, the application diagnostics apparatus 102 may capture/collect KPIs, metrics and/or properties that occur within the call chain initiated by the server request. From this information, the application diagnostics apparatus 102 may generate one or more reports (and or SLA alerts) analyzing the performance of the application 104.
The application diagnostics apparatus 102 may include an instrumentation file 106, an instrumentation engine 110, an extension determining unit 112, a resource file 114, a code extension execution unit 122, a report generator 124, a code extension updating unit 130, and a code extension interface 132. Also, the application diagnostics apparatus 102 may include other components that are well known to one of ordinary skill in the art.
The instrumentation engine 110 may monitor one or more methods 105 of a call chain of the application 104 in response to the server request according to the instrumentation file 106. The instrumentation file 106 may include information that specifies which methods are monitored. In some examples, the instrumentation file 106 may also be referred to as a recording file, rules file, or apoints file. The instrumentation engine 110 may intercept the one or more methods 105 according to instructions specified in the instrumentation file 106, interject code at entries and exits of the one or more methods 105, and monitor the one or more methods 105 during runtime of the call chain, which may include the capture/collection of parameters related to the specified methods 105. According to the embodiments, the instrumentation file 106 may also include code extension information 108 specifying which methods 105 are associated with a code extension. The code extension 116 itself provides, in part, the logic for performing one or more data collection processes such as the capturing of parameters (e.g., key parameter indicators (KPIs)) as well as potentially altering the application flow itself. In addition, the code extension 116 may provide the ability to change a user interface associated with the application 104.
According to the embodiments, the instrumentation file 106 associates the code extension with a particular rule, which controls which methods 105 should be instrumented/collected at runtime. The instrumentation file 106 may include a plurality of rules, and each rule may specify one or more methods 105 to be monitored. An example portion of the instrumentation file 106 is illustrated below.












#


# Servlets Service


#


<GenericServlet>


tier=web


containsclass=javax.servlet.http.HttpServlet


method=doPost,doGet


signature=(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/


HttpServletResponse;)V


snapin=com.bmc.aps.agent.trace.ServletMethodParameterSnapin@


snapins-adops.jar


modifiers=deep,entrypoint,priority:2









The above example illustrates a single rule (e.g., GenericServlet) included in the instrumentation file 106. However, the instrumentation file 106 may include any number of rules. At least some of the rules may be associated with the code extension 116, as illustrated in the above example (e.g., referred as a “snapin”). For example, a rule may specify one or more methods 105 to be monitored, class information specifying the class associated with the one or more methods 105, tier information identifying which tier the one or more methods 105 are located, signature information, the code extension information 108, and one or more modifiers. Referring to the above example, the GenericServlet rule includes the tier information (e.g., tier=1), the class information (e.g., containsclass=javax.servlet.http.HttpServlet), the methods to be monitored (e.g., doPost and doGet), signature information (e.g., Ljavax/serlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;), the code extension information 108 (e.g., snapin=com.bmc.aps.agent.trace.ServletMethodParameterSnapin@snapins-adops.jar), and the modifiers (e.g., deep,entrypoint,priority:2).
In more detail, the code extension information 108 may include information identifying the code extension (e.g., ServletMethodParameterSnapin) and location information specifying the resource file 114 (@snapins-adops.jar). The resource file 114 may be a designated source archive that stores a plurality of code extensions 116. In one embodiment, the resource file 114 may be a Java Archive (JAR) file. The code extensions 116 may be stored in the resource file 114 in such a manner that the code extensions 116 are autonomous. In other words, the code extensions 116 are not dependent on any other information stored in the resource file 114. For example, the resource file 116 may also include customer information or any other type of information commonly stored in a JAR file. However, the code extensions 116 are packaged in the resource file 114 such that they are not dependent on any other information contained in the resource file 116.
The methods 105 (e.g., doPost and doGet) should contain the identified signature information, and the modifiers place limits on the implementation rule. For example, the modifier “deep” refers to the action of searching through all inherited classes of the identified methods 105. For instance, if the rule did not contain the modifier “deep”, the instrumentation engine 110 may only look at the initial class being evaluated. Also, the modifiers may include priority information (e.g., priority:2), which indicates the priority of the rule. For example, as indicated above, there may be a number of different rules specifying different methods to be monitored. As such, two or more rules may apply to the same method. The instrumentation engine 110 may select one of the rules based on the priority information provided by the modifiers. The above described modifiers are merely examples, where the embodiments encompass many different types and variations of modifying instruments that place limits on the implementation rule.
When the application 104 is loaded, the instrumentation engine 110 may review every class associated with the methods 105 of the application 104, and if one or more of the rules apply to the loaded class, the instrumentation engine 110 instruments the specified methods 105 by inserting code at the entries and exits of the specified methods 105. The loading unit 118 may utilize an appropriate loader 120 for loading the various classes of the application 104 as specified by the methods 105. When the loader 120 loads the classes corresponding to the respective method 105, the instrumentation engine 110 may review the loaded classes, and if one or more of the rules applies to the loaded class, the instrumentation engine 110 may instrument the specified methods 105 by inserting code at the entries and exits of the specified methods 105.
Thereafter, during runtime of the application 104 (e.g., after it has been loaded), the application 104 proceeds to call the appropriate methods 105 by the call chain instituted by the server request. During runtime, an extension determining unit 112 may be configured to determine that the one or more methods 105 specified in the rule are associated with the code extension 116 based on the code extension information 108. For example, if the rule includes the code extension information 108, the extension determining unit 112 determines that the one or more specified methods 105 are associated with the code extension 116. Thereafter, the loading unit 118 dynamically loads the code extension 116 from the resource file 114, and the code extension execution unit 122 may carry out one or more data collection processes as specified by the code extension 116, as further described below.
Also, it is noted that the extension determining unit 112 may determine that a particular method identified in the instrumentation file 106 is not associated with the code extension 116. In this case, the instrumentation engine 110 may perform basic instrumentation functionalities associated with the identified method such as the collection of parameters and the timing associated with each identified method. However, the code extension 116 provides the ability for the application diagnostics apparatus 102 to collect additional parameters above and beyond the basic instrumentation such as the ability to derive new KPIs. Further, it is also noted that not every method within the call chain is instrumented. For instance, the instrumentation file 106 usually specifies which method an owner/operator of the application 104 is interested.
The loading unit 118 may load the code extension 116 from the resource file 114 using the code extension information 108 when the monitored one or more methods 105 are called within the call chain. For example, the loading unit 118 loads the code extension 116 specified by the code extension information 108. In one embodiment, the loading unit 118 may be configured to determine which loader was used to load the application 104, and select the same loader (e.g., loader 120) to load the code extension 116 from the resource file 114. As a result, the code extension 116 may be loaded into the proper location in order to ensure that the application 104 continues to execute in a proper manner.
According to one embodiment, the loading unit 118 may use one or more techniques in order to bypass class loading delegation. Class loading delegation refers to the action of delegating downstream in order to locate a certain class. For example, the application 104 may be associated with a number of hierarchical class loaders in the order of a boot class loader, an extensions class loader, an application class loader, and a WAR class loader. If the application is using the WAR class loader and a request for a class is received, the WAR class loader will delegate downstream to the boot class loader. Then, the boot class loader will attempt to locate the class, and if a match was not found, the next class loader in the hierarchy (e.g., the extensions class loader) will attempt to locate the class. This process is repeated until reaching the WAR class loader. For example, if none of the parents to the requested loader finds a match, the requested class loader will be used to load the class.
In order to prevent class loading delegation, according to one technique, the class loading unit 118 may be configured to rename a class associated with the code extension 116 to a unique class name. For example, by giving the class a unique name, one or more parent class loaders will never find a match to the class name. As such, the requested class loader will always be used to load the extension. According to another technique, the class loading unit 118 may directly call the same class loader 120 that was used to load the application 104 (e.g., found by traversing the original class data structure) after directly loading the re-named class into the loader 120. As a result, bypass delegation may be prevented, which ensures that the loaded code extension 116 is loaded into same class loader as the class being instrumented which insures proper access to that classes internal and referenced classes.
Once loaded, a code extension execution unit 122 may be configured to execute one or more data collection processes specified by the code extension 116 at an exit point of the one or more monitored methods 105. Although the code extension execution unit 122 (and extension determining unit 112) is illustrated as a separate logic block from the instrumentation engine 110, the code extension execution unit 122 (and extension determining unit 112) may be included in, or otherwise associated with, the instrumentation engine 110. The one or more data collection processes may include obtaining one or more parameters associated with the one or more monitored methods 105. For example, the code extension execution unit 122 may collect KPIs, parameters, attributes, and/or other information related to the monitored methods 105. The collected KPIs/parameters/attributes may include the arguments and return values associated with the monitored methods. Also, it is noted that the code extension execution 122 is configured to collect the parameters at the exit point of the monitored methods 105 in order to process the return values of the called methods. From the arguments and return values, new information such as KPIs may be derived or created, which may provide insight into how the application 104 is performing. Although the code extension 116 has been described with reference to a somewhat generic code extension 116, each code extension 116 is specific to the type of environment of the executed method(s) and well as the type of server request. As such, the collected parameters may encompass virtually any type of parameter associated with the called methods.
The code extension updating unit 130 may be configured to update the code extension 116 and/or add one or more new code extensions based on information received from the code extension interface 132. In one embodiment, the code extension updating unit 130 may be configured to update the code extension or add the one or more new code extensions without restarting the application. For example, the code extension 116 may be conformed to the code extension interface 132, and, when implemented, permits a developer to change/modify/delete/add one or more code extensions 116. An example code extension interface 132 is illustrated below.












publicstaticinterface IMethodParameterSnapin {


      public java.util.Map executeMethodParameterSnapin(Class


clazz,String methodName,Object inst,Object ret,Object[ ] args,Map


snapinServerRequestMap,Map snapinUniversalMap, Throwable t);


      public String dumpSnapin(Class clazz,String


methodName,Object inst,Object ret,Object[ ] args,Map


snapinServerRequestMap,Map snapinUniversalMap);


      public String dumpMap(Map map);


      publicboolean init(RecordingRuleHandler.RecordingRule


iRule,boolean snapinDebug);


      public RecordingRuleHandler.RecordingRule getRule( );


      public String getEntryPointName(String className,String


methodName,Object[ ] webArgs);









The above example relates to a code extension 116 called “IMethodParameterSnapin.” The example code extension interface 132 provides the code in order to update the code extensions 116 in the resource file 114 as well as the code extension information 108 in the instrumentation file 106. Basically, the code extension interface 132 describes the capabilities of the code extension 116.
Generally, the code extension execution unit 122 includes an ability to use the arguments and/or return values to create key parameters on the fly. These parameters may be transferred to the report generator 124 for further processing. The report generator 124 may be configured to generate one or more reports based on the obtained parameters. For example, the report generator 124 may include a parameter map generator 126 and an analysis unit 128. The parameter map generator 126 may be configured to generate a parameter map based on the obtained parameters. In one embodiment, the parameter map may include a number of key-value pairs, where each key-value pair represents a collected parameter and associated value. For example, the parameter map generator 126 may be configured to populate a parameter map with the parameters obtained by the code extension execution unit 122. The analysis unit 128 may be configured to analyse the parameter map and generate one or more reports based on the analysed parameter map. The one or more reports may be provided to a user interfere for display such as the code extension interface 132. The reports are further illustrated with respect to FIGS. 3-5.
As indicated above, the actual contents of the code extension 116 can widely vary depending on the application component being used to execute the specified method (e.g., database call) and the type of server request. However, a specific example of the code extension 116 is provided below.












  //


  // Handle Company Specific HTTP Communications for EDI


(Electronic Data Interchange)-AcmeBank


  //


  public class ACME_EDI_MethodParameterSnapin extends


BaseMethodParameterSnapin


  {


  //


  // Constructor - to set Logging Class for Snapin


  //


    public ACME_EDI_MethodParameterSnapin( )


    {


    super(“ACME_EDI ”);


    }


  //


  // Entry Point-it's a Servlet accepting REST parameters


  //


    public java.util.Map executeMethodParameterSnapin(Class


clazz, java.lang.reflect.Method methodObject, Object inst, Object


ret, Object[ ] args, Map snapinServerRequestMap,


Map snapinUniversalMap, Throwable t)


    {


      javax.servlet.http.HttpServletRequest


req=(javax.servlet.http.HttpServletRequest)args[0];


      javax.servlet.http.HttpServletResponse


res=(javax.servlet.http.HttpServletResponse)args[1];


  //


  // Find out something about the user for our


  marketing department


  //


      ParametersMap parametersMap = ParametersMap


parametersMap = new ParametersMap( );


      parametersMap.add(“ClientType”, req.getHeader(“user-


agent”));


      parametersMap.add(“ClientIP”, req.getRemoteUser( ));


  //


  // Find out the origin of the client, flag certains clients for our


  security department


  //


      parametersMap.add(“RedFlag”,


isSuspicious(req.getRemoteUser( ));


  //


  // get the Transaction Name and Id


  //


      parametersMap.add(“TransId”,


      req.getParameter(“TransId”));


      parametersMap.add(“TransName”,


req.getParameter(“TransName”));


  //


  // get the Source and Destinations Account


  // parametersMap.add(“Source”,


req.getParameter(“SourceBank”));


      parametersMap.add(“Destination”,


req.getParameter(“DestBank”));


  //


  // Transfer Time


  //


      parametersMap.add(“TransferTime”,


req.getParameter(“TransferTimeGMT”));


      return parametersMap;


    }


  //


  // Name the entry Point


  //


      public EntryPointRulesHandler.EntryPointObject


getEntryPointInfo(String entryPointPrefix,String className,String


methodName,Object[ ] webArgs)


      {


      javax.servlet.http.HttpServletRequest


req=(javax.servlet.http.HttpServletRequest)webArgs[0];


      javax.servlet.http.HttpServletResponse


res=(javax.servlet.http.HttpServletResponse)webArgs[1];


    return req.getParameter(“TransName”)+


    req.getParameter(“TransId”);


      }


  }









FIG. 2 is a flowchart illustrating example operations of the application diagnostics apparatus 102 of FIG. 1 according to an embodiment. Although FIG. 2 is illustrated as a sequential, ordered listing of operations, it will be appreciated that some or all of the operations may occur in a different order, or in parallel, or iteratively, or may overlap in time.
One or more methods of a call chain of the application may be monitored in response to a server request according to an instrumentation file (202). For example, the instrumentation engine 110 may monitor one or more methods 105 of a call chain of the application 104 in response to the server request according to the instrumentation file 106. The instrumentation file 106 may include information that specifies which methods are monitored. The instrumentation engine 110 may intercept the one or more methods 105 according to instructions specified in the instrumentation file 106, interject code at entries and exits of the one or more methods 105, and monitor the one or more methods 105 during runtime of the call chain, which may include the capture/collection of parameters related to the specified methods 105. According to the embodiments, the instrumentation file 106 may also include the code extension information 108 specifying which methods 105 are associated with a code extension. The code extension 116 itself provides, in part, the logic for performing one or more data collection processes such as the capturing of parameters (e.g., key parameter indicators (KPIs)) as well as potentially altering the application flow itself.
At least one monitored method may be determined as being associated with the code extension based on code extension identification information being included in the instrumentation file (204). During runtime, the extension determining unit 112 may be configured to determine that the one or more methods specified in the rule(s) in the instrumentation file 106 are associated with the code extension 116 based on the code extension information 108. For example, if the rule(s) include(s) the code extension information 108, the extension determining unit 112 determines that the one or more specified methods are associated with the code extension 116.
The code extension may be loaded from a resource file storing a plurality of code extension using the code extension identification information when the at least one monitored method associated with the code extension is called within the call chain (206). The loading unit 118 may load the code extension 116 from the resource file 114 using the code extension information when the monitored one or more methods 105 are called within the call chain. For example, the loading unit 118 may load the code extension 116 specified by the code extension information 108. In one embodiment, the loading unit 118 may be configured to determine which loader was used to load the application 104, and select the same loader (e.g., loader 120) to load the code extension 116 from the resource file 114. As a result, the code extension 116 may be loaded into the proper location in order to ensure that the application 104 continues to execute in a proper manner.
One or more data collection processes specified by the code extension may be executed at an exit point of the at least one monitored method (208). Once loaded, a code extension execution unit 122 may be configured to execute one or more data collection processes specified by the code extension 116 at an exit point of the one or more monitored methods 105. The one or more data collection processes may include obtaining one or more parameters associated with the one or more monitored methods 105. For example, the code extension execution unit 122 may collect KPIs, parameters, attributes, and/or other information related to the specified methods 105. The collected KPIs/parameters/attributes may include the arguments and return values associated with the monitored methods 105. From the arguments and return values, new information such as KPIs may be derived or created, which may provide insight into how the application 104 is performing. However, generally, the collected parameters may encompass virtually any type of parameter associated with the called methods.
At least one report for display may be generated based on the obtained at least one parameter (210). The report generator 124 may be configured to generate one or more reports based on the obtained parameters. For example, the report generator 124 may include a parameter map generator 126 and an analysis unit 128. The parameter map generator 126 may be configured to generate a parameter map based on the obtained parameters. In one embodiment, the parameter map may include a number of key-value pairs, where each key-value pair represents a collected parameter and associated value. In example, the parameter map generator 126 may be configured to populate a parameter map with the parameters obtained by the code extension execution unit 122. The analysis unit 128 may be configured to analyse the parameter map and generate one or more reports based on the analysed parameter map.
FIGS. 3-5 illustrate screen shots 500, 600, 700 depicting example reports generated by the report generator 124 for display according to the embodiments. For example, the information provided in the screen shots 500, 600, 700 may have been collected using the code extensions 116 described above. The screen shots 500, 600, 700 provide general information regarding the call chain of a particular server request such as the captured instance full path, the time and date, the latency and whether the call chain encountered any errors. Further, according to the embodiments, the report generator 124 may generate an overview report, an application flow report, and a code level report.
FIG. 3 illustrates the application flow report generated by the report generator 124 according to an embodiment. The application flow report includes detailed information regarding each flow component 502 of the application flow such the identity of each flow component (e.g., 502-1, 502-2 and 502-3). In addition, the application flow report may include detailed information 504 regarding each application flow component. In the example of FIG. 4, the detailed information 504 includes information regarding the application component 502-1 such as the identified methods, information regarding the user agents, and other attributes of the application flow component such as the language, cookies, host and encoding.
FIG. 4 illustrates the code level report generated by the report generator 124 according to an embodiment. The code level report includes detailed information regarding each called method 602. In addition, the code level report may provide detailed information regarding each task within a particular method as such as the tasks listed with respect to called method 602-1. In addition, the code level report may provide information regarding the amount of time that was required to execute each called method 602. Further, the code level report may provide a parameter table 604 for a particular called method, which may provide the arguments and/or return values as well as other contextual information.
FIG. 5 illustrates the overview report generated by the report generator 124 according to an embodiment. The overview report may provide high level information regarding the performance of the application 104. For example, the overview report may provide a breakdown by tier 702, server properties 704, tier latencies 706 and server performance 708. With respect to the breakdown by tier component 702, this section may provide information regarding the usage across different tiers such as the business tier, web tier and database tier. With respect to the server properties component 704, this section may provide the server name, the server type, the server version and platform, as well as any other type of information regarding the server. With respect to the tier latencies component 706, this section may provide an overview of the latencies that occurred within each tier in the form of a graph. It is noted that the embodiment may encompass any type of graphical representation of the collected parameters that is known in the art. With respect to the server performance component 708, this section may provide the amount of usage of each server component such as the computer processing unit (CPU), memory unit, deadlocks and/or threads across various time intervals such as hour, day or week, for example.
In summary, the application diagnostics apparatus 102 may allow a user to dynamically extend the functionality of an application diagnostics module via one or more code extension 116 within the instrumentation file 106. The instrumentation file 106 may specify, in part, which methods are monitored and which methods are associated with the code extension. The code extension 116 itself provides the logic for performing one or more data collection processes such as the capturing of parameters (e.g., key parameter indicators (KPIs)) as well as potentially altering the application flow itself during runtime of the application. The code extensions 116 may be able to dynamically insert themselves into the application 104 in an accurate manner (e.g., loaded with an appropriate class loader—120) without the need to restart the application 104. Also, developers of the code extensions 116 do not necessarily have to have in-depth knowledge of the instrumentation engine. Rather, the development of the code extensions 116 may be accomplished via the extensions code interface 132, and, when implemented, may permit virtually any programmer with sufficient domain knowledge to create and maintain the code extensions 116 without requiring in-depth knowledge of the inner workings of the instrumentation engine, which is generally a highly complex component. The information collected by the code extensions 116 maybe analyzed and presented to the user in the form of reports that may provide useful insight in evaluating the performance of the application 104 such as the amount of time to execute certain method calls, the arguments and/or return values for the methods calls, and/or other information such as the latencies within each tier of the application 104 and other server performance metrics. In short, the application diagnostics apparatus 102 may have the ability to provide customized instrumentation (e.g., code extensions) that are implemented on the fly without requiring in-depth expertise of the instrumentation engine and without being invasive to the operation of the application 104.
Implementations of the various techniques described herein may be implemented in digital electronic circuitry, or in computer hardware, firmware, software, or in combinations of them. Implementations may implemented as a computer program product, i.e., a computer program tangibly embodied in an information carrier, e.g., in a machine-readable storage device or in a propagated signal, for execution by, or to control the operation of, data processing apparatus, e.g., a programmable processor, a computer, or multiple computers. A computer program, such as the computer program(s) described above, can be written in any form of programming language, including compiled or interpreted languages, and can be deployed in any form, including as a stand-alone program or as a module, component, subroutine, or other unit suitable for use in a computing environment. A computer program can be deployed to be executed on one computer or on multiple computers at one site or distributed across multiple sites and interconnected by a communication network.
Method steps may be performed by one or more programmable processors executing a computer program to perform functions by operating on input data and generating output. Method steps also may be performed by, and an apparatus may be implemented as, special purpose logic circuitry, e.g., an FPGA (field programmable gate array) or an ASIC (application-specific integrated circuit).
Processors suitable for the execution of a computer program include, by way of example, both general and special purpose microprocessors, and any one or more processors of any kind of digital computer. Generally, a processor will receive instructions and data from a read-only memory or a random access memory or both. Elements of a computer may include at least one processor for executing instructions and one or more memory devices for storing instructions and data. Generally, a computer also may include, or be operatively coupled to receive data from or transfer data to, or both, one or more mass storage devices for storing data, e.g., magnetic, magneto-optical disks, or optical disks. Information carriers suitable for embodying computer program instructions and data include all forms of non-volatile memory, including by way of example semiconductor memory devices, e.g., EPROM, EEPROM, and flash memory devices; magnetic disks, e.g., internal hard disks or removable disks; magneto-optical disks; and CD-ROM and DVD-ROM disks. The processor and the memory may be supplemented by, or incorporated in special purpose logic circuitry.
To provide for interaction with a user, implementations may be implemented on a computer having a display device, e.g., a cathode ray tube (CRT) or liquid crystal display (LCD) monitor, for displaying information to the user and a keyboard and a pointing device, e.g., a mouse or a trackball, by which the user can provide input to the computer. Other kinds of devices can be used to provide for interaction with a user as well; for example, feedback provided to the user can be any form of sensory feedback, e.g., visual feedback, auditory feedback, or tactile feedback; and input from the user can be received in any form, including acoustic, speech, or tactile input.
Implementations may be implemented in a computing system that includes a back-end component, e.g., as a data server, or that includes a middleware component, e.g., an application server, or that includes a front-end component, e.g., a client computer having a graphical user interface or a Web browser through which a user can interact with an implementation, or any combination of such back-end, middleware, or front-end components. Components may be interconnected by any form or medium of digital data communication, e.g., a communication network. Examples of communication networks include a local area network (LAN) and a wide area network (WAN), e.g., the Internet.
While certain features of the described implementations have been illustrated as described herein, many modifications, substitutions, changes and equivalents will now occur to those skilled in the art.

## Claims

1. An application diagnostics apparatus comprising:
at least one processor;
a non-transitory computer-readable storage medium including instructions executable by the at least one processor, the instructions configured to implement,
an instrumentation engine configured to monitor an application executing on an application server based on an instrumentation file including monitoring one or more methods of a call chain of the application in response to a server request directed to the application, the instrumentation file specifying which methods are monitored and which methods are associated with a code extension, the instrumentation engine configured to perform a data collection process including collecting performance information related to the methods specified in the instrumentation file, the code extension including logic for supplementing the data collection process of the instrumentation file;
an extension determining unit configured to determine that at least one specified method is associated with the code extension based on code extension identification information being included in the instrumentation file, the code extension identification information identifying the code extension associated with the at least one specified method and a location in which the code extension is located within a resource file;
a class loading unit configured to dynamically insert the code extension into the application without restarting the application including selecting a class loader that was used to load the application in a manner that class loading delegation is bypassed and loading the code extension from the resource file using the selected class loader based on the code extension identification information when the at least one specified method associated with the code extension is called within the call chain, the class loading unit being configured to bypass the class loading delegation by renaming a class name associated with the code extension to a unique class name such that a parent class loader is not used to load the code extension;
a code extension execution unit configured to collect additional performance information regarding execution of the application as specified by the code extension; and
a report generator configured to generate at least one report for display based on at least one of the collected performance information relating to the instrumentation file and the collected additional performance information relating to the code extension.

2. The application diagnostics apparatus of claim 1, further comprising:
a code extension interface configured to receive updated code extension information from a user, the updated code extension information including an update to the code extension, an addition of one or more new code extensions, or a deletion of one or more of the plurality of code extensions within the resource file; and
a code extension updating unit configured to update the code extension, add the one or more new code extensions, or delete the one or more code extensions based on the updated code extension information such that a change to at least one code extension is dynamically implemented during a course of monitoring the application.

3. The application diagnostics apparatus of claim 1, wherein execution of the code extension derives a new key performance indicator (KPI) beyond one or more KPIs derived by the instrumentation file.

4. The application diagnostics apparatus of claim 1, wherein the instrumentation engine is configured to instrument the application including:
intercepting the one or more methods according to the instrumentation file;
interjecting code at entries and exits of the one or more methods; and
monitoring the one or more methods in response to the server request during runtime of the call chain.

5. The application diagnostics apparatus of claim 1, wherein the instrumentation file includes a plurality of rules, and each rule specifies at least one method to be monitored, at least one of the rules including information identifying the at least one specified-method, and tier information identifying which tier the at least one specified method is located.

6. The application diagnostics apparatus of claim 1, wherein the code extension is further configured to alter the call chain such that an application flow of the application is modified.

7. The application diagnostics apparatus of claim 1, wherein the code extension is further configured to modify a user interface associated with the application.

8. The application diagnostics apparatus of claim 1, wherein the parent class loader is upstream from the class loader that was used to load the application, the class loading unit configured to select the class loader that was used to load the application to insert the code extension into the application based on the unique class name.

9. The application diagnostics apparatus of claim 1, wherein the collected performance information related to the instrumentation file includes information measuring an amount of time spent within different portions of the call chain, attributes of the application associated with the specified methods, and metrics that occur within the call chain.

10. The application diagnostics apparatus of claim 1, wherein the report generator configured to generate at least one report includes:
a parameter map generator configured to generate a parameter map based on at least one of the collected performance information relating to the instrumentation file and the collected additional performance information relating to the code extension, the parameter map including at least one key-value pair representing a parameter and associated value; and
an analysis unit configured to analyze the parameter map and generate the at least one report based on the analyzed parameter map.

11. A method for monitoring performance, the method being performed by at least one processor, the method comprising:
monitoring an application executing on an application server based on an instrumentation file including monitoring one or more methods of a call chain of the application in response to a server request directed to the application, the instrumentation file specifying which methods are monitored and which methods are associated with a code extension, wherein the monitoring the one or more methods includes collecting performance information related to the methods specified in the instrumentation file, the code extension including logic for supplementing the collection of performance information by the instrumentation file;
determining that at least one specified method is associated with the code extension based on code extension identification information being included in the instrumentation file, the code extension identification information identifying the code extension associated with the at least one specified method and a location in which the code extension is located within a resource file;
inserting the code extension into the application without restarting the application including selecting a class loader that was used to load the application in a manner that class loading delegation is bypassed and loading the code extension from the resource file using the selected class loader based on the code extension identification information when the at least one specified method associated with the code extension is called within the call chain, wherein the class loading delegation is bypassed by renaming a class name associated with the code extension to a unique class name such that a parent class loader is not used to load the code extension;
collecting additional performance information regarding execution of the application as specified by the code extension; and
generating at least one report for display based on at least one of the collected performance information relating to the instrumentation file and the collected additional performance information relating to the code extension.

12. The method of claim 11, further comprising:
receiving, via a code extension interface, updated code extension information from a user, the updated code extension information including an update to the code extension, an addition of one or more new code extensions, or a deletion of one or more of the plurality of code extensions within the resource file; and
updating the code extension, adding the one or more new code extensions, or deleting the one or more code extensions based on the updated code extension information such that a change to at least one code extension is dynamically implemented during a course of monitoring the application.

13. The method of claim 11, wherein execution of the code extension derives a new key performance indicator (KPI) beyond one or more KPIs derived by the instrumentation file.

14. The method of claim 11, wherein the instrumentation file includes a plurality of rules, and each rule specifies at least one method to be monitored, at least one of the rules including information identifying the at least one specified method, and tier information identifying which tier the at least one specified method is located, signature information.

15. The method of claim 11,
wherein the parent class loader is upstream from the class loader that was used to load the application,
wherein the class loader that was used to load the application is selected to insert the code extension into the application based on the unique class name.

16. The method of claim 11, wherein the code extension is configured to alter an application flow of the methods of the call chain during runtime of the application.

17. A non-transitory computer-readable medium storing instructions that when executed cause at least one processor to perform a monitoring process, the instructions comprising instructions to:
monitor an application executing on an application server based on an instrumentation file including monitor one or more methods of a call chain of the application in response to a server request directed to the application, the instrumentation file specifying which methods are monitored and which methods are associated with a code extension, wherein the monitor the one or more methods includes collect performance information related to the methods specified in the instrumentation file, the code extension including logic for supplementing the collection of performance information, altering an application flow of the methods of the call chain pertaining to the server request, or modifying a user interface associated with the application;
determine that at least one specified method is associated with the code extension based on code extension identification information being included in the instrumentation file, the code extension identification information identifying the code extension associated with the at least one specified method and a location in which the code extension is located within a resource file;
insert the code extension into the application without restarting the application including select a class loader that was used to load the application in a manner that class loading delegation is bypassed and load the code extension from the resource file using the selected class loader based on the code extension identification information when the at least one specified method associated with the code extension is called within the call chain,
wherein the class loading delegation is bypassed by renaming a class name associated with the code extension to a unique class name such that a parent class loader is not used to load the code extension, the parent class loader being upstream from the class loader that was used to load the application, the class loader that was used to load the application being selected to insert the code extension into the application based on the unique class name; and
execute the code extension including collect additional performance information regarding execution of the application, alter the application flow of the methods of the call chain, or modify the user interface associated with the application.

18. The non-transitory computer-readable medium of claim 17, further comprising instructions to:
receive, via a code extension interface, updated code extension information from a user, the updated code extension information including an update to the code extension, an addition of one or more new code extensions, or a deletion of one or more of the plurality of code extensions within the resource file; and
update the code extension, add the one or more new code extensions, or delete the one or more code extensions based on the updated code extension information such that a change to at least one code extension is dynamically implemented during a course of monitoring the application.

19. The non-transitory computer-readable medium of claim 17, wherein the resource file stores a plurality of different code extensions.

20. The non-transitory computer-readable medium of claim 17, further comprising instructions to:
generate a first report based on the collected performance information relating to the instrumentation file and the collected additional performance information relating to the code extension, the first report providing performance of the application characterized by at least one of performance across tiers of the application, performance across tier latencies, and server performance across server components; and
generate a second report based on the collected performance information relating to the instrumentation file and the collected additional performance information relating to the code extension, the second report providing information related to each task of the at least one specified method and information related to an amount of time required to execute the at least one specified method.