@Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { if (request instanceof HttpServletRequest) { HttpServletRequest httpRequest = (HttpServletRequest) request; String requestUri = httpRequest.getRequestURI(); String rootDir = getRootDir(requestUri); if (staticResourceDirs.contains(rootDir)) { // Static resource, not profiled chain.doFilter(request, response); } else { Profiler profiler = Profiler.createIfDebug(Logger).start(); try { chain.doFilter(request, response); } finally { if (profiler.isDebugEnabled()) { String queryString = httpRequest.getQueryString(); String message = String.format( queryString == null ? MESSAGE_WITHOUT_QUERY : MESSAGE_WITH_QUERY, httpRequest.getMethod(), requestUri, queryString); profiler.stopDebug(message); } } } } else { // Not an HTTP request, not profiled chain.doFilter(request, response); } }
@Override public ClusterStatsResponse get() { Profiler profiler = Profiler.createIfTrace(EsClient.LOGGER).start(); try { return super.execute().actionGet(); } catch (Exception e) { throw new IllegalStateException(String.format("Fail to execute %s", toString()), e); } finally { if (profiler.isTraceEnabled()) { profiler.stopTrace(toString()); } } }
public ProjectReactor execute() { Profiler profiler = Profiler.create(LOG).startInfo("Process project properties"); Map<String, Map<String, String>> propertiesByModuleId = new HashMap<>(); extractPropertiesByModule(propertiesByModuleId, "", taskProps.properties()); ProjectDefinition rootProject = defineRootProject(propertiesByModuleId.get(""), null); rootProjectWorkDir = rootProject.getWorkDir(); defineChildren(rootProject, propertiesByModuleId); cleanAndCheckProjectDefinitions(rootProject); // Since task properties are now empty we should add root module properties taskProps.properties().putAll(propertiesByModuleId.get("")); profiler.stopDebug(); return new ProjectReactor(rootProject); }