You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thank you for providing the YAML example. I'll complete the "Agent Configuration" section based on the information you've given. Here's a draft of the content:
45
-
46
44
### Agent Configuration
47
45
48
46
The agent configuration is specified in a YAML file. This file allows you to customize various aspects of the agent's behavior. Below are the available configuration options:
@@ -52,28 +50,33 @@ The agent configuration is specified in a YAML file. This file allows you to cus
52
50
The `logging` section controls how the agent generates log files:
53
51
54
52
-`file`: Specifies the path to the log file where the agent will write its output.
55
-
-Example: `path/to/file.log`
53
+
-Default: `app.log`
56
54
57
55
-`addTimestampToFileNames`: When set to `true`, adds a timestamp to the log file name.
58
56
- Default: `false`
59
57
60
58
-`useHash`: If `true`, the agent uses hashing for method signatures in the log file. This is useful for reducing the size of the log file when there are a large number of method logs with long signatures. The mapping of the hashes will be stored in a separate JSON file.
61
59
- Default: `false`
62
60
61
+
-`optimizeTimestamp`: When set to `true`, optimizes timestamp handling for improved performance. Basically, it removes the first 4 digits of the timestamp to reduce the log file size.
62
+
- Default: `false`
63
+
63
64
#### Instrumentation
64
65
65
66
The `instrumentation` section defines which parts of your code the agent will instrument:
66
67
67
-
-`targetPackage`: Specifies which package to instrument. If not set, all classes will be instrumented (both within and outside of the program).
68
-
- Example: `com.example`
69
-
- Default: empty (all classes are instrumented)
68
+
-`targetPackage`: Specifies which package to instrument.
69
+
- Default: `*` (all packages)
70
70
71
71
-`onlyCheckVisited`: When set to `true`, the agent only instruments the entry of each function once. This is useful for checking code coverage.
72
72
- Default: `false`
73
73
74
74
-`instrumentMainMethod`: If `true`, the agent will instrument the main method of the main class.
75
75
- Default: `false`
76
76
77
+
-`maxNumberOfInstrumentations`: Sets a limit on the number of instrumentations to perform. Use -1 for unlimited.
78
+
- Default: `-1`
79
+
77
80
-`targetMethods`: Allows you to specify which methods to instrument or ignore. This section has two sub-sections:
78
81
-`instrument`: A list of methods to instrument. If specified, only these methods will be instrumented.
79
82
- Example:
@@ -88,64 +91,67 @@ The `instrumentation` section defines which parts of your code the agent will in
88
91
- protected java.lang.String com.example.MainClass.ignoredMethodName(float a)
89
92
```
90
93
91
-
##### Method Structure
94
+
#### Misc
92
95
93
-
When specifying methods in the `instrument` or `ignore` lists, use the following format:
96
+
The `misc` section contains additional configuration options:
- `convertToJson`: When set to `true`, converts the output logs to JSON format. This format is supported by visualization tools like Eclipse Trace Compass.
99
+
- Default: `false`
98
100
99
-
Where:
100
-
- `[visibility]` is one of (required):
101
-
- `public`
102
-
- `protected`
103
-
- `private`
104
-
- (empty for package-protected)
105
-
- `[static]` is one of (required):
106
-
- `static`
107
-
- (empty for non-static)
108
-
- `return-type`is the method's return type
109
-
- it should be the fully qualified class name (e.g., `java.lang.String` or `void`) (required)
110
-
- `[declaring-class]`is the fully qualified class name where the method is declared (optional)
111
-
- `method-name`is the name of the method (required)
112
-
- `(args)`are the method's parameters (required)
113
-
114
-
Examples:
115
-
```java
116
-
private static void com.example.MainClass.methodName(int a, java.lang.String b)
117
-
protected java.lang.String ignoredMethodName(float a)
118
-
public java.util.List<java.lang.String> getNames()
119
-
void processData(byte[] data)
120
-
```
121
-
Note: You can specify either `instrument` or `ignore`, but not both since it doesn't make sense to instrument and ignore methods at the same time.
101
+
##### Method Structure
102
+
103
+
When specifying methods in the `instrument` or `ignore` lists, use the following format:
This configuration allows you to fine-tune the agent's behavior to suit your specific needs, whether you're focusing on particular packages, methods, or adjusting logging options.
147
-
148
-
149
155
## Example
150
156
151
157
Let's consider a simple Java program with the following structure:
@@ -307,17 +313,9 @@ There are several ways to analyze the logs generated by the agent. One common ap
307
313
### Analysis with Trace Compass
308
314
*Background: [Eclipse Trace Compass™](https://eclipse.dev/tracecompass) is an open source application to solve performance and reliability issues by reading and analyzing logs or traces of a system. Its goal is to provide views, graphs, metrics, and more to help extract useful information from traces, in a way that is more user-friendly and informative than huge text dumps.*
309
315
310
-
If you want to import the collected instrumentation logs in Trace Compass, you can use the `trace_formatter.py` script to re-format the log files, and generate a Trace Compass readable json file.
316
+
If you want to import the collected instrumentation logs in Trace Compass, you can use the `convertToJson` option in the configuration file to convert the output logs to JSON format.
0 commit comments