code: @Override
    public void doFilter(ServletRequest sReq, ServletResponse sRes, FilterChain chain) throws IOException, ServletException
    {
      HttpServletRequest req = (HttpServletRequest) sReq;
      HttpServletResponse res = (HttpServletResponse) sRes;
      if (shouldProfile(req.getRequestURI()))
      {
        String queryString = req.getQueryString();
        String requestId = String.valueOf(counter.incrementAndGet());
  
        String redirectRequestIds = null;
        if (!isEmpty(queryString))
        {
          String[] parts = queryString.split("&");
          for (String part : parts)
          {
            String[] nameValue = part.split("=");
            if (REQUEST_ID_PARAM_REDIRECT.equals(nameValue[0]))
            {
              redirectRequestIds = nameValue[1];
              break;
            }
          }
        }
  
        req.setAttribute(REQUEST_ID_ATTRIBUTE, requestId);
        res.addHeader(REQUEST_ID_HEADER, redirectRequestIds != null ? redirectRequestIds + "," + requestId : requestId);
  
        addIncludes(req);
  
        ResponseWrapper resWrapper = new ResponseWrapper(res, requestId, redirectRequestIds);
        MiniProfiler.Profile profile = null;
        long startTime = System.currentTimeMillis();
        MiniProfiler.start();
        try
        {
          chain.doFilter(sReq, resWrapper);
        } finally
        {
          profile = MiniProfiler.stop();
        }
  
        Map<String, Object> requestData = new HashMap<String, Object>();
        requestData.put("requestURL", req.getRequestURI() + ((req.getQueryString() != null) ? "?" + req.getQueryString() : ""));
        requestData.put("timestamp", startTime);
        requestData.put("redirect", resWrapper.getDidRedirect());
        String appstatsId = resWrapper.getAppstatsId();
        if (appstatsId != null)
        {
          requestData.put("appstatsId", appstatsId);
        }
        requestData.put("profile", profile);
        ms.put(String.format(MEMCACHE_KEY_FORMAT_STRING, requestId), requestData, Expiration.byDeltaSeconds(dataExpiry));
      } else
      {
        chain.doFilter(sReq, sRes);
      }
    }
docs: If profiling is supposed to occur for the current request, profile the
  request. Otherwise this filter does nothing.