Set transaction name to method
(closes
@@ -74,16 +74,11 @@ public class ApmFilter implements Filter {
fillResponse(context.getResponse(), httpServletResponse);
fillUser(context.getUser(), httpServletRequest);
- // TODO can this be set by apm-server when there is no explicit name set?
- transaction.withName(httpServletRequest.getRequestURI());
+ transaction.withName(httpServletRequest.getMethod());
transaction.withResult(getResult(httpServletResponse.getStatus()));
transaction.withType("request");
}
- private String getRequestNameByRequest(HttpServletRequest request) {
- return request.getMethod() + " " + removeSemicolonContent(request.getRequestURI().substring(request.getContextPath().length()));
- }
-
@Nullable
String getResult(int status) {
if (status >= 200 && status < 300) {
@@ -104,20 +99,6 @@ public class ApmFilter implements Filter {
return null;
}
- /*
- * copy of org.springframework.web.util.UrlPathHelper#removeSemicolonContentInternal
- */
- private String removeSemicolonContent(String requestUri) {
- int semicolonIndex = requestUri.indexOf(';');
- while (semicolonIndex != -1) {
- int slashIndex = requestUri.indexOf('/', semicolonIndex);
- String start = requestUri.substring(0, semicolonIndex);
- requestUri = (slashIndex != -1) ? start + requestUri.substring(slashIndex) : start;
- semicolonIndex = requestUri.indexOf(';', semicolonIndex);
- }
- return requestUri;
- }
-
private void fillUser(User user, HttpServletRequest httpServletRequest) {
user.withUsername(getUserName(httpServletRequest));
}
