use of com.hazelcast.jet.core.metrics.JobMetrics in project hazelcast by hazelcast.
the class MasterJobContext method formatExecutionSummary.
private String formatExecutionSummary(String conclusion, long completionTime) {
StringBuilder sb = new StringBuilder();
sb.append("Execution of ").append(mc.jobIdString()).append(' ').append(conclusion);
sb.append("\n\t").append("Start time: ").append(Util.toLocalDateTime(executionStartTime));
sb.append("\n\t").append("Duration: ").append(formatJobDuration(completionTime - executionStartTime));
if (jobMetrics.stream().noneMatch(rjm -> rjm.getBlob() != null)) {
sb.append("\n\tTo see additional job metrics enable JobConfig.storeMetricsAfterJobCompletion");
} else {
JobMetrics jobMetrics = JobMetricsUtil.toJobMetrics(this.jobMetrics);
Map<String, Long> receivedCounts = mergeByVertex(jobMetrics.get(MetricNames.RECEIVED_COUNT));
Map<String, Long> emittedCounts = mergeByVertex(jobMetrics.get(MetricNames.EMITTED_COUNT));
Map<String, Long> distributedBytesIn = mergeByVertex(jobMetrics.get(MetricNames.DISTRIBUTED_BYTES_IN));
Map<String, Long> distributedBytesOut = mergeByVertex(jobMetrics.get(MetricNames.DISTRIBUTED_BYTES_OUT));
sb.append("\n\tVertices:");
for (Vertex vertex : vertices) {
sb.append("\n\t\t").append(vertex.getName());
sb.append(getValueForVertex("\n\t\t\t" + MetricNames.RECEIVED_COUNT, vertex, receivedCounts));
sb.append(getValueForVertex("\n\t\t\t" + MetricNames.EMITTED_COUNT, vertex, emittedCounts));
sb.append(getValueForVertex("\n\t\t\t" + MetricNames.DISTRIBUTED_BYTES_IN, vertex, distributedBytesIn));
sb.append(getValueForVertex("\n\t\t\t" + MetricNames.DISTRIBUTED_BYTES_OUT, vertex, distributedBytesOut));
}
}
return sb.toString();
}
Aggregations