Package fr.bl.drit.flow.agent
Class AgentMain
java.lang.Object
fr.bl.drit.flow.agent.AgentMain
The Java Flow agent entry point. It records method call trees for target classes and writes them
to files in a supplied directory. The directory will contain a method ID mapping file and a call
tree file for each thread. The call tree file format can be configured using the format argument,
which currently supports two formats: a compact binary format (.flow) and a more verbose JSON
Lines format (.jsonl). Both formats consist of two types of events: method entry and method exit.
Method entries are recorded with the ID of the entered method, which can be found in the method
ID mapping.
Arguments are comma-separated key=value pairs. The supported arguments are:
- target (required) -> '+'-separated list of class name prefixes to instrument
- out (required) -> output directory, will contain method ID mapping and per-thread call tree files
- format (optional) -> "binary" (default) or "jsonl"
- optimize (optional) -> path to flow directory to optimize method ID mapping
- ids (optional) -> path to existing method ID mapping file
Minimal example: target=com.myapp.,out=/tmp/flow/
Use the optimize argument to optimize method IDs by leveraging an existing mapping of
method IDs and flow files. Method IDs are natural numbers. Those that are called more frequently
will have smaller IDs. Using the binary format with variable-length integer encoding
significantly reduces the size of the recorded call tree data. The optimized mapping will be
written to the output directory and can be reused in subsequent runs by specifying its location
using the ids argument. Refer to the MethodIdRemapper class comment for more
details about the optimization process.
Example with optimization: target=com.myapp.,optimize=/tmp/flow/,out=/tmp/optimized-flow/
Then reuse optimized mapping: target=com.myapp.,ids=/tmp/optimized-flow/ids.properties,out=/tmp/optimized-flow-2/
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidagentmain(String agentArgs, Instrumentation inst) When attaching the agent at runtime.static voidpremain(String agentArgs, Instrumentation inst) When starting the application with the agent.
-
Constructor Details
-
AgentMain
public AgentMain()
-
-
Method Details
-
premain
When starting the application with the agent.- Parameters:
agentArgs- Arguments to parseinst- Allows instrumenting Java code
-
agentmain
When attaching the agent at runtime.- Parameters:
agentArgs- Arguments to parseinst- Allows instrumenting Java code
-