Search in sources :

Example 1 with StateTransitionDataPoint

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.");
    }
}
Also used : StateTransitionDataPoint(org.apache.helix.monitoring.StateTransitionDataPoint) Date(java.util.Date) StateTransitionContext(org.apache.helix.monitoring.StateTransitionContext)

Aggregations

Date (java.util.Date)1 StateTransitionContext (org.apache.helix.monitoring.StateTransitionContext)1 StateTransitionDataPoint (org.apache.helix.monitoring.StateTransitionDataPoint)1