|
@@ -160,6 +160,8 @@ public class SystemMetricsPublisher extends CompositeService {
|
|
|
public void appAttemptRegistered(RMAppAttempt appAttempt,
|
|
|
long registeredTime) {
|
|
|
if (publishSystemMetrics) {
|
|
|
+ ContainerId container = (appAttempt.getMasterContainer() == null) ? null
|
|
|
+ : appAttempt.getMasterContainer().getId();
|
|
|
dispatcher.getEventHandler().handle(
|
|
|
new AppAttemptRegisteredEvent(
|
|
|
appAttempt.getAppAttemptId(),
|
|
@@ -167,7 +169,7 @@ public class SystemMetricsPublisher extends CompositeService {
|
|
|
appAttempt.getRpcPort(),
|
|
|
appAttempt.getTrackingUrl(),
|
|
|
appAttempt.getOriginalTrackingUrl(),
|
|
|
- appAttempt.getMasterContainer().getId(),
|
|
|
+ container,
|
|
|
registeredTime));
|
|
|
}
|
|
|
}
|
|
@@ -176,6 +178,8 @@ public class SystemMetricsPublisher extends CompositeService {
|
|
|
public void appAttemptFinished(RMAppAttempt appAttempt,
|
|
|
RMAppAttemptState appAttemtpState, RMApp app, long finishedTime) {
|
|
|
if (publishSystemMetrics) {
|
|
|
+ ContainerId container = (appAttempt.getMasterContainer() == null) ? null
|
|
|
+ : appAttempt.getMasterContainer().getId();
|
|
|
dispatcher.getEventHandler().handle(
|
|
|
new AppAttemptFinishedEvent(
|
|
|
appAttempt.getAppAttemptId(),
|
|
@@ -187,7 +191,7 @@ public class SystemMetricsPublisher extends CompositeService {
|
|
|
app.getFinalApplicationStatus(),
|
|
|
RMServerUtils.createApplicationAttemptState(appAttemtpState),
|
|
|
finishedTime,
|
|
|
- appAttempt.getMasterContainer().getId()));
|
|
|
+ container));
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -390,9 +394,10 @@ public class SystemMetricsPublisher extends CompositeService {
|
|
|
event.getHost());
|
|
|
eventInfo.put(AppAttemptMetricsConstants.RPC_PORT_EVENT_INFO,
|
|
|
event.getRpcPort());
|
|
|
- eventInfo.put(
|
|
|
- AppAttemptMetricsConstants.MASTER_CONTAINER_EVENT_INFO,
|
|
|
- event.getMasterContainerId().toString());
|
|
|
+ if (event.getMasterContainerId() != null) {
|
|
|
+ eventInfo.put(AppAttemptMetricsConstants.MASTER_CONTAINER_EVENT_INFO,
|
|
|
+ event.getMasterContainerId().toString());
|
|
|
+ }
|
|
|
tEvent.setEventInfo(eventInfo);
|
|
|
entity.addEvent(tEvent);
|
|
|
putEntity(entity);
|
|
@@ -417,9 +422,10 @@ public class SystemMetricsPublisher extends CompositeService {
|
|
|
event.getFinalApplicationStatus().toString());
|
|
|
eventInfo.put(AppAttemptMetricsConstants.STATE_EVENT_INFO,
|
|
|
event.getYarnApplicationAttemptState().toString());
|
|
|
- eventInfo.put(
|
|
|
- AppAttemptMetricsConstants.MASTER_CONTAINER_EVENT_INFO,
|
|
|
- event.getMasterContainerId().toString());
|
|
|
+ if (event.getMasterContainerId() != null) {
|
|
|
+ eventInfo.put(AppAttemptMetricsConstants.MASTER_CONTAINER_EVENT_INFO,
|
|
|
+ event.getMasterContainerId().toString());
|
|
|
+ }
|
|
|
tEvent.setEventInfo(eventInfo);
|
|
|
entity.addEvent(tEvent);
|
|
|
putEntity(entity);
|