@SuppressWarnings("unchecked") @Override public void appStateUpdated(RMApp app, YarnApplicationState appState, long updatedTime) { ApplicationEntity entity = createApplicationEntity(app.getApplicationId()); Map<String, Object> eventInfo = new HashMap<String, Object>(); eventInfo.put(ApplicationMetricsConstants.STATE_EVENT_INFO, appState); TimelineEvent tEvent = new TimelineEvent(); tEvent.setId(ApplicationMetricsConstants.STATE_UPDATED_EVENT_TYPE); tEvent.setTimestamp(updatedTime); tEvent.setInfo(eventInfo); entity.addEvent(tEvent); // publish in entity info also to query using filters Map<String, Object> entityInfo = new HashMap<String, Object>(); entityInfo.put(ApplicationMetricsConstants.STATE_EVENT_INFO, appState); entity.setInfo(entityInfo); getDispatcher().getEventHandler().handle(new TimelineV2PublishEvent( SystemMetricsEventType.PUBLISH_ENTITY, entity, app.getApplicationId())); }
@SuppressWarnings("unchecked") @Override public void appACLsUpdated(RMApp app, String appViewACLs, long updatedTime) { ApplicationEntity entity = createApplicationEntity(app.getApplicationId()); TimelineEvent tEvent = new TimelineEvent(); Map<String, Object> entityInfo = new HashMap<String, Object>(); entityInfo.put(ApplicationMetricsConstants.APP_VIEW_ACLS_ENTITY_INFO, (appViewACLs == null) ? "" : appViewACLs); entity.setInfo(entityInfo); tEvent.setId(ApplicationMetricsConstants.ACLS_UPDATED_EVENT_TYPE); tEvent.setTimestamp(updatedTime); entity.addEvent(tEvent); getDispatcher().getEventHandler().handle(new TimelineV2PublishEvent( SystemMetricsEventType.PUBLISH_ENTITY, entity, app.getApplicationId())); }
@SuppressWarnings("unchecked") @Override public void appUpdated(RMApp app, long currentTimeMillis) { ApplicationEntity entity = createApplicationEntity(app.getApplicationId()); Map<String, Object> eventInfo = new HashMap<String, Object>(); eventInfo.put(ApplicationMetricsConstants.QUEUE_ENTITY_INFO, app.getQueue()); eventInfo.put(ApplicationMetricsConstants.APPLICATION_PRIORITY_INFO, app.getApplicationPriority().getPriority()); TimelineEvent tEvent = new TimelineEvent(); tEvent.setId(ApplicationMetricsConstants.UPDATED_EVENT_TYPE); tEvent.setTimestamp(currentTimeMillis); tEvent.setInfo(eventInfo); entity.addEvent(tEvent); getDispatcher().getEventHandler().handle(new TimelineV2PublishEvent( SystemMetricsEventType.PUBLISH_ENTITY, entity, app.getApplicationId())); }
@SuppressWarnings("unchecked") @Override public void appFinished(RMApp app, RMAppState state, long finishedTime) { ApplicationEntity entity = createApplicationEntity(app.getApplicationId()); TimelineEvent tEvent = new TimelineEvent(); tEvent.setId(ApplicationMetricsConstants.FINISHED_EVENT_TYPE); tEvent.setTimestamp(finishedTime); entity.addEvent(tEvent); Map<String, Object> entityInfo = new HashMap<String, Object>(); entityInfo.put(ApplicationMetricsConstants.DIAGNOSTICS_INFO_EVENT_INFO, app.getDiagnostics().toString()); entityInfo.put(ApplicationMetricsConstants.FINAL_STATUS_EVENT_INFO, app.getFinalApplicationStatus().toString()); entityInfo.put(ApplicationMetricsConstants.STATE_EVENT_INFO, RMServerUtils.createApplicationState(state).toString()); ApplicationAttemptId appAttemptId = app.getCurrentAppAttempt() == null ? null : app.getCurrentAppAttempt().getAppAttemptId(); if (appAttemptId != null) { entityInfo.put(ApplicationMetricsConstants.LATEST_APP_ATTEMPT_EVENT_INFO, appAttemptId.toString()); } entity.setInfo(entityInfo); RMAppMetrics appMetrics = app.getRMAppMetrics(); Set<TimelineMetric> entityMetrics = getTimelinelineAppMetrics(appMetrics, finishedTime); entity.setMetrics(entityMetrics); getDispatcher().getEventHandler().handle( new ApplicationFinishPublishEvent(SystemMetricsEventType. PUBLISH_APPLICATION_FINISHED_ENTITY, entity, app)); }
tEvent.setId(ApplicationMetricsConstants.CREATED_EVENT_TYPE); tEvent.setTimestamp(createdTime); entity.addEvent(tEvent);