Skip to content

Trace Agent Configuration

Yun Lin edited this page Apr 11, 2021 · 2 revisions

Trace Agent can be used by java command line with following agent option:

-javaagent:[path to instrumentator.jar]=[option1]=[value1],[option2]=[value20;value21;value22]

*:For option which allows multiple values, the separator semi-colon (;) is used in Windows, and colon (:) is used in MacOs/Linux.

Agent Options:

precheck
  Run agent in precheck mode.
  default: false.

launch_class=className
  Test class that can be launched by junit. The agent will start tracing when launch_class is executed.

entry_point=methodFullName
  If launch_class is undefined, option entry_point is required. Entry_point is the method at which the trace is started to build.
  [methodFullName]: className.[method_name|method_signature]
  ex: entry_point=com.sample.Foo.main([Ljava/lang/String;)V

java_home
  Java home for jdk7 is required.

class_path=classpath
  Application classpath as a list of class directories, JAR files. Separate class path entries with the path_separator depends on Operating System: MacOs/Linux(:),Windows(;).

working_dir
  Project folder.

dump_file_path
  The file path to store trace data.

tcp_port
  If tcp_port is defined, agent will connect to TCP port at localhost. Trace data will be written to TCP connection.
  default: -1 (disable TCP option).

includes=filterExpressions
  The classes which are defined by filterExpressions will be included in instrumentation to collect variable runtime values.Separate expressions with the path_separator: MacOs/Linux(:),Windows(;).
  Supported filter expressions:
    java.util.* : include all types and packages under java.util package.
    java.util.*\ : include all types only under java.util package.
    java.util.Arrays : include type Arrays only.
    java.util.Arrays* : include type Arrays and its inner types.

excludes=filterExpressions
  The classes which are defined by filterExpressions will be filtered when collecting trace.Separate expressions with the path_separator: MacOs/Linux(:),Windows(;).
  Supported filter expressions:
    java.util.* : include all types and packages under java.util package.
    java.util.*\ : include all types only under java.util package.
    java.util.Arrays : include type Arrays only.
    java.util.Arrays* : include type Arrays and its inner types.

includes_file=file_path
  An alternative option for includes=filterExpressions. Filter expressions will be loaded from file_path.

excludes_file=file_path
  An alternative option for excludes=filterExpressions. Filter expressions will be loaded from file_path.

varLayer
  Specify the deepest layer of an object to collect variable values.
  default: 2

stepLimit
  The max length of the trace to be collected. When the collected trace exceeds stepLimit, the agent will stop tracing.
  default: -1 (no limit)

expectedSteps
  The agent will stop tracing when the trace size exceeds either expectedSteps or stepLimit . This option only affects in normal run mode (precheck=false).
  default: -1 (no limit)

overlong_methods=methodFullNames
  List of methods which will be over long after instrumentation. For these methods, some less important type of instructions will be discarded during instrumentation.

log=[debug|info|printProgress|error]
  Options to print out log. Separate log types with the path_separator: MacOs/Linux(:),Windows(;).
error: print out exception stack trace.
debug: print out useful debug info.

require_method_split
  Enable applying method splitting function on methods which bytecode exceeds JVM limit after instrumentation.
  default: false.

trace_recorder=[FILE|SQLITE3|MYSQL]
 &emsp suggest which method to store the trace file.

avoid_proxy_tostring
 &emspDurring tracing process, method toString of objects will be called when building variable value for each step, this might change the program execution. We provide option avoid_proxy_tostring to notify agent not to call toString() method on a proxy object.
  default: false.

code_range
=className.methodName.startLine.endLine(;/:)className.methodName.startLine.endLine
  Define the range of code in application to record in trace.