With the release of
JXInsight 4.1 it is now possible to add additional trace metrics to a monitored server process grouping statistics (clock time, cpu time, blocking time, waiting time, service time, gc time, and object allocation byte sizes) based on trace types and identifiers. This flexibility allows for standard and custom defined trace extensions to have summary measurement groupings suitable for quick break downs of performance costs across tiers, systems and components.
Users can define groupings via the following Java system properties.
-Djxinsight.server.tracer.groups=<comma separated list of group names>
-Djxinsight.server.tracer.group.<group-name>.identifiers=<comma separated list of trace identifier prefixes including trace type>
Note: The name of the trace group cannot have white space. Do not add white space between comma separators. The order of the groups is important when an identifier can match more than one trace group.
The first system property defines the list of trace groups that will appear in the metrics analysis mode snapshot. For each group name defined in the property there should be an additional system property defining the trace identifiers that belong to the trace group. The
identifiers system property lists string tokens that are matched against each recorded trace. The matching is simple and straightforward in that for each trace a check is made to see whether any of the tokens of a group represent a prefix of the trace string including trace type and trace identifier.
For example if one or more trace extensions define the trace types ${app.webpage}, ${app.action}, ${app.da}, {app.da.jdbc} then metric groupings based on architectural layers could be defined as follows:
-Djxinsight.server.tracer.groups=presentation,persistence
-Djxinsight.server.tracer.group.presentation.identifiers=${app.webpage},${app.action}
-Djxinsight.server.tracer.group.persistence.identifiers=${app.da},${app.da.jdbc}
Note: The last system property could be shortened further to -Djxinsight.server.tracer.group.persistence.identifiers=${app.da
Trace groupings can also be defined on both the trace type and value such as
-Djxinsight.server.tracer.group.persistence.identifiers=${app.comp}=DataSource,${app.comp}=Driver
Sample Application
The CORBA sample application ($install-root$/samples/corba) used to highlight the distributed tracing capabilities of the the product has had changes made to its ant build.xml file to define trace metric groups for the CORBA traces generated by JXInsight's trace extension as well as the custom traces defined via our
Tracer API. Below is the client code with explicit custom traces. The CORBA tracing is performed via the dynamic registration of Client Portable Interceptors.
The traces generated by the client application are
${myapp}=Client
${myapp.mycomp}=Adder
${corba.protocol}=IIOP
${corba.operation}=resolve_str
${corba.operation}=_is_a
${corba.operation}=get
${corba.operation}=add
To group the above traces into 2 trace metric groups, 'corba' and 'client', the ant target in the build.xml file ($install-root}/samples/corba) has had two new system properties defined.
<target name="runclient" >
<exec executable="java">
<arg line="-Xrunjdbinsight"/>
<arg line="-cp ${build.dir};${lib.dir}/jxinsight-core.jar"/>
<arg line="-Dorg.omg.CORBA.ORBClass=com.sun.corba.se.internal.Interceptors.PIORB"/>
<arg line="-Dorg.omg.PortableInterceptor.ORBInitializerClass.com.jinspired.jxinsight.trace.ext.corba.ORBInitializer"/>
<arg line="-Djxinsight.server.tracer.groups=corba,client"/>
<arg line="-Djxinsight.server.tracer.group.client.identifiers=${myapp},${myapp.mycomp}"/>
<arg line="add.Client"/>
<arg line="-ORBInitialPort ${orb.port}"/>
</exec>
</target>
The first system property defines the trace groups that will be reported on. These are
'corba' and
'client'. The second property defines the string tokens that prefix matching trace strings for the
'client' trace group. The
corba trace group does not require an additional system property defining matching trace string patterns because it is a standard trace group of the product. Below is a screen shot of the metrics visualization within the JXInsight management and monitoring console showing the recording of statistics for both trace groups.
Metric Calculations and Trace Entry Points
Trace metrics only report on trace entry points. A trace entry point is the first occurrence of a trace group on the trace stack of a thread. All other nested traces of the same trace group are ignored to ensure there is no double accounting of profiling statistics. When a trace is completed (
Tracer.stop) the trace group is obtained. The metrics profiler then checks the trace stack for an trace with the same trace group. If no trace is found with a matching trace group then the trace measurements are added to the trace group metrics.
Note: The trace metrics with no qualified group are based on top level trace roots irrespective of trace group. This means that the trace metrics cumulative count can be less than the total number of traces reported in the timeline and profile analysis modes when nested of traces occurs.
Default System Properties
By default trace group metrics are recorded. To disable this feature specify the following system property.
-Djxinsight.server.profiler.metrics.trace.groups.enabled=false
By default trace group metrics are reported for ejb, web, jdbc, jms, jndi, rmi, jts, jta, corba. This can be changed via the system property
-Djxinsight.server.tracer.groups=
Summary
The capability to define arbitrary trace groups is extremely useful by allowing the definition of metrics that provide a quick and high level performance management insight into the execution behavior of an monitored enterprise Java application. In JXInsight 4.1 scheduled for release in the first week of February this feature becomes even more useful with the ability to layer metrics over each other within the management and monitoring console.
William Louth, JXInsight Product Architect