Appendix A. Data Collection

Table of Contents

A.1. Dynamic BCI
A.2. User-defined BCI

This appendix describes the data collection technology.

A.1. Dynamic BCI

SysMaster monitors WAS using the BCI (Byte Code Instrumentation) technology. Dynamic BCI is used to insert new code in Java without source modification.

If WAS uses the option to include the SysMaster library when it starts up, it can be monitored without affecting the existing logic. For more information, refer to "Appendix B. SysMaster DC Configuration".

The following is a flow that shows how to insert bytecode into the existing logic.

[Figure A.1] Bytecode Insertion

Bytecode Insertion

In JDK 1.4 and earlier, ClassLoader.class must be manually modified. In JDK 1.5 and later, the instrument package provided by JDK is used to define and apply the premain class and the 'java –agent' option is used.

Insert new bytecode logic before or after an original method to not affect the method processing.

A.2. User-defined BCI

Each user can monitor WAS by specific package, class, or method.

SysMaster uses a configuration file to monitor WAS. Each user can apply BCI to desired classes by configuring bci.config.file=/home/apmwas/smhome/config/sminst.properties. For more information, refer to "Appendix B. SysMaster DC Configuration".

When the configuration is applied, BCI is processed with the following flow.

[Figure A.2] User-defined BCI Process

User-defined BCI Process

Specify a user-defined class according to the following format.

class type : 
    C(Class)
    I(Interface)
    A(Unknown : class + interface)
 
level : 
    0(all)
    1(enabled only when self-matched)
    2(enabled only when super or interface-matched)

class attribute tag string and value :
    X(method to be excluded):X@"name"@"desc“
    F(forced instrumentation): F@"type char(S: super, I: interface, W: wildcarded)“
    Z(method to be excluded by Access): Z@access type@...(public : 1, private : 2, protected : 4)

method attributes and value :
    T(trace including time check)
    I(time check)
    P(parameter): P@"parameter index“
    R(return): R
    U(user defined attribute): U@"value“
    G(user defined start transaction if GEN type)

BCI classese exclusion entry : "*C*"="class name":...
BCI packages exclusion entry : "*P*"="partial class name":...

The following is a configuration example.

Class Info
full class name = bci type + class type + options(exclude method, exclude method access)
Method Info
method name + method description + level + attribute

com/tmax/apm/TestClass=GEN,C,X@<init>@*,Z@2@4:\
testMethod,(Ljava/lang/String;I[I)V,0,T

The following is an HttpServlet configuration example.

javax/servlet/http/HttpServlet=JSP,C,X@<init>@*:\
service,(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V,0,T:\
doFilter,(Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;Ljavax/servlet/FilterChain;)V,0,T

To monitor WAS in units of a specific class or method after user-defined classes have been defined, refer to SysMaster. "3.7.2. Profiling".