private void splitCompletionEvent( TaskId taskId, DriverStats driverStats, @Nullable String failureType, @Nullable String failureMessage) { Duration timeToStart = null; if (driverStats.getStartTime() != null) { timeToStart = millis(driverStats.getStartTime().getMillis() - driverStats.getCreateTime().getMillis()); } Duration timeToEnd = null; if (driverStats.getEndTime() != null) { timeToEnd = millis(driverStats.getEndTime().getMillis() - driverStats.getCreateTime().getMillis()); } try { eventClient.post( new SplitCompletionEvent( taskId.getQueryId(), taskId.getStageId(), taskId, environment, driverStats.getQueuedTime(), driverStats.getStartTime(), timeToStart, timeToEnd, driverStats.getRawInputDataSize(), driverStats.getRawInputPositions(), driverStats.getRawInputReadTime(), driverStats.getElapsedTime(), driverStats.getTotalCpuTime(), driverStats.getTotalUserTime(), failureType, failureMessage, objectMapper.writeValueAsString(driverStats))); } catch (JsonProcessingException e) { log.error(e, "Error posting split completion event for task %s", taskId); } }