A list of methods for which to create a transaction or span.
If you want to monitor a large number of methods, use trace_spans_enabled instead.
This works by instrumenting each matching method to include code that creates a span for the method. While creating a span is quite cheap in terms of performance, instrumenting a whole code base or a method which is executed in a tight loop leads to significant overhead.
Syntax
Using a pointcut-like syntax, you can match based on:
- Method modifier (optional):
public,protected,privateor* - Package and class name (wildcards include sub-packages):
org.example.* - Method name:
myMeth*d - Method argument types (optional):
(*lang.String, int[]) - Classes with a specific annotation (optional):
@*ApplicationScoped - Classes with a specific annotation that is itself annotated with the given meta-annotation (optional):
@@javax.enterpr*se.context.NormalScope
The full syntax is:
modifier @fully.qualified.AnnotationName fully.qualified.ClassName#methodName(fully.qualified.ParameterType)
Examples
| Pattern | Description |
|---|---|
org.example.* |
Match all classes in org.example package |
org.example.*#* |
Match all methods in all classes in org.example package |
org.example.MyClass#myMethod |
Match specific method in a class |
org.example.MyClass#myMethod() |
Match method with no parameters |
org.example.MyClass#myMethod(java.lang.String) |
Match method with specific parameter type |
org.example.MyClass#myMe*od(java.lang.String, int) |
Match method with wildcard in name |
private org.example.MyClass#myMe*od(java.lang.String, *) |
Match private method with wildcard parameter |
* org.example.MyClas*#myMe*od(*.String, int[]) |
Match any modifier with wildcards |
public org.example.services.*Service#* |
Match all public methods in Service classes |
public @java.inject.ApplicationScoped org.example.* |
Match annotated classes |
public @java.inject.* org.example.* |
Match classes with any annotation from package |
public @@javax.enterprise.context.NormalScope org.example.* |
Match classes with meta-annotated annotations |
Configuration
copy
// Java System Properties
-Datatus.trace_methods="org.example.MyClass#myMethod"
// Environment Variable
export ATATUS_TRACE_METHODS="org.example.MyClass#myMethod"
Configuration Reference
| Property | Value |
|---|---|
| Default | <none> |
| Type | List |
| Dynamic | true |
| Java System Properties | atatus.trace_methods |
| Property file | trace_methods |
| Environment | ATATUS_TRACE_METHODS |
Common Configurations
Trace all public methods in CDI-Annotated beans
copy
-Datatus.trace_methods="public @@javax.enterprise.context.NormalScope your.application.package.*"
-Datatus.trace_methods="public @@jakarta.enterprise.context.NormalScope your.application.package.*"
-Datatus.trace_methods="public @@javax.inject.Scope your.application.package.*"
Trace specific service methods
copy
-Datatus.trace_methods="public org.example.services.*Service#*"
Trace multiple patterns
Use comma to separate multiple patterns:
copy
-Datatus.trace_methods="public @@javax.enterprise.context.NormalScope org.example.*, public @@jakarta.enterprise.context.NormalScope org.example.*"
Important Notes
Note:
- Only use wildcards if necessary. The more methods you match the more overhead will be caused by the agent.
- Changing this value at runtime can slow down the application temporarily.
+1-415-800-4104