Skip to main content

Setting the transaction endpoint

The end point is the start method of the transaction. In case of the HTTP transaction, HttpServlet.service() or Filter.doFilter() is the start point of transaction, and this point is called "transaction end point."

Non-HTTP tracing

The performance from the start to the end of the method specified as the transaction end point, is called "transaction performance." To trace non HTTP transactions, be sure to specify the end point.

Note

Finding the end point

  1. Set the transaction trace for all methods where transactions are supposed to be called.
  2. After restarting, trigger a transaction for monitoring.
  3. Turn on the back stack option to pinpoint the entry method.

Selecting the target

  1. Method Trace Setting

    Set the method trace. Be sure to specify a class that is called in transactions. The JDBC driver is useful for the programs that use the database.

    whatap.conf
    hook_method_patterns=jdbc.*.*
    hook_method_access_public_enabled=true
    hook_method_access_protected_enabled=true
    hook_method_access_none_enabled=true
  2. Transaction start option setting

    Start a transaction when the method is called. Turn on the transaction start option and the option to dump the stack at the start of a transaction.

    whatap.conf
    trace_auto_transaction_enabled=true
    trace_auto_transaction_backstack_enabled=true
  3. Trace analysis after restart

    Restart it. After calling the service, you can see the transaction being traced.

    If you view the transaction, you can see that the methods of all classes starting with jdbc.* appear in this transaction. If you view the transaction trace, you can see the message step called TRANSACTION BACKSTACK.

    TRANSACTION BACKSTACK
    jdbc.FakePreparedStatement.executeQuery(FakePreparedStatement.java),
    com.virtual.dao.SelectDAO.execute2(SelectDAO.java:29),
    com.virtual.web.SimulaNonHttp.execute(SimulaNonHttp.java:147),
    com.virtual.web.SimulaNonHttp.process(SimulaNonHttp.java:76),
    com.virtual.web.SimulaNonHttp.run(SimulaNonHttp.java:100)
  4. Check Stack Content

    By checking the stack content, you can infer which method the transaction is departing from.

    Example
    com.virtual.web.SimulaNonHttp.execute(SimulaNonHttp.java:147),
    com.virtual.web.SimulaNonHttp.process(SimulaNonHttp.java:76),
    com.virtual.web.SimulaNonHttp.run(SimulaNonHttp.java:100)

    One of the above three methods can be determined as the start point of a transaction. In this situation, perform reverse compilation to determine the appropriate transaction end point.

    Looking at the logic, while() runs within SimulaNonHttp.run, SimulaNonHttp.process() is called, and then SimulaNonHttp.execute() is run. We can guess that process() is appropriate. This part must be determined by looking at the source.

    Tip

    The most important criterion for end point is that it must be ended. Under normal circumstances, it must terminate immediately without any delay so that the performance evaluation can be made.

Set the transaction endpoint

  1. Set the transaction start point as follows:

    whatap.conf
    hook_service_patterns=com.virtual.web.SimulaNonHttp.process
  2. Restart the application.

The process() method becomes the end point of a new transaction.

Note

For the hook_service_patterns option, wildcard characters cannot be used. To set multiple values, use comma (,) as the delimiter.

Defining the transaction name

Generally, transactions are identified by the method name.

whatap.conf
service_name_mode=[full,class,method,string,arg]
service_name_index=0
  • service_name_mode

    You can specify any of 5 options: full, class, method, string, and arg.

    • full: The full class name is used as the service name.

    • class: The class name is used as the service name.

    • method: The method name is used as the service name.

    • string: The first parameter in the text string is used as the service name.

    • arg: Among parameters, the parameter of the index specified in the service_name_index option is used as the service name.

Using the plug-in

Caution

It is recommended to use a plug-in only if you are familiar with it.

Create the plugin folder under the WHATAP_HOME path. Through vi, create the AppServiceStart.x file.

Plugin usage example

If you type println("test"); and save it, you can see that the string "test" is displayed on the screen. After checking it, extract data from the parameter.

In this example, parameters are passed to HashMap and the URL parameter is passed to the map.

Object url =((java.util.HashMap)$point.getArgs()[0]).get("url");
$ctx.service((String)url);
//println("url="+url);

If you create a plug-in like this, the transaction name is changed.