use of org.apache.hadoop.yarn.api.records.timelineservice.TimelineMetric in project hadoop by apache.
the class TimelineServiceV2Publisher method getTimelineMetric.
private TimelineMetric getTimelineMetric(String name, long timestamp, Number value) {
TimelineMetric metric = new TimelineMetric();
metric.setId(name);
metric.addValue(timestamp, value);
return metric;
}
use of org.apache.hadoop.yarn.api.records.timelineservice.TimelineMetric in project hadoop by apache.
the class TimelineServiceV2Publisher method appFinished.
@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 TimelineV2PublishEvent(SystemMetricsEventType.PUBLISH_ENTITY, entity, app.getApplicationId()));
}
Aggregations