Class SpanCustomizingHandlerInterceptor

java.lang.Object
brave.spring.webmvc.SpanCustomizingHandlerInterceptor
All Implemented Interfaces:
org.springframework.web.servlet.HandlerInterceptor

public final class SpanCustomizingHandlerInterceptor
extends Object
implements org.springframework.web.servlet.HandlerInterceptor
Adds application-tier data to an existing http span via HandlerParser. This also sets the request property "http.route" so that it can be used in naming the http span.

Use this when you start traces at the servlet layer via TracingFilter.

  • Method Summary

    Modifier and Type Method Description
    void afterCompletion​(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Object handler, Exception ex)
    Sets the "error" attribute so that the TracingFilter can read it.
    void postHandle​(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Object handler, org.springframework.web.servlet.ModelAndView modelAndView)  
    boolean preHandle​(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Object o)
    Parses the request and sets the "http.route" attribute so that the TracingFilter can read it.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • preHandle

      public boolean preHandle​(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Object o)
      Parses the request and sets the "http.route" attribute so that the TracingFilter can read it.
      Specified by:
      preHandle in interface org.springframework.web.servlet.HandlerInterceptor
    • postHandle

      public void postHandle​(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Object handler, org.springframework.web.servlet.ModelAndView modelAndView)
      Specified by:
      postHandle in interface org.springframework.web.servlet.HandlerInterceptor
    • afterCompletion

      public void afterCompletion​(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Object handler, Exception ex)
      Sets the "error" attribute so that the TracingFilter can read it.
      Specified by:
      afterCompletion in interface org.springframework.web.servlet.HandlerInterceptor