use of org.apache.helix.monitoring.StateTransitionDataPoint in project helix by apache.
the class HelixTask method reportMessageStat.
private void reportMessageStat(HelixManager manager, Message message, HelixTaskResult taskResult) {
// report stat
if (!message.getMsgType().equals(MessageType.STATE_TRANSITION.name())) {
return;
}
long now = new Date().getTime();
long msgReadTime = message.getReadTimeStamp();
long msgExecutionStartTime = message.getExecuteStartTimeStamp();
if (msgReadTime != 0 && msgExecutionStartTime != 0) {
long totalDelay = now - msgReadTime;
long executionDelay = now - msgExecutionStartTime;
if (totalDelay > 0 && executionDelay > 0) {
String fromState = message.getFromState();
String toState = message.getToState();
String transition = fromState + "--" + toState;
StateTransitionContext cxt = new StateTransitionContext(manager.getClusterName(), manager.getInstanceName(), message.getResourceName(), transition);
StateTransitionDataPoint data = new StateTransitionDataPoint(totalDelay, executionDelay, taskResult.isSuccess());
_executor.getParticipantMonitor().reportTransitionStat(cxt, data);
}
} else {
logger.warn("message read time and start execution time not recorded.");
}
}
Aggregations