Source:
<code>protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException { String uri = this.urlPathHelper.getPathWithinApplication(request); boolean skip = this.skipPattern.matcher(uri).matches() || Span.SPAN_NOT_SAMPLED.equals(ServletUtils.getHeader(request, response, Span.SAMPLED_NAME)); Span spanFromRequest = (Span) request.getAttribute(TRACE_REQUEST_ATTR); if (spanFromRequest != null) { this.tracer.continueSpan(spanFromRequest); } addToResponseIfNotPresent(response, Span.SAMPLED_NAME, skip ? Span.SPAN_NOT_SAMPLED : Span.SPAN_SAMPLED); String name = HTTP_COMPONENT + ":" + uri; spanFromRequest = createSpan(request, skip, spanFromRequest, name); Throwable exception = null; try { this.spanInjector.inject(spanFromRequest, response); filterChain.doFilter(request, response); } catch (Throwable e) { exception = e; throw e; } finally { if (isAsyncStarted(request) || request.isAsyncStarted()) { this.tracer.detach(spanFromRequest); return; } addToResponseIfNotPresent(response, Span.SAMPLED_NAME, skip ? Span.SPAN_NOT_SAMPLED : Span.SPAN_SAMPLED); if (spanFromRequest != null) { addResponseTags(response, exception); if (spanFromRequest.hasSavedSpan()) { Span parent = spanFromRequest.getSavedSpan(); if (parent.isRemote()) { parent.logEvent(Span.SERVER_SEND); parent.stop(); this.spanReporter.report(parent); } } else { spanFromRequest.logEvent(Span.SERVER_SEND); } <START> if (response.getStatus() >= 200 && response.getStatus() <= 299) { <END> this.tracer.close(spanFromRequest); } } } }</code><technical_language>write following, more readable/clear some. java if (HttpStatus.valueOf(response.getStatus()).is2xxSuccessful()) {</technical_language>

Target:
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException { String uri = this.urlPathHelper.getPathWithinApplication(request); boolean skip = this.skipPattern.matcher(uri).matches() || Span.SPAN_NOT_SAMPLED.equals(ServletUtils.getHeader(request, response, Span.SAMPLED_NAME)); Span spanFromRequest = (Span) request.getAttribute(TRACE_REQUEST_ATTR); if (spanFromRequest != null) { this.tracer.continueSpan(spanFromRequest); } addToResponseIfNotPresent(response, Span.SAMPLED_NAME, skip ? Span.SPAN_NOT_SAMPLED : Span.SPAN_SAMPLED); String name = HTTP_COMPONENT + ":" + uri; spanFromRequest = createSpan(request, skip, spanFromRequest, name); Throwable exception = null; try { this.spanInjector.inject(spanFromRequest, response); filterChain.doFilter(request, response); } catch (Throwable e) { exception = e; throw e; } finally { if (isAsyncStarted(request) || request.isAsyncStarted()) { this.tracer.detach(spanFromRequest); return; } addToResponseIfNotPresent(response, Span.SAMPLED_NAME, skip ? Span.SPAN_NOT_SAMPLED : Span.SPAN_SAMPLED); if (spanFromRequest != null) { addResponseTags(response, exception); if (spanFromRequest.hasSavedSpan()) { Span parent = spanFromRequest.getSavedSpan(); if (parent.isRemote()) { parent.logEvent(Span.SERVER_SEND); parent.stop(); this.spanReporter.report(parent); } } else { spanFromRequest.logEvent(Span.SERVER_SEND); } HttpStatus httpStatus = HttpStatus.valueOf(response.getStatus()); if (httpStatus.is2xxSuccessful() || httpStatus.is3xxRedirection()) { this.tracer.close(spanFromRequest); } } } }