Defining custom requests

By default, only certain types of Java™ classes and methods are monitored as requests by the data collector. Servlets, JSPs, EJB business methods, and certain standard Java EE APIs are recognized as requests. You can designate extra classes and methods as custom requests.

About this task

To enable monitoring of custom requests by the data collector, define the custom requests in an XML file and set the am.camtoolkit.gpe.customxml.custom property in the toolkit custom properties file.

For example, the data collector does not recognize Struts Action classes as requests by default. However, you can set up custom request definitions and cause the actions to be recognized as Nested Requests.

Procedure

Complete the following procedure to enable monitoring of custom requests and designate one or more methods as custom requests:

  1. Make a copy of the dc_home/itcamdc/etc/custom_requests.xml file in a temporary location. Then, open the copy in a text editor.
  2. Modify the parameters in the file.
    The following table describes the parameters that you can modify:
    Table 1. Parameters for the custom requests configuration file
    Tag name Description
    edgeRequest Identifies one or more application methods that are to be Byte-Code-Instrumented for custom request processing. By modifying the requestName, Matches, type, and methodName tags within the edgeRequest tag, you can customize the selection.

    Each edgeRequest tag must contain exactly one methodName tag, and one or more Matches tags. Multiple edgeRequest tags can be specified.

    requestName Defines a unique name for this request. The request name is displayed to the user when the method entry and exit are traced.
    Matches Identifies a class or classes that contain the methods that are to be Byte-Code-Instrumented for custom request processing. Multiple Matches tags can be present within a single edgeRequest tag.
    type Indicates whether a class must be a system or application class to match the edgeRequest tag.
    methodName Identifies the names of the methods within one of the classes identified by the Matches tag that are to be Byte-Code-Instrumented for custom request processing. Exactly one methodName tag can be specified in each edgeRequest tag.
    requestMapper Optional. If this tag is specified, the data collector uses a request mapper to determine information that identifies the request. You can define nonstandard ways of extracting this information. For more information about enabling and defining request mappers, see Customizing request information mapping.
    Remember: The Matches and methodName tags can include wildcard characters. How the wildcard characters works is described as follows:
    • Asterisk (*) stands for zero or more occurrences of any character when used by itself. When embedded within a sequence of characters (for example, java.*.String), it matches zero or more occurrences of any character except the package separator (.).
    • Two periods (..) can be used to specify all sub-packages. It matches any sequence of characters that starts and ends with the package separator (.). For example, java..String matches java.lang.String and com.ibm..* matches any declaration beginning with com.ibm.
    For example, an application with a package name of com.mycompany.myapp has the following requirements:
    • Within the Customer class, the creditCheck() method must be treated as a custom request called CreditCheck.
    • Within the Supplier class, the inventoryCheck() method must be treated as a custom request called SupplyCheck.
    The contents of the customized custom_requests.xml file that accomplishes the requirements are as follows:
        <customEdgeRequests>
              <edgeRequest>
                      <requestName>CreditCheck</requestName>
                      <Matches>com.mycompany.myapp.Customer</Matches>
                      <type>application</type>
                      <methodName>creditCheck</methodName>
              </edgeRequest>
              <edgeRequest>
                      <requestName>SupplyCheck</requestName>
                      <Matches>com.mycompany.myapp.Supplier</Matches>
                      <type>application</type>
                      <methodName>inventoryCheck</methodName>
              </edgeRequest>
        </customEdgeRequests>   
  3. Complete one of the following steps:
    • Save the file in the dc_home/runtime/app_server_version.node_name.profile_name.server_name/custom directory. Then, in the toolkit custom properties file, set the property am.camtoolkit.gpe.customxml.custom to the name (without path) of the file that you modified in Step 2.
    • Save the file in any directory on your computer. Then, in the toolkit custom properties file, set the property am.camtoolkit.gpe.customxml.custom to the path and name for the file that you modified in Step 2.
    For more information about the toolkit custom properties file, seeToolkit properties file.