Proper debug names for instrumenters
This commit is contained in:
+1
@@ -94,6 +94,7 @@ public class InterceptionInstrumenter implements Instrumenter {
|
|||||||
String nameFromAnnotation = annotation.methodName();
|
String nameFromAnnotation = annotation.methodName();
|
||||||
String methodName = nameFromAnnotation.isEmpty() ? field.getName() : nameFromAnnotation;
|
String methodName = nameFromAnnotation.isEmpty() ? field.getName() : nameFromAnnotation;
|
||||||
MethodInstrumenterImpl instrumenter = new MethodInstrumenterImpl(
|
MethodInstrumenterImpl instrumenter = new MethodInstrumenterImpl(
|
||||||
|
field.getDeclaringClass().getSimpleName() + "." + field.getName(),
|
||||||
compilePattern(methodName),
|
compilePattern(methodName),
|
||||||
compilePattern(annotation.erasedSignature()),
|
compilePattern(annotation.erasedSignature()),
|
||||||
annotation.allowMultipleMatches(),
|
annotation.allowMultipleMatches(),
|
||||||
|
|||||||
+4
-2
@@ -20,6 +20,7 @@ import java.util.List;
|
|||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
class MethodInstrumenterImpl implements MethodInstrumenter {
|
class MethodInstrumenterImpl implements MethodInstrumenter {
|
||||||
|
private final String debugName;
|
||||||
private final Pattern namePattern;
|
private final Pattern namePattern;
|
||||||
private final Pattern descPattern;
|
private final Pattern descPattern;
|
||||||
private final boolean allowMultipleMatches;
|
private final boolean allowMultipleMatches;
|
||||||
@@ -28,13 +29,14 @@ class MethodInstrumenterImpl implements MethodInstrumenter {
|
|||||||
private final boolean logApplications;
|
private final boolean logApplications;
|
||||||
|
|
||||||
public MethodInstrumenterImpl(
|
public MethodInstrumenterImpl(
|
||||||
Pattern namePattern,
|
String debugName, Pattern namePattern,
|
||||||
Pattern descPattern,
|
Pattern descPattern,
|
||||||
boolean allowMultipleMatches,
|
boolean allowMultipleMatches,
|
||||||
List<MethodData> enterData,
|
List<MethodData> enterData,
|
||||||
List<MethodData> exitData,
|
List<MethodData> exitData,
|
||||||
boolean logApplications
|
boolean logApplications
|
||||||
) {
|
) {
|
||||||
|
this.debugName = debugName;
|
||||||
this.namePattern = namePattern;
|
this.namePattern = namePattern;
|
||||||
this.descPattern = descPattern;
|
this.descPattern = descPattern;
|
||||||
this.allowMultipleMatches = allowMultipleMatches;
|
this.allowMultipleMatches = allowMultipleMatches;
|
||||||
@@ -72,6 +74,6 @@ class MethodInstrumenterImpl implements MethodInstrumenter {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return namePattern + " " + descPattern + (allowMultipleMatches ? " [multiple]" : "");
|
return debugName + "[" + namePattern + " " + descPattern + (allowMultipleMatches ? " multiple" : "") + "]";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user