startEvt.setEventType(EventTypes.QUERY_SUBMITTED.name()); startEvt.setTimestamp(startTime); atsEntity.addEvent(startEvt);
TimelineEntity createPreHookEvent(String queryId, String query, JSONObject explainPlan, long startTime, String user, String requestuser, int numMrJobs, int numTezJobs, String opId) throws Exception { JSONObject queryObj = new JSONObject(); queryObj.put("queryText", query); queryObj.put("queryPlan", explainPlan); LOG.info("Received pre-hook notification for :" + queryId); if (LOG.isDebugEnabled()) { LOG.debug("Otherinfo: " + queryObj.toString()); LOG.debug("Operation id: <" + opId + ">"); } TimelineEntity atsEntity = new TimelineEntity(); atsEntity.setEntityId(queryId); atsEntity.setEntityType(EntityTypes.HIVE_QUERY_ID.name()); atsEntity.addPrimaryFilter(PrimaryFilterTypes.user.name(), user); atsEntity.addPrimaryFilter(PrimaryFilterTypes.requestuser.name(), requestuser); if (opId != null) { atsEntity.addPrimaryFilter(PrimaryFilterTypes.operationid.name(), opId); } TimelineEvent startEvt = new TimelineEvent(); startEvt.setEventType(EventTypes.QUERY_SUBMITTED.name()); startEvt.setTimestamp(startTime); atsEntity.addEvent(startEvt); atsEntity.addOtherInfo(OtherInfoTypes.QUERY.name(), queryObj.toString()); atsEntity.addOtherInfo(OtherInfoTypes.TEZ.name(), numTezJobs > 0); atsEntity.addOtherInfo(OtherInfoTypes.MAPRED.name(), numMrJobs > 0); return atsEntity; }
TimelineEntity createPostHookEvent(String queryId, long stopTime, String user, String requestuser, boolean success, String opId) { LOG.info("Received post-hook notification for :" + queryId); TimelineEntity atsEntity = new TimelineEntity(); atsEntity.setEntityId(queryId); atsEntity.setEntityType(EntityTypes.HIVE_QUERY_ID.name()); atsEntity.addPrimaryFilter(PrimaryFilterTypes.user.name(), user); atsEntity.addPrimaryFilter(PrimaryFilterTypes.requestuser.name(), requestuser); if (opId != null) { atsEntity.addPrimaryFilter(PrimaryFilterTypes.operationid.name(), opId); } TimelineEvent stopEvt = new TimelineEvent(); stopEvt.setEventType(EventTypes.QUERY_COMPLETED.name()); stopEvt.setTimestamp(stopTime); atsEntity.addEvent(stopEvt); atsEntity.addOtherInfo(OtherInfoTypes.STATUS.name(), success); return atsEntity; }
startEvt.setEventType(EventTypes.QUERY_SUBMITTED.name()); startEvt.setTimestamp(startTime); atsEntity.addEvent(startEvt);
TimelineEntity createPostHookEvent(String queryId, long stopTime, String user, String requestuser, boolean success, String opId, Map<String, Long> durations, String domainId) throws Exception { LOG.info("Received post-hook notification for :" + queryId); TimelineEntity atsEntity = new TimelineEntity(); atsEntity.setEntityId(queryId); atsEntity.setEntityType(EntityTypes.HIVE_QUERY_ID.name()); atsEntity.addPrimaryFilter(PrimaryFilterTypes.user.name(), user); atsEntity.addPrimaryFilter(PrimaryFilterTypes.requestuser.name(), requestuser); if (opId != null) { atsEntity.addPrimaryFilter(PrimaryFilterTypes.operationid.name(), opId); } TimelineEvent stopEvt = new TimelineEvent(); stopEvt.setEventType(EventTypes.QUERY_COMPLETED.name()); stopEvt.setTimestamp(stopTime); atsEntity.addEvent(stopEvt); atsEntity.addOtherInfo(OtherInfoTypes.STATUS.name(), success); // Perf times JSONObject perfObj = new JSONObject(new LinkedHashMap<>()); for (Map.Entry<String, Long> entry : durations.entrySet()) { perfObj.put(entry.getKey(), entry.getValue()); } atsEntity.addOtherInfo(OtherInfoTypes.PERF.name(), perfObj.toString()); atsEntity.setDomainId(domainId); return atsEntity; }
TimelineEntity createPostHookEvent(String queryId, long stopTime, String user, String requestuser, boolean success, String opId, Map<String, Long> durations, String domainId) throws Exception { LOG.info("Received post-hook notification for :" + queryId); TimelineEntity atsEntity = new TimelineEntity(); atsEntity.setEntityId(queryId); atsEntity.setEntityType(EntityTypes.HIVE_QUERY_ID.name()); atsEntity.addPrimaryFilter(PrimaryFilterTypes.user.name(), user); atsEntity.addPrimaryFilter(PrimaryFilterTypes.requestuser.name(), requestuser); if (opId != null) { atsEntity.addPrimaryFilter(PrimaryFilterTypes.operationid.name(), opId); } TimelineEvent stopEvt = new TimelineEvent(); stopEvt.setEventType(EventTypes.QUERY_COMPLETED.name()); stopEvt.setTimestamp(stopTime); atsEntity.addEvent(stopEvt); atsEntity.addOtherInfo(OtherInfoTypes.STATUS.name(), success); // Perf times JSONObject perfObj = new JSONObject(new LinkedHashMap<>()); for (Map.Entry<String, Long> entry : durations.entrySet()) { perfObj.put(entry.getKey(), entry.getValue()); } atsEntity.addOtherInfo(OtherInfoTypes.PERF.name(), perfObj.toString()); atsEntity.setDomainId(domainId); return atsEntity; }