Source:
<code>private DetectorTask detectFailure(PollReport pollReport, Layout layout) { log.trace("Handle failures for the report: {}", pollReport); try { <START> if (IOLatencyDetector.reportSpike() == true) { <END> Set<String> failedNodes = new HashSet<>(); failedNodes.add(serverContext.getLocalEndpoint()); log.info ("detected failure"); return detectFailure(layout, failedNodes, pollReport).get (); } ClusterState clusterState = pollReport.getClusterState(); if (clusterState.size() != layout.getAllServers().size()) { String err = String.format( "Cluster representation is different than layout. Cluster: %s, layout: %s", clusterState, layout ); throw new IllegalStateException(err); } Optional<NodeRank> maybeFailedNode = advisor.failedServer(clusterState); if (maybeFailedNode.isPresent()) { NodeRank failedNode = maybeFailedNode.get(); FailureDetectorMetrics history = FailureDetectorMetrics.builder() .localNode(serverContext.getLocalEndpoint()) .graph(advisor.getGraph(pollReport.getClusterState()).connectivityGraph()) .healed(failedNode) .action(FailureDetectorAction.FAIL) .unresponsiveNodes(layout.getUnresponsiveServers()) .layout(layout.getLayoutServers()) .epoch(layout.getEpoch()) .build(); serverContext.saveFailureDetectorMetrics(history); Set<String> failedNodes = new HashSet<>(); failedNodes.add(failedNode.getEndpoint()); return detectFailure(layout, failedNodes, pollReport).get(); } } catch (Exception e) { log.error("Exception invoking failure handler", e); } return DetectorTask.NOT_COMPLETED; }</code><technical_language>I this is good for logging purposes metrics collection. for fault detector I ultimately evaluate end-to-end metrics IO. gentrify this capture rpc level stats</technical_language>

Target:
private DetectorTask detectFailure(PollReport pollReport, Layout layout) { log.trace("Handle failures for the report: {}", pollReport); try { ClusterState clusterState = pollReport.getClusterState(); if (FileChannelPerf.reportSpike()) { Set<String> failedNodes = new HashSet<>(); failedNodes.add(serverContext.getLocalEndpoint()); log.info ("detected failure"); return detectFailure(layout, failedNodes, pollReport).get (); } if (clusterState.size() != layout.getAllServers().size()) { String err = String.format( "Cluster representation is different than layout. Cluster: %s, layout: %s", clusterState, layout ); throw new IllegalStateException(err); } Optional<NodeRank> maybeFailedNode = advisor.failedServer(clusterState); if (maybeFailedNode.isPresent()) { NodeRank failedNode = maybeFailedNode.get(); FailureDetectorMetrics history = FailureDetectorMetrics.builder() .localNode(serverContext.getLocalEndpoint()) .graph(advisor.getGraph(pollReport.getClusterState()).connectivityGraph()) .healed(failedNode) .action(FailureDetectorAction.FAIL) .unresponsiveNodes(layout.getUnresponsiveServers()) .layout(layout.getLayoutServers()) .epoch(layout.getEpoch()) .build(); serverContext.saveFailureDetectorMetrics(history); Set<String> failedNodes = new HashSet<>(); failedNodes.add(failedNode.getEndpoint()); return detectFailure(layout, failedNodes, pollReport).get(); } } catch (Exception e) { log.error("Exception invoking failure handler", e); } return DetectorTask.NOT_COMPLETED; }