Set server span name only when needed
MODIFY
instrumentation/spring/spring-webmvc-3.1/javaagent/src/main/java/org/springframework/web/servlet/OpenTelemetryHandlerMappingFilter.java
instrumentation/spring/spring-webmvc-3.1/javaagent/src/main/java/org/springframework/web/servlet/OpenTelemetryHandlerMappingFilter.java
@@ -53,13 +53,15 @@ public class OpenTelemetryHandlerMappingFilter implements Filter, Ordered {
return;
}
+ try {
+ filterChain.doFilter(request, response);
+ } finally {
if (handlerMappings != null) {
Context context = Context.current();
ServerSpanNaming.updateServerSpanName(
context, CONTROLLER, serverSpanName, (HttpServletRequest) request);
}
-
- filterChain.doFilter(request, response);
+ }
}
@Override

Set server span name only when needed (#4331)