Set server span name only when needed (#4331)

This commit is contained in:
Lauri Tulmin 2021-10-08 23:05:20 +03:00 committed by GitHub
parent 2fbec93313
commit b371361bb9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 6 deletions

View File

@ -53,13 +53,15 @@ public class OpenTelemetryHandlerMappingFilter implements Filter, Ordered {
return;
}
if (handlerMappings != null) {
Context context = Context.current();
ServerSpanNaming.updateServerSpanName(
context, CONTROLLER, serverSpanName, (HttpServletRequest) request);
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