Source:
public Flow getJobFlowById(@PathParam("cluster") String cluster, @PathParam("jobId") String jobId, @QueryParam("includeFlowField") List<String> includeFlowFields, @QueryParam("includeJobField") List<String> includeJobFields) throws IOException { LOG.info(String.format("Fetching Flow for cluster=%s, jobId=%s", cluster, jobId)); Stopwatch timer = new Stopwatch().start(); Predicate<String> jobFilter = null; if (includeJobFields != null && !includeJobFields.isEmpty()) { jobFilter = new SerializationContext.FieldNameFilter(includeJobFields); } Predicate<String> flowFilter = null; if (includeFlowFields != null && !includeFlowFields.isEmpty()) { flowFilter = new SerializationContext.FieldNameFilter(includeFlowFields); } serializationContext.set(new SerializationContext( SerializationContext.DetailLevel.EVERYTHING, null, flowFilter, jobFilter, null)); Flow flow = getJobHistoryService().getFlowByJobID(cluster, jobId, false); timer.stop(); StringBuilder builderIncludeJobRegex = new StringBuilder(); for(String s : includeJobFields) { builderIncludeJobRegex.append(s); } StringBuilder builderIncludeFlowFields = new StringBuilder(); for(String s : includeJobFields) { builderIncludeFlowFields.append(s); } if (flow != null) { LOG.info("For jobFlow/{cluster}/{jobId} with input query: " + "jobFlow/" + cluster + SLASH + jobId + "&includeJobField=" + builderIncludeJobRegex + "&includeFlowField=" + builderIncludeFlowFields + " fetched flow " + flow.getFlowName() + " with # " + flow.getJobCount() + " in " + timer); } else { LOG.info("For jobFlow/{cluster}/{jobId} with input query: " + "jobFlow/" + cluster + SLASH + jobId + "&includeJobField=" + builderIncludeJobRegex + " No flow found, spent " + timer); } HravenResponseMetrics.JOBFLOW_API_LATENCY_VALUE .set(timer.elapsed(TimeUnit.MILLISECONDS)); return flow; }

Target:
public Flow getJobFlowById(@PathParam("cluster") String cluster, @PathParam("jobId") String jobId, @QueryParam("includeFlowField") List<String> includeFlowFields, @QueryParam("includeJobField") List<String> includeJobFields) throws IOException { LOG.info(String.format("Fetching Flow for cluster=%s, jobId=%s", cluster, jobId)); Stopwatch timer = new Stopwatch().start(); Predicate<String> jobFilter = null; if (includeJobFields != null && !includeJobFields.isEmpty()) { jobFilter = new SerializationContext.FieldNameFilter(includeJobFields); } Predicate<String> flowFilter = null; if (includeFlowFields != null && !includeFlowFields.isEmpty()) { flowFilter = new SerializationContext.FieldNameFilter(includeFlowFields); } serializationContext.set(new SerializationContext( SerializationContext.DetailLevel.EVERYTHING, null, flowFilter, jobFilter, null)); Flow flow = getJobHistoryService().getFlowByJobID(cluster, jobId, false); timer.stop(); if (flow != null) { LOG.info("For jobFlow/{cluster}/{jobId} with input query: " + "jobFlow/" + cluster + SLASH + jobId + "&" + StringUtil.buildParam("includeJobField", includeJobFields) + "&" + StringUtil.buildParam("includeFlowField", includeFlowFields) + " fetched flow " + flow.getFlowName() + " with # " + flow.getJobCount() + " in " + timer); } else { LOG.info("For jobFlow/{cluster}/{jobId} with input query: " + "jobFlow/" + cluster + SLASH + jobId + "&" + StringUtil.buildParam("includeJobField", includeJobFields) + "&" + StringUtil.buildParam("includeFlowField", includeFlowFields) + " No flow found, spent " + timer); } HravenResponseMetrics.JOBFLOW_API_LATENCY_VALUE .set(timer.elapsed(TimeUnit.MILLISECONDS)); return flow; }