Skip to content

Commit

Permalink
Merge pull request #1575 from newrelic/1574-normalize-proxy-names
Browse files Browse the repository at this point in the history
Normalize CGLIB proxied class names
Merging - failing infinite tracing test has been removed.
  • Loading branch information
jtduffy authored Nov 9, 2023
2 parents be93f85 + 9b094ae commit 548d9fb
Showing 1 changed file with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,19 @@ protected void setTransactionName(Transaction transaction, String methodName, Cl
}

private String getControllerName(String methodName, Class<?> controller) {
String controllerName = isUseFullPackageName() ? controller.getName() : controller.getSimpleName();
int indexOf = controllerName.indexOf(TO_REMOVE);
if (indexOf > 0) {
controllerName = controllerName.substring(0, indexOf);
}
Class<?> originalClass = getOriginalClassIfProxied(controller);
String controllerName = isUseFullPackageName() ? originalClass.getName() : originalClass.getSimpleName();
return '/' + controllerName + '/' + methodName;
}

private Class<?> getOriginalClassIfProxied(Class<?> clazz) {
if (clazz.getName().contains("$$")) {
Class<?> superclass = clazz.getSuperclass();
if (superclass != null && superclass != Object.class) {
return superclass;
}
}

return clazz;
}
}

0 comments on commit 548d9fb

Please sign in to comment.