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.
Finding the end point
- Set the transaction trace for all methods where transactions are supposed to be called.
- After restarting, trigger a transaction for monitoring.
- Turn on the
back stack
option to pinpoint the entry method.
Selecting the target
-
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.confhook_method_patterns=jdbc.*.*
hook_method_access_public_enabled=true
hook_method_access_protected_enabled=true
hook_method_access_none_enabled=true -
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.conftrace_auto_transaction_enabled=true
trace_auto_transaction_backstack_enabled=true -
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 BACKSTACKjdbc.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) -
Check Stack Content
By checking the stack content, you can infer which method the transaction is departing from.
Examplecom.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 withinSimulaNonHttp.run
,SimulaNonHttp.process()
is called, and thenSimulaNonHttp.execute()
is run. We can guess thatprocess()
is appropriate. This part must be determined by looking at the source.TipThe 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
-
Set the transaction start point as follows:
whatap.confhook_service_patterns=com.virtual.web.SimulaNonHttp.process
-
Restart the application.
The process()
method becomes the end point of a new transaction.
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.
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
, andarg
.-
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 theservice_name_index
option is used as the service name.
-
Using the plug-in
It is recommended to use a plug-in only if you are familiar with it.
Create the plugin folder under the WHATAP_HOME path and move to plugin. Create the AppServiceStart.x file with the vi
command.
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 the following example, HashMap
is passed as a parameter, and this HashMap
contains the key called 'url'.
Object url =((java.util.HashMap)$point.getArgs()[0]).get("url");
$ctx.service((String)url);
//println("url="+url);
If you create a plugin like this, you can change the transaction name.