Configuring User Name and Business Context

As part of detailed diagnosis, eG BTM displays two columns, namely - User Name and Business Context. By default, these two columns will not display any values. This has been done so that administrators can use these columns to display any additional information that they deem useful for troubleshooting transaction slowness. For instance, administrators can configure eG Enterprise to capture the name of the user who initiated each transaction and display the same in the User Name column for every transaction URL in the Detailed Diagnosis page. Likewise, administrators can also tweak eG Enterprise to capture and display business-critical information such as transaction ID, product name, customer ID etc., into Business Context. Such custom information can also be captured for specific transaction URLs or URL patterns alone.

To achieve this, click the icon against the USERNAME/BUSINESS CONTEXT CONFIGURATION parameter of the Java Business Transactions test.Figure 1 will then appear. By default, the Username tab page will open as indicated by Figure 1. Using this tab page, you can configure rules for capturing user names for different URLs/URL patterns. To configure business context rules, click on the Business Context tab page.

The procedure for creating a rule is the same, whether it is for capturing a user name, or it is for capturing a business context. The only difference is the tab page used for the purpose.

The procedure below details how to capture a user name into detailed diagnosis.

  1. First, click on the Username tab page, Figure 1 will appear listing rules that pre-exist for capturing a user name. To add a new rule, click the Add New Rule button in Figure 1.

    Figure 1 : List of user name capturing rules that pre-exist

  2. Figure 2 will then appear. Use Figure 2 to create a new rule for capturing user names.

    Figure 2 : Adding a new rule for capturing user name

  3. Begin by providing an Entry Description. This can be a text string or a keyword that uniquely identifies the URL/URL pattern to which the rule applies. For instance, if you are configuring a rule for the URL pattern, */sports*, then you can configure sports as the Entry Description.

  4. Next, against Matching URL Pattern, specify a comma-separated list of URLs or URL patterns for which the user name as to be captured and displayed as part of detailed diagnosis. The URL patterns can include wild card patterns - eg., */WebPoc*,*Web*.

  5. Then, select a Fetch Type. This refers to the approach using which you want to capture the user name for a transaction URL/URL pattern. eG Enterprise prescribes four approaches to capturing the same:

    • Method Argument or parameter - If you have written a Java method that takes input arguments/parameter for capturing the user name, then use the Method Argument or parameter approach.

      The key limitations of the Method Argument or parameter approach are as follows:

      • Not possible to get the argument values of predefined methods.
      • Not possible to capture all the argument values of a method.
    • Static Method - A Static method belongs to the class and not to the object(instance). A static method can access only static data. It cannot access non-static data (instance variables). A static method can call only other static methods and can not call a non-static method from it. If you have written a static Java method for retrieving the user name, then use this approach.

      The key limitations of the Static Method approach are as follows:

      • Not possible to get the return value of private static methods.
      • Not possible to get the output of static methods that have more than one parameter.
    • Session Attribute - If the user name is available as a session attribute, then you can configure the eG agent to access that session attribute and retrieve the required information.

      The key limitation of the Session Attribute approach is as follows:

      • Not possible to get the session value if the response is committed at the end of the transaction.

    • Request Parameter Name - If the user name is passed as the value of a request parameter key in the specified URL/URL pattern, then select this option.
  6. If you select the Method Argument or parameter option, then the options you see in Figure 3 will appear.

    Figure 3 : Configuring a rule for capturing user name using the Method Argument or parameter Fetch Type

    Use the options in Figure 3, as indicated below, to configure a rule that captures the user name from a method argument/parameter.:

    • First, against Fully Qualified Class Name, specify the name of the class that contains the method definitions for fetching the user name. If a packaged class is to be used, then specify the fully qualified class name - eg., com/samples/MyProgram. If its not a packaged class, then simply specify the class name - eg., MyProgram

    • Specify the Method Name to be used for capturing the user name.
    • If the configured Method Name takes one/more input arguments, then specify a comma-separated list of such arguments in the Method Signature text box. Typically, if these input arguments are of primitive type, then you can specify them as is . However, if they are objects or wrapper classes, then they should be specified using the fully qualified object name or wrapper class name - eg., /java/lang/String
    • In the Method Argument Index text box, , you need to define at what position of the method invocation call, the information you need - i.e.,the user name - resides. For instance, if the method invocation call is Method1(int userID, string userName), then to fetch the user name, the Method Argument be 2. This is because, the second argument, string userName, is the one that fetches the user name information.
    • Finally, click the Create Rule button to create the new rule.
  7. If you select the Static Method option, then the options you see in Figure 4 will appear.

    Figure 4 : Configuring a rule for capturing user name using a Static Method

    Use the options in Figure 4, as indicated below, to create a rule that captures the user name using a static method.

    • First, against Fully Qualified Class Name, specify the name of the class that contains the method definitions for fetching the user name. If a packaged class is to be used, then specify the fully qualified class name - eg., com/samples/MyProgram. If its not a packaged class, then simply specify the class name - eg., MyProgram

    • Specify the Method Name to be used for capturing the user name.
    • If the configured Method Name takes one/more input arguments, then specify a comma-separated list of such arguments in the Method Signature text box. Typically, if these input arguments are of primitive type, then you can specify them as is . However, if they are objects or wrapper classes, then they should be specified using the fully qualified object name or wrapper class name - eg., /java/lang/String
    • If the specified static method passes a request object to retrieve the user name, then set the Pass Request Object flag to Yes. On the other hand, if the static method does not pass any request object, but retrieves the user name by implementing a different programming logic in its body, then set the Pass Request Object flag to No.
    • If the configured method captures the user name only when the transaction is in progress (and not when it begins), then set the Execute at Start of the Transaction flag to No. On the other hand, if the method captures the user name at the beginning of the transaction, set this flag to Yes.
    • Finally, click the Create Rule button to create the new rule.
  8. If you select the Session Attribute option from the Fetch Type list, then the options you see in Figure 5 will appear.

    Figure 5 : Configuring a rule for capturing user name from a Session Attribute

    Use the options in Figure 5, as indicated below, to configure a rule that reads the user name from the value of a session attribute:

    • If the configured session attribute returns a user name as its value only when the transaction is in progress (and not when it begins), then set the Execute at Start of the Transaction flag to No. On the other hand, if the session attribute returns user name as its value at the beginning of the transaction, set this flag to Yes.

    • Then, specify the Session Attribute or Request Parameter Name that eG Java BTM should read the user name value from.

    • Finally, click the Create Rule button to create the new rule.

  9. If you select the Request Parameter Name option, then the options you see in Figure 6 will appear,

    Figure 6 : Configuring a rule for capturing user name from a Request Parameter

    Use the options in Figure 6, as indicated below, to configure a rule that retrieves the user name from the value of a request parameter key:

    • Specify the Session Attribute or Request Parameter Name that eG Java BTM should read the user name value from. For instance, say,
    • Finally, click the Create Rule button to create the new rule.
  10. Similarly, multiple rules can be created for capturing user name.

As stated earlier, to capture a business context into detailed diagnosis, click on the Business Context tab page. Figure 7 will then appear, where you can view the business context rules that pre-exist (if any).

Figure 7 : List of rules that pre-exist for capturing business context

To add a new rule, click on the Add New Rule button in Figure 7. Figure 8 will then appear.

Figure 8 : Configuring a rule for capturing business context into detailed diagnosis

Use the options in Figure 8 to configure a new rule for capturing the business context into detailed diagnosis. Follow the steps 2-9 above to understand what these options are and how to use them.