Repository: hadoop Updated Branches: refs/heads/YARN-5355 0c1863144 -> 787d59420
YARN-5699. Retrospect yarn entity fields which are publishing in events info fields. Contributed by Rohith Sharma K S. Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/787d5942 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/787d5942 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/787d5942 Branch: refs/heads/YARN-5355 Commit: 787d5942003a5441ba455a79fa08da28f60d5777 Parents: 0c18631 Author: Sangjin Lee <sj...@apache.org> Authored: Sat Oct 15 13:58:40 2016 -0700 Committer: Sangjin Lee <sj...@apache.org> Committed: Sat Oct 15 13:58:40 2016 -0700 ---------------------------------------------------------------------- ...pplicationHistoryManagerOnTimelineStore.java | 69 ++++++------- ...pplicationHistoryManagerOnTimelineStore.java | 38 +++---- .../metrics/AppAttemptMetricsConstants.java | 16 +-- .../metrics/ContainerMetricsConstants.java | 21 ++-- .../timelineservice/NMTimelinePublisher.java | 32 +++--- .../metrics/TimelineServiceV1Publisher.java | 44 ++++---- .../metrics/TimelineServiceV2Publisher.java | 101 +++++++++---------- .../metrics/TestSystemMetricsPublisher.java | 40 ++++---- 8 files changed, 186 insertions(+), 175 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/787d5942/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/ApplicationHistoryManagerOnTimelineStore.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/ApplicationHistoryManagerOnTimelineStore.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/ApplicationHistoryManagerOnTimelineStore.java index 84d4543..b5b2362 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/ApplicationHistoryManagerOnTimelineStore.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/ApplicationHistoryManagerOnTimelineStore.java @@ -455,21 +455,21 @@ public class ApplicationHistoryManagerOnTimelineStore extends AbstractService if (eventInfo == null) { continue; } - if (eventInfo.containsKey(AppAttemptMetricsConstants.HOST_EVENT_INFO)) { + if (eventInfo.containsKey(AppAttemptMetricsConstants.HOST_INFO)) { host = - eventInfo.get(AppAttemptMetricsConstants.HOST_EVENT_INFO) + eventInfo.get(AppAttemptMetricsConstants.HOST_INFO) .toString(); } if (eventInfo - .containsKey(AppAttemptMetricsConstants.RPC_PORT_EVENT_INFO)) { + .containsKey(AppAttemptMetricsConstants.RPC_PORT_INFO)) { rpcPort = (Integer) eventInfo.get( - AppAttemptMetricsConstants.RPC_PORT_EVENT_INFO); + AppAttemptMetricsConstants.RPC_PORT_INFO); } if (eventInfo - .containsKey(AppAttemptMetricsConstants.MASTER_CONTAINER_EVENT_INFO)) { + .containsKey(AppAttemptMetricsConstants.MASTER_CONTAINER_INFO)) { amContainerId = ContainerId.fromString(eventInfo.get( - AppAttemptMetricsConstants.MASTER_CONTAINER_EVENT_INFO) + AppAttemptMetricsConstants.MASTER_CONTAINER_INFO) .toString()); } } else if (event.getEventType().equals( @@ -479,39 +479,40 @@ public class ApplicationHistoryManagerOnTimelineStore extends AbstractService continue; } if (eventInfo - .containsKey(AppAttemptMetricsConstants.TRACKING_URL_EVENT_INFO)) { + .containsKey(AppAttemptMetricsConstants.TRACKING_URL_INFO)) { trackingUrl = eventInfo.get( - AppAttemptMetricsConstants.TRACKING_URL_EVENT_INFO) + AppAttemptMetricsConstants.TRACKING_URL_INFO) .toString(); } if (eventInfo - .containsKey(AppAttemptMetricsConstants.ORIGINAL_TRACKING_URL_EVENT_INFO)) { + .containsKey( + AppAttemptMetricsConstants.ORIGINAL_TRACKING_URL_INFO)) { originalTrackingUrl = eventInfo .get( - AppAttemptMetricsConstants.ORIGINAL_TRACKING_URL_EVENT_INFO) + AppAttemptMetricsConstants.ORIGINAL_TRACKING_URL_INFO) .toString(); } if (eventInfo - .containsKey(AppAttemptMetricsConstants.DIAGNOSTICS_INFO_EVENT_INFO)) { + .containsKey(AppAttemptMetricsConstants.DIAGNOSTICS_INFO)) { diagnosticsInfo = eventInfo.get( - AppAttemptMetricsConstants.DIAGNOSTICS_INFO_EVENT_INFO) + AppAttemptMetricsConstants.DIAGNOSTICS_INFO) .toString(); } if (eventInfo - .containsKey(AppAttemptMetricsConstants.STATE_EVENT_INFO)) { + .containsKey(AppAttemptMetricsConstants.STATE_INFO)) { state = YarnApplicationAttemptState.valueOf(eventInfo.get( - AppAttemptMetricsConstants.STATE_EVENT_INFO) + AppAttemptMetricsConstants.STATE_INFO) .toString()); } if (eventInfo - .containsKey(AppAttemptMetricsConstants.MASTER_CONTAINER_EVENT_INFO)) { + .containsKey(AppAttemptMetricsConstants.MASTER_CONTAINER_INFO)) { amContainerId = ContainerId.fromString(eventInfo.get( - AppAttemptMetricsConstants.MASTER_CONTAINER_EVENT_INFO) + AppAttemptMetricsConstants.MASTER_CONTAINER_INFO) .toString()); } } @@ -539,37 +540,37 @@ public class ApplicationHistoryManagerOnTimelineStore extends AbstractService Map<String, Object> entityInfo = entity.getOtherInfo(); if (entityInfo != null) { if (entityInfo - .containsKey(ContainerMetricsConstants.ALLOCATED_MEMORY_ENTITY_INFO)) { + .containsKey(ContainerMetricsConstants.ALLOCATED_MEMORY_INFO)) { allocatedMem = (Integer) entityInfo.get( - ContainerMetricsConstants.ALLOCATED_MEMORY_ENTITY_INFO); + ContainerMetricsConstants.ALLOCATED_MEMORY_INFO); } if (entityInfo - .containsKey(ContainerMetricsConstants.ALLOCATED_VCORE_ENTITY_INFO)) { + .containsKey(ContainerMetricsConstants.ALLOCATED_VCORE_INFO)) { allocatedVcore = (Integer) entityInfo.get( - ContainerMetricsConstants.ALLOCATED_VCORE_ENTITY_INFO); + ContainerMetricsConstants.ALLOCATED_VCORE_INFO); } if (entityInfo - .containsKey(ContainerMetricsConstants.ALLOCATED_HOST_ENTITY_INFO)) { + .containsKey(ContainerMetricsConstants.ALLOCATED_HOST_INFO)) { allocatedHost = entityInfo - .get(ContainerMetricsConstants.ALLOCATED_HOST_ENTITY_INFO) + .get(ContainerMetricsConstants.ALLOCATED_HOST_INFO) .toString(); } if (entityInfo - .containsKey(ContainerMetricsConstants.ALLOCATED_PORT_ENTITY_INFO)) { + .containsKey(ContainerMetricsConstants.ALLOCATED_PORT_INFO)) { allocatedPort = (Integer) entityInfo.get( - ContainerMetricsConstants.ALLOCATED_PORT_ENTITY_INFO); + ContainerMetricsConstants.ALLOCATED_PORT_INFO); } if (entityInfo - .containsKey(ContainerMetricsConstants.ALLOCATED_PRIORITY_ENTITY_INFO)) { + .containsKey(ContainerMetricsConstants.ALLOCATED_PRIORITY_INFO)) { allocatedPriority = (Integer) entityInfo.get( - ContainerMetricsConstants.ALLOCATED_PRIORITY_ENTITY_INFO); + ContainerMetricsConstants.ALLOCATED_PRIORITY_INFO); } if (entityInfo.containsKey( - ContainerMetricsConstants.ALLOCATED_HOST_HTTP_ADDRESS_ENTITY_INFO)) { + ContainerMetricsConstants.ALLOCATED_HOST_HTTP_ADDRESS_INFO)) { nodeHttpAddress = (String) entityInfo - .get(ContainerMetricsConstants.ALLOCATED_HOST_HTTP_ADDRESS_ENTITY_INFO); + .get(ContainerMetricsConstants.ALLOCATED_HOST_HTTP_ADDRESS_INFO); } } List<TimelineEvent> events = entity.getEvents(); @@ -586,22 +587,22 @@ public class ApplicationHistoryManagerOnTimelineStore extends AbstractService continue; } if (eventInfo - .containsKey(ContainerMetricsConstants.DIAGNOSTICS_INFO_EVENT_INFO)) { + .containsKey(ContainerMetricsConstants.DIAGNOSTICS_INFO)) { diagnosticsInfo = eventInfo.get( - ContainerMetricsConstants.DIAGNOSTICS_INFO_EVENT_INFO) + ContainerMetricsConstants.DIAGNOSTICS_INFO) .toString(); } if (eventInfo - .containsKey(ContainerMetricsConstants.EXIT_STATUS_EVENT_INFO)) { + .containsKey(ContainerMetricsConstants.EXIT_STATUS_INFO)) { exitStatus = (Integer) eventInfo.get( - ContainerMetricsConstants.EXIT_STATUS_EVENT_INFO); + ContainerMetricsConstants.EXIT_STATUS_INFO); } if (eventInfo - .containsKey(ContainerMetricsConstants.STATE_EVENT_INFO)) { + .containsKey(ContainerMetricsConstants.STATE_INFO)) { state = ContainerState.valueOf(eventInfo.get( - ContainerMetricsConstants.STATE_EVENT_INFO).toString()); + ContainerMetricsConstants.STATE_INFO).toString()); } } } http://git-wip-us.apache.org/repos/asf/hadoop/blob/787d5942/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestApplicationHistoryManagerOnTimelineStore.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestApplicationHistoryManagerOnTimelineStore.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestApplicationHistoryManagerOnTimelineStore.java index b65b22b..8d311de 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestApplicationHistoryManagerOnTimelineStore.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestApplicationHistoryManagerOnTimelineStore.java @@ -589,13 +589,13 @@ public class TestApplicationHistoryManagerOnTimelineStore { tEvent.setEventType(AppAttemptMetricsConstants.REGISTERED_EVENT_TYPE); tEvent.setTimestamp(Integer.MAX_VALUE + 1L); Map<String, Object> eventInfo = new HashMap<String, Object>(); - eventInfo.put(AppAttemptMetricsConstants.TRACKING_URL_EVENT_INFO, + eventInfo.put(AppAttemptMetricsConstants.TRACKING_URL_INFO, "test tracking url"); - eventInfo.put(AppAttemptMetricsConstants.ORIGINAL_TRACKING_URL_EVENT_INFO, + eventInfo.put(AppAttemptMetricsConstants.ORIGINAL_TRACKING_URL_INFO, "test original tracking url"); - eventInfo.put(AppAttemptMetricsConstants.HOST_EVENT_INFO, "test host"); - eventInfo.put(AppAttemptMetricsConstants.RPC_PORT_EVENT_INFO, 100); - eventInfo.put(AppAttemptMetricsConstants.MASTER_CONTAINER_EVENT_INFO, + eventInfo.put(AppAttemptMetricsConstants.HOST_INFO, "test host"); + eventInfo.put(AppAttemptMetricsConstants.RPC_PORT_INFO, 100); + eventInfo.put(AppAttemptMetricsConstants.MASTER_CONTAINER_INFO, ContainerId.newContainerId(appAttemptId, 1)); tEvent.setEventInfo(eventInfo); entity.addEvent(tEvent); @@ -603,15 +603,15 @@ public class TestApplicationHistoryManagerOnTimelineStore { tEvent.setEventType(AppAttemptMetricsConstants.FINISHED_EVENT_TYPE); tEvent.setTimestamp(Integer.MAX_VALUE + 2L); eventInfo = new HashMap<String, Object>(); - eventInfo.put(AppAttemptMetricsConstants.TRACKING_URL_EVENT_INFO, + eventInfo.put(AppAttemptMetricsConstants.TRACKING_URL_INFO, "test tracking url"); - eventInfo.put(AppAttemptMetricsConstants.ORIGINAL_TRACKING_URL_EVENT_INFO, + eventInfo.put(AppAttemptMetricsConstants.ORIGINAL_TRACKING_URL_INFO, "test original tracking url"); - eventInfo.put(AppAttemptMetricsConstants.DIAGNOSTICS_INFO_EVENT_INFO, + eventInfo.put(AppAttemptMetricsConstants.DIAGNOSTICS_INFO, "test diagnostics info"); - eventInfo.put(AppAttemptMetricsConstants.FINAL_STATUS_EVENT_INFO, + eventInfo.put(AppAttemptMetricsConstants.FINAL_STATUS_INFO, FinalApplicationStatus.UNDEFINED.toString()); - eventInfo.put(AppAttemptMetricsConstants.STATE_EVENT_INFO, + eventInfo.put(AppAttemptMetricsConstants.STATE_INFO, YarnApplicationAttemptState.FINISHED.toString()); tEvent.setEventInfo(eventInfo); entity.addEvent(tEvent); @@ -628,15 +628,15 @@ public class TestApplicationHistoryManagerOnTimelineStore { entity.addPrimaryFilter( TimelineStore.SystemFilter.ENTITY_OWNER.toString(), "yarn"); Map<String, Object> entityInfo = new HashMap<String, Object>(); - entityInfo.put(ContainerMetricsConstants.ALLOCATED_MEMORY_ENTITY_INFO, -1); - entityInfo.put(ContainerMetricsConstants.ALLOCATED_VCORE_ENTITY_INFO, -1); - entityInfo.put(ContainerMetricsConstants.ALLOCATED_HOST_ENTITY_INFO, + entityInfo.put(ContainerMetricsConstants.ALLOCATED_MEMORY_INFO, -1); + entityInfo.put(ContainerMetricsConstants.ALLOCATED_VCORE_INFO, -1); + entityInfo.put(ContainerMetricsConstants.ALLOCATED_HOST_INFO, "test host"); - entityInfo.put(ContainerMetricsConstants.ALLOCATED_PORT_ENTITY_INFO, 100); + entityInfo.put(ContainerMetricsConstants.ALLOCATED_PORT_INFO, 100); entityInfo - .put(ContainerMetricsConstants.ALLOCATED_PRIORITY_ENTITY_INFO, -1); + .put(ContainerMetricsConstants.ALLOCATED_PRIORITY_INFO, -1); entityInfo.put(ContainerMetricsConstants - .ALLOCATED_HOST_HTTP_ADDRESS_ENTITY_INFO, "http://test:1234"); + .ALLOCATED_HOST_HTTP_ADDRESS_INFO, "http://test:1234"); entity.setOtherInfo(entityInfo); TimelineEvent tEvent = new TimelineEvent(); tEvent.setEventType(ContainerMetricsConstants.CREATED_EVENT_TYPE); @@ -647,10 +647,10 @@ public class TestApplicationHistoryManagerOnTimelineStore { tEvent.setEventType(ContainerMetricsConstants.FINISHED_EVENT_TYPE); tEvent.setTimestamp(Integer.MAX_VALUE + 2L); Map<String, Object> eventInfo = new HashMap<String, Object>(); - eventInfo.put(ContainerMetricsConstants.DIAGNOSTICS_INFO_EVENT_INFO, + eventInfo.put(ContainerMetricsConstants.DIAGNOSTICS_INFO, "test diagnostics info"); - eventInfo.put(ContainerMetricsConstants.EXIT_STATUS_EVENT_INFO, -1); - eventInfo.put(ContainerMetricsConstants.STATE_EVENT_INFO, + eventInfo.put(ContainerMetricsConstants.EXIT_STATUS_INFO, -1); + eventInfo.put(ContainerMetricsConstants.STATE_INFO, ContainerState.COMPLETE.toString()); tEvent.setEventInfo(eventInfo); entity.addEvent(tEvent); http://git-wip-us.apache.org/repos/asf/hadoop/blob/787d5942/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/metrics/AppAttemptMetricsConstants.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/metrics/AppAttemptMetricsConstants.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/metrics/AppAttemptMetricsConstants.java index a7809cf..2f61f43 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/metrics/AppAttemptMetricsConstants.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/metrics/AppAttemptMetricsConstants.java @@ -37,28 +37,28 @@ public class AppAttemptMetricsConstants { public static final String PARENT_PRIMARY_FILTER = "YARN_APPLICATION_ATTEMPT_PARENT"; - public static final String TRACKING_URL_EVENT_INFO = + public static final String TRACKING_URL_INFO = "YARN_APPLICATION_ATTEMPT_TRACKING_URL"; - public static final String ORIGINAL_TRACKING_URL_EVENT_INFO = + public static final String ORIGINAL_TRACKING_URL_INFO = "YARN_APPLICATION_ATTEMPT_ORIGINAL_TRACKING_URL"; - public static final String HOST_EVENT_INFO = + public static final String HOST_INFO = "YARN_APPLICATION_ATTEMPT_HOST"; - public static final String RPC_PORT_EVENT_INFO = + public static final String RPC_PORT_INFO = "YARN_APPLICATION_ATTEMPT_RPC_PORT"; - public static final String MASTER_CONTAINER_EVENT_INFO = + public static final String MASTER_CONTAINER_INFO = "YARN_APPLICATION_ATTEMPT_MASTER_CONTAINER"; - public static final String DIAGNOSTICS_INFO_EVENT_INFO = + public static final String DIAGNOSTICS_INFO = "YARN_APPLICATION_ATTEMPT_DIAGNOSTICS_INFO"; - public static final String FINAL_STATUS_EVENT_INFO = + public static final String FINAL_STATUS_INFO = "YARN_APPLICATION_ATTEMPT_FINAL_STATUS"; - public static final String STATE_EVENT_INFO = + public static final String STATE_INFO = "YARN_APPLICATION_ATTEMPT_STATE"; } http://git-wip-us.apache.org/repos/asf/hadoop/blob/787d5942/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/metrics/ContainerMetricsConstants.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/metrics/ContainerMetricsConstants.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/metrics/ContainerMetricsConstants.java index eadb5b7..9cf2b0a 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/metrics/ContainerMetricsConstants.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/metrics/ContainerMetricsConstants.java @@ -41,33 +41,36 @@ public class ContainerMetricsConstants { public static final String FINISHED_IN_RM_EVENT_TYPE = "YARN_RM_CONTAINER_FINISHED"; + public static final String CONTAINER_FINISHED_TIME = + "YARN_CONTAINER_FINISHED_TIME"; + public static final String PARENT_PRIMARIY_FILTER = "YARN_CONTAINER_PARENT"; - public static final String ALLOCATED_MEMORY_ENTITY_INFO = + public static final String ALLOCATED_MEMORY_INFO = "YARN_CONTAINER_ALLOCATED_MEMORY"; - public static final String ALLOCATED_VCORE_ENTITY_INFO = + public static final String ALLOCATED_VCORE_INFO = "YARN_CONTAINER_ALLOCATED_VCORE"; - public static final String ALLOCATED_HOST_ENTITY_INFO = + public static final String ALLOCATED_HOST_INFO = "YARN_CONTAINER_ALLOCATED_HOST"; - public static final String ALLOCATED_PORT_ENTITY_INFO = + public static final String ALLOCATED_PORT_INFO = "YARN_CONTAINER_ALLOCATED_PORT"; - public static final String ALLOCATED_PRIORITY_ENTITY_INFO = + public static final String ALLOCATED_PRIORITY_INFO = "YARN_CONTAINER_ALLOCATED_PRIORITY"; - public static final String DIAGNOSTICS_INFO_EVENT_INFO = + public static final String DIAGNOSTICS_INFO = "YARN_CONTAINER_DIAGNOSTICS_INFO"; - public static final String EXIT_STATUS_EVENT_INFO = + public static final String EXIT_STATUS_INFO = "YARN_CONTAINER_EXIT_STATUS"; - public static final String STATE_EVENT_INFO = + public static final String STATE_INFO = "YARN_CONTAINER_STATE"; - public static final String ALLOCATED_HOST_HTTP_ADDRESS_ENTITY_INFO = + public static final String ALLOCATED_HOST_HTTP_ADDRESS_INFO = "YARN_CONTAINER_ALLOCATED_HOST_HTTP_ADDRESS"; // Event of this type will be emitted by NM. http://git-wip-us.apache.org/repos/asf/hadoop/blob/787d5942/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/timelineservice/NMTimelinePublisher.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/timelineservice/NMTimelinePublisher.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/timelineservice/NMTimelinePublisher.java index 387900a..0b1978e 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/timelineservice/NMTimelinePublisher.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/timelineservice/NMTimelinePublisher.java @@ -29,6 +29,7 @@ import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.service.CompositeService; import org.apache.hadoop.yarn.api.records.ApplicationId; import org.apache.hadoop.yarn.api.records.ContainerId; +import org.apache.hadoop.yarn.api.records.ContainerState; import org.apache.hadoop.yarn.api.records.ContainerStatus; import org.apache.hadoop.yarn.api.records.NodeId; import org.apache.hadoop.yarn.api.records.Resource; @@ -98,7 +99,6 @@ public class NMTimelinePublisher extends CompositeService { // context will be updated after containerManagerImpl is started // hence NMMetricsPublisher is added subservice of containerManagerImpl this.nodeId = context.getNodeId(); - this.httpAddress = nodeId.getHost() + ":" + context.getHttpPort(); } @VisibleForTesting @@ -167,18 +167,18 @@ public class NMTimelinePublisher extends CompositeService { Resource resource = container.getResource(); Map<String, Object> entityInfo = new HashMap<String, Object>(); - entityInfo.put(ContainerMetricsConstants.ALLOCATED_MEMORY_ENTITY_INFO, + entityInfo.put(ContainerMetricsConstants.ALLOCATED_MEMORY_INFO, resource.getMemorySize()); - entityInfo.put(ContainerMetricsConstants.ALLOCATED_VCORE_ENTITY_INFO, + entityInfo.put(ContainerMetricsConstants.ALLOCATED_VCORE_INFO, resource.getVirtualCores()); - entityInfo.put(ContainerMetricsConstants.ALLOCATED_HOST_ENTITY_INFO, + entityInfo.put(ContainerMetricsConstants.ALLOCATED_HOST_INFO, nodeId.getHost()); - entityInfo.put(ContainerMetricsConstants.ALLOCATED_PORT_ENTITY_INFO, + entityInfo.put(ContainerMetricsConstants.ALLOCATED_PORT_INFO, nodeId.getPort()); - entityInfo.put(ContainerMetricsConstants.ALLOCATED_PRIORITY_ENTITY_INFO, + entityInfo.put(ContainerMetricsConstants.ALLOCATED_PRIORITY_INFO, container.getPriority().toString()); entityInfo.put( - ContainerMetricsConstants.ALLOCATED_HOST_HTTP_ADDRESS_ENTITY_INFO, + ContainerMetricsConstants.ALLOCATED_HOST_HTTP_ADDRESS_INFO, httpAddress); entity.setInfo(entityInfo); @@ -198,17 +198,20 @@ public class NMTimelinePublisher extends CompositeService { ContainerId containerId = containerStatus.getContainerId(); TimelineEntity entity = createContainerEntity(containerId); - Map<String, Object> eventInfo = new HashMap<String, Object>(); - eventInfo.put(ContainerMetricsConstants.DIAGNOSTICS_INFO_EVENT_INFO, + Map<String, Object> entityInfo = new HashMap<String, Object>(); + entityInfo.put(ContainerMetricsConstants.DIAGNOSTICS_INFO, containerStatus.getDiagnostics()); - eventInfo.put(ContainerMetricsConstants.EXIT_STATUS_EVENT_INFO, + entityInfo.put(ContainerMetricsConstants.EXIT_STATUS_INFO, containerStatus.getExitStatus()); + entityInfo.put(ContainerMetricsConstants.STATE_INFO, + ContainerState.COMPLETE.toString()); + entityInfo.put(ContainerMetricsConstants.CONTAINER_FINISHED_TIME, + timeStamp); + entity.setInfo(entityInfo); TimelineEvent tEvent = new TimelineEvent(); tEvent.setId(ContainerMetricsConstants.FINISHED_EVENT_TYPE); tEvent.setTimestamp(timeStamp); - tEvent.setInfo(eventInfo); - entity.addEvent(tEvent); dispatcher.getEventHandler().handle(new TimelinePublishEvent(entity, @@ -302,6 +305,11 @@ public class NMTimelinePublisher extends CompositeService { public void publishContainerEvent(ContainerEvent event) { // publish only when the desired event is received + if (this.httpAddress == null) { + // update httpAddress for first time. When this service started, + // web server will not be started. + this.httpAddress = nodeId.getHost() + ":" + context.getHttpPort(); + } switch (event.getType()) { case INIT_CONTAINER: publishContainerCreatedEvent(event); http://git-wip-us.apache.org/repos/asf/hadoop/blob/787d5942/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/metrics/TimelineServiceV1Publisher.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/metrics/TimelineServiceV1Publisher.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/metrics/TimelineServiceV1Publisher.java index 7f4ed33..bb3ea8a 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/metrics/TimelineServiceV1Publisher.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/metrics/TimelineServiceV1Publisher.java @@ -209,16 +209,16 @@ public class TimelineServiceV1Publisher extends AbstractSystemMetricsPublisher { tEvent.setEventType(AppAttemptMetricsConstants.REGISTERED_EVENT_TYPE); tEvent.setTimestamp(registeredTime); Map<String, Object> eventInfo = new HashMap<String, Object>(); - eventInfo.put(AppAttemptMetricsConstants.TRACKING_URL_EVENT_INFO, + eventInfo.put(AppAttemptMetricsConstants.TRACKING_URL_INFO, appAttempt.getTrackingUrl()); - eventInfo.put(AppAttemptMetricsConstants.ORIGINAL_TRACKING_URL_EVENT_INFO, + eventInfo.put(AppAttemptMetricsConstants.ORIGINAL_TRACKING_URL_INFO, appAttempt.getOriginalTrackingUrl()); - eventInfo.put(AppAttemptMetricsConstants.HOST_EVENT_INFO, + eventInfo.put(AppAttemptMetricsConstants.HOST_INFO, appAttempt.getHost()); - eventInfo.put(AppAttemptMetricsConstants.RPC_PORT_EVENT_INFO, + eventInfo.put(AppAttemptMetricsConstants.RPC_PORT_INFO, appAttempt.getRpcPort()); if (appAttempt.getMasterContainer() != null) { - eventInfo.put(AppAttemptMetricsConstants.MASTER_CONTAINER_EVENT_INFO, + eventInfo.put(AppAttemptMetricsConstants.MASTER_CONTAINER_INFO, appAttempt.getMasterContainer().getId().toString()); } tEvent.setEventInfo(eventInfo); @@ -240,18 +240,18 @@ public class TimelineServiceV1Publisher extends AbstractSystemMetricsPublisher { tEvent.setEventType(AppAttemptMetricsConstants.FINISHED_EVENT_TYPE); tEvent.setTimestamp(finishedTime); Map<String, Object> eventInfo = new HashMap<String, Object>(); - eventInfo.put(AppAttemptMetricsConstants.TRACKING_URL_EVENT_INFO, + eventInfo.put(AppAttemptMetricsConstants.TRACKING_URL_INFO, appAttempt.getTrackingUrl()); - eventInfo.put(AppAttemptMetricsConstants.ORIGINAL_TRACKING_URL_EVENT_INFO, + eventInfo.put(AppAttemptMetricsConstants.ORIGINAL_TRACKING_URL_INFO, appAttempt.getOriginalTrackingUrl()); - eventInfo.put(AppAttemptMetricsConstants.DIAGNOSTICS_INFO_EVENT_INFO, + eventInfo.put(AppAttemptMetricsConstants.DIAGNOSTICS_INFO, appAttempt.getDiagnostics()); - eventInfo.put(AppAttemptMetricsConstants.FINAL_STATUS_EVENT_INFO, + eventInfo.put(AppAttemptMetricsConstants.FINAL_STATUS_INFO, app.getFinalApplicationStatus().toString()); - eventInfo.put(AppAttemptMetricsConstants.STATE_EVENT_INFO, RMServerUtils + eventInfo.put(AppAttemptMetricsConstants.STATE_INFO, RMServerUtils .createApplicationAttemptState(appAttemtpState).toString()); if (appAttempt.getMasterContainer() != null) { - eventInfo.put(AppAttemptMetricsConstants.MASTER_CONTAINER_EVENT_INFO, + eventInfo.put(AppAttemptMetricsConstants.MASTER_CONTAINER_INFO, appAttempt.getMasterContainer().getId().toString()); } tEvent.setEventInfo(eventInfo); @@ -267,18 +267,18 @@ public class TimelineServiceV1Publisher extends AbstractSystemMetricsPublisher { public void containerCreated(RMContainer container, long createdTime) { TimelineEntity entity = createContainerEntity(container.getContainerId()); Map<String, Object> entityInfo = new HashMap<String, Object>(); - entityInfo.put(ContainerMetricsConstants.ALLOCATED_MEMORY_ENTITY_INFO, + entityInfo.put(ContainerMetricsConstants.ALLOCATED_MEMORY_INFO, container.getAllocatedResource().getMemorySize()); - entityInfo.put(ContainerMetricsConstants.ALLOCATED_VCORE_ENTITY_INFO, + entityInfo.put(ContainerMetricsConstants.ALLOCATED_VCORE_INFO, container.getAllocatedResource().getVirtualCores()); - entityInfo.put(ContainerMetricsConstants.ALLOCATED_HOST_ENTITY_INFO, + entityInfo.put(ContainerMetricsConstants.ALLOCATED_HOST_INFO, container.getAllocatedNode().getHost()); - entityInfo.put(ContainerMetricsConstants.ALLOCATED_PORT_ENTITY_INFO, + entityInfo.put(ContainerMetricsConstants.ALLOCATED_PORT_INFO, container.getAllocatedNode().getPort()); - entityInfo.put(ContainerMetricsConstants.ALLOCATED_PRIORITY_ENTITY_INFO, + entityInfo.put(ContainerMetricsConstants.ALLOCATED_PRIORITY_INFO, container.getAllocatedPriority().getPriority()); entityInfo.put( - ContainerMetricsConstants.ALLOCATED_HOST_HTTP_ADDRESS_ENTITY_INFO, + ContainerMetricsConstants.ALLOCATED_HOST_HTTP_ADDRESS_INFO, container.getNodeHttpAddress()); entity.setOtherInfo(entityInfo); @@ -301,16 +301,16 @@ public class TimelineServiceV1Publisher extends AbstractSystemMetricsPublisher { tEvent.setEventType(ContainerMetricsConstants.FINISHED_EVENT_TYPE); tEvent.setTimestamp(finishedTime); Map<String, Object> eventInfo = new HashMap<String, Object>(); - eventInfo.put(ContainerMetricsConstants.DIAGNOSTICS_INFO_EVENT_INFO, + eventInfo.put(ContainerMetricsConstants.DIAGNOSTICS_INFO, container.getDiagnosticsInfo()); - eventInfo.put(ContainerMetricsConstants.EXIT_STATUS_EVENT_INFO, + eventInfo.put(ContainerMetricsConstants.EXIT_STATUS_INFO, container.getContainerExitStatus()); - eventInfo.put(ContainerMetricsConstants.STATE_EVENT_INFO, + eventInfo.put(ContainerMetricsConstants.STATE_INFO, container.getContainerState().toString()); Map<String, Object> entityInfo = new HashMap<String, Object>(); - entityInfo.put(ContainerMetricsConstants.ALLOCATED_HOST_ENTITY_INFO, + entityInfo.put(ContainerMetricsConstants.ALLOCATED_HOST_INFO, container.getAllocatedNode().getHost()); - entityInfo.put(ContainerMetricsConstants.ALLOCATED_PORT_ENTITY_INFO, + entityInfo.put(ContainerMetricsConstants.ALLOCATED_PORT_INFO, container.getAllocatedNode().getPort()); entity.setOtherInfo(entityInfo); tEvent.setEventInfo(eventInfo); http://git-wip-us.apache.org/repos/asf/hadoop/blob/787d5942/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/metrics/TimelineServiceV2Publisher.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/metrics/TimelineServiceV2Publisher.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/metrics/TimelineServiceV2Publisher.java index a248199..3809250 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/metrics/TimelineServiceV2Publisher.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/metrics/TimelineServiceV2Publisher.java @@ -152,22 +152,22 @@ public class TimelineServiceV2Publisher extends AbstractSystemMetricsPublisher { TimelineEvent tEvent = new TimelineEvent(); tEvent.setId(ApplicationMetricsConstants.FINISHED_EVENT_TYPE); tEvent.setTimestamp(finishedTime); - Map<String, Object> eventInfo = new HashMap<String, Object>(); - eventInfo.put(ApplicationMetricsConstants.DIAGNOSTICS_INFO_EVENT_INFO, + entity.addEvent(tEvent); + + Map<String, Object> entityInfo = new HashMap<String, Object>(); + entityInfo.put(ApplicationMetricsConstants.DIAGNOSTICS_INFO_EVENT_INFO, app.getDiagnostics().toString()); - eventInfo.put(ApplicationMetricsConstants.FINAL_STATUS_EVENT_INFO, + entityInfo.put(ApplicationMetricsConstants.FINAL_STATUS_EVENT_INFO, app.getFinalApplicationStatus().toString()); - eventInfo.put(ApplicationMetricsConstants.STATE_EVENT_INFO, + entityInfo.put(ApplicationMetricsConstants.STATE_EVENT_INFO, RMServerUtils.createApplicationState(state).toString()); ApplicationAttemptId appAttemptId = app.getCurrentAppAttempt() == null ? null : app.getCurrentAppAttempt().getAppAttemptId(); if (appAttemptId != null) { - eventInfo.put(ApplicationMetricsConstants.LATEST_APP_ATTEMPT_EVENT_INFO, + entityInfo.put(ApplicationMetricsConstants.LATEST_APP_ATTEMPT_EVENT_INFO, appAttemptId.toString()); } - tEvent.setInfo(eventInfo); - - entity.addEvent(tEvent); + entity.setInfo(entityInfo); getDispatcher().getEventHandler().handle(new TimelineV2PublishEvent( SystemMetricsEventType.PUBLISH_ENTITY, entity, app.getApplicationId())); @@ -188,6 +188,11 @@ public class TimelineServiceV2Publisher extends AbstractSystemMetricsPublisher { 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())); } @@ -245,21 +250,23 @@ public class TimelineServiceV2Publisher extends AbstractSystemMetricsPublisher { TimelineEvent tEvent = new TimelineEvent(); tEvent.setId(AppAttemptMetricsConstants.REGISTERED_EVENT_TYPE); tEvent.setTimestamp(registeredTime); - Map<String, Object> eventInfo = new HashMap<String, Object>(); - eventInfo.put(AppAttemptMetricsConstants.TRACKING_URL_EVENT_INFO, + entity.addEvent(tEvent); + + Map<String, Object> entityInfo = new HashMap<String, Object>(); + entityInfo.put(AppAttemptMetricsConstants.TRACKING_URL_INFO, appAttempt.getTrackingUrl()); - eventInfo.put(AppAttemptMetricsConstants.ORIGINAL_TRACKING_URL_EVENT_INFO, + entityInfo.put(AppAttemptMetricsConstants.ORIGINAL_TRACKING_URL_INFO, appAttempt.getOriginalTrackingUrl()); - eventInfo.put(AppAttemptMetricsConstants.HOST_EVENT_INFO, + entityInfo.put(AppAttemptMetricsConstants.HOST_INFO, appAttempt.getHost()); - eventInfo.put(AppAttemptMetricsConstants.RPC_PORT_EVENT_INFO, + entityInfo.put(AppAttemptMetricsConstants.RPC_PORT_INFO, appAttempt.getRpcPort()); if (appAttempt.getMasterContainer() != null) { - eventInfo.put(AppAttemptMetricsConstants.MASTER_CONTAINER_EVENT_INFO, + entityInfo.put(AppAttemptMetricsConstants.MASTER_CONTAINER_INFO, appAttempt.getMasterContainer().getId().toString()); } - tEvent.setInfo(eventInfo); - entity.addEvent(tEvent); + entity.setInfo(entityInfo); + getDispatcher().getEventHandler().handle( new TimelineV2PublishEvent(SystemMetricsEventType.PUBLISH_ENTITY, entity, appAttempt.getAppAttemptId().getApplicationId())); @@ -276,26 +283,20 @@ public class TimelineServiceV2Publisher extends AbstractSystemMetricsPublisher { TimelineEvent tEvent = new TimelineEvent(); tEvent.setId(AppAttemptMetricsConstants.FINISHED_EVENT_TYPE); tEvent.setTimestamp(finishedTime); - Map<String, Object> eventInfo = new HashMap<String, Object>(); - eventInfo.put(AppAttemptMetricsConstants.TRACKING_URL_EVENT_INFO, - appAttempt.getTrackingUrl()); - eventInfo.put(AppAttemptMetricsConstants.ORIGINAL_TRACKING_URL_EVENT_INFO, - appAttempt.getOriginalTrackingUrl()); - eventInfo.put(AppAttemptMetricsConstants.DIAGNOSTICS_INFO_EVENT_INFO, + entity.addEvent(tEvent); + + Map<String, Object> entityInfo = new HashMap<String, Object>(); + entityInfo.put(AppAttemptMetricsConstants.DIAGNOSTICS_INFO, appAttempt.getDiagnostics()); // app will get the final status from app attempt, or create one // based on app state if it doesn't exist - eventInfo.put(AppAttemptMetricsConstants.FINAL_STATUS_EVENT_INFO, + entityInfo.put(AppAttemptMetricsConstants.FINAL_STATUS_INFO, app.getFinalApplicationStatus().toString()); - eventInfo.put(AppAttemptMetricsConstants.STATE_EVENT_INFO, RMServerUtils + entityInfo.put(AppAttemptMetricsConstants.STATE_INFO, RMServerUtils .createApplicationAttemptState(appAttemtpState).toString()); - if (appAttempt.getMasterContainer() != null) { - eventInfo.put(AppAttemptMetricsConstants.MASTER_CONTAINER_EVENT_INFO, - appAttempt.getMasterContainer().getId().toString()); - } - tEvent.setInfo(eventInfo); + entity.setInfo(entityInfo); + - entity.addEvent(tEvent); getDispatcher().getEventHandler().handle( new TimelineV2PublishEvent(SystemMetricsEventType.PUBLISH_ENTITY, entity, appAttempt.getAppAttemptId().getApplicationId())); @@ -320,25 +321,26 @@ public class TimelineServiceV2Publisher extends AbstractSystemMetricsPublisher { TimelineEvent tEvent = new TimelineEvent(); tEvent.setId(ContainerMetricsConstants.CREATED_IN_RM_EVENT_TYPE); tEvent.setTimestamp(createdTime); + entity.addEvent(tEvent); + // updated as event info instead of entity info, as entity info is updated // by NM - Map<String, Object> eventInfo = new HashMap<String, Object>(); - eventInfo.put(ContainerMetricsConstants.ALLOCATED_MEMORY_ENTITY_INFO, + Map<String, Object> entityInfo = new HashMap<String, Object>(); + entityInfo.put(ContainerMetricsConstants.ALLOCATED_MEMORY_INFO, container.getAllocatedResource().getMemorySize()); - eventInfo.put(ContainerMetricsConstants.ALLOCATED_VCORE_ENTITY_INFO, + entityInfo.put(ContainerMetricsConstants.ALLOCATED_VCORE_INFO, container.getAllocatedResource().getVirtualCores()); - eventInfo.put(ContainerMetricsConstants.ALLOCATED_HOST_ENTITY_INFO, + entityInfo.put(ContainerMetricsConstants.ALLOCATED_HOST_INFO, container.getAllocatedNode().getHost()); - eventInfo.put(ContainerMetricsConstants.ALLOCATED_PORT_ENTITY_INFO, + entityInfo.put(ContainerMetricsConstants.ALLOCATED_PORT_INFO, container.getAllocatedNode().getPort()); - eventInfo.put(ContainerMetricsConstants.ALLOCATED_PRIORITY_ENTITY_INFO, + entityInfo.put(ContainerMetricsConstants.ALLOCATED_PRIORITY_INFO, container.getAllocatedPriority().getPriority()); - eventInfo.put( - ContainerMetricsConstants.ALLOCATED_HOST_HTTP_ADDRESS_ENTITY_INFO, + entityInfo.put( + ContainerMetricsConstants.ALLOCATED_HOST_HTTP_ADDRESS_INFO, container.getNodeHttpAddress()); - tEvent.setInfo(eventInfo); + entity.setInfo(entityInfo); - entity.addEvent(tEvent); getDispatcher().getEventHandler().handle(new TimelineV2PublishEvent( SystemMetricsEventType.PUBLISH_ENTITY, entity, container .getContainerId().getApplicationAttemptId().getApplicationId())); @@ -354,22 +356,19 @@ public class TimelineServiceV2Publisher extends AbstractSystemMetricsPublisher { TimelineEvent tEvent = new TimelineEvent(); tEvent.setId(ContainerMetricsConstants.FINISHED_IN_RM_EVENT_TYPE); tEvent.setTimestamp(finishedTime); - Map<String, Object> eventInfo = new HashMap<String, Object>(); - eventInfo.put(ContainerMetricsConstants.DIAGNOSTICS_INFO_EVENT_INFO, + entity.addEvent(tEvent); + + Map<String, Object> entityInfo = new HashMap<String, Object>(); + entityInfo.put(ContainerMetricsConstants.DIAGNOSTICS_INFO, container.getDiagnosticsInfo()); - eventInfo.put(ContainerMetricsConstants.EXIT_STATUS_EVENT_INFO, + entityInfo.put(ContainerMetricsConstants.EXIT_STATUS_INFO, container.getContainerExitStatus()); - eventInfo.put(ContainerMetricsConstants.STATE_EVENT_INFO, + entityInfo.put(ContainerMetricsConstants.STATE_INFO, container.getContainerState().toString()); - Map<String, Object> entityInfo = new HashMap<String, Object>(); - entityInfo.put(ContainerMetricsConstants.ALLOCATED_HOST_ENTITY_INFO, - container.getAllocatedNode().getHost()); - entityInfo.put(ContainerMetricsConstants.ALLOCATED_PORT_ENTITY_INFO, - container.getAllocatedNode().getPort()); + entityInfo.put(ContainerMetricsConstants.CONTAINER_FINISHED_TIME, + finishedTime); entity.setInfo(entityInfo); - tEvent.setInfo(eventInfo); - entity.addEvent(tEvent); getDispatcher().getEventHandler().handle(new TimelineV2PublishEvent( SystemMetricsEventType.PUBLISH_ENTITY, entity, container .getContainerId().getApplicationAttemptId().getApplicationId())); http://git-wip-us.apache.org/repos/asf/hadoop/blob/787d5942/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/metrics/TestSystemMetricsPublisher.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/metrics/TestSystemMetricsPublisher.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/metrics/TestSystemMetricsPublisher.java index 1e279d5..f615868 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/metrics/TestSystemMetricsPublisher.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/metrics/TestSystemMetricsPublisher.java @@ -328,34 +328,34 @@ public class TestSystemMetricsPublisher { hasRegisteredEvent = true; Assert.assertEquals(appAttempt.getHost(), event.getEventInfo() - .get(AppAttemptMetricsConstants.HOST_EVENT_INFO)); + .get(AppAttemptMetricsConstants.HOST_INFO)); Assert .assertEquals(appAttempt.getRpcPort(), event.getEventInfo().get( - AppAttemptMetricsConstants.RPC_PORT_EVENT_INFO)); + AppAttemptMetricsConstants.RPC_PORT_INFO)); Assert.assertEquals( appAttempt.getMasterContainer().getId().toString(), event.getEventInfo().get( - AppAttemptMetricsConstants.MASTER_CONTAINER_EVENT_INFO)); + AppAttemptMetricsConstants.MASTER_CONTAINER_INFO)); } else if (event.getEventType().equals( AppAttemptMetricsConstants.FINISHED_EVENT_TYPE)) { hasFinishedEvent = true; Assert.assertEquals(appAttempt.getDiagnostics(), event.getEventInfo() - .get(AppAttemptMetricsConstants.DIAGNOSTICS_INFO_EVENT_INFO)); + .get(AppAttemptMetricsConstants.DIAGNOSTICS_INFO)); Assert.assertEquals(appAttempt.getTrackingUrl(), event.getEventInfo() - .get(AppAttemptMetricsConstants.TRACKING_URL_EVENT_INFO)); + .get(AppAttemptMetricsConstants.TRACKING_URL_INFO)); Assert.assertEquals( appAttempt.getOriginalTrackingUrl(), event.getEventInfo().get( - AppAttemptMetricsConstants.ORIGINAL_TRACKING_URL_EVENT_INFO)); + AppAttemptMetricsConstants.ORIGINAL_TRACKING_URL_INFO)); Assert.assertEquals( FinalApplicationStatus.UNDEFINED.toString(), event.getEventInfo().get( - AppAttemptMetricsConstants.FINAL_STATUS_EVENT_INFO)); + AppAttemptMetricsConstants.FINAL_STATUS_INFO)); Assert.assertEquals( YarnApplicationAttemptState.FINISHED.toString(), event.getEventInfo().get( - AppAttemptMetricsConstants.STATE_EVENT_INFO)); + AppAttemptMetricsConstants.STATE_INFO)); } } Assert.assertTrue(hasRegisteredEvent && hasFinishedEvent); @@ -378,17 +378,17 @@ public class TestSystemMetricsPublisher { Assert.assertNotNull(entity.getOtherInfo()); Assert.assertEquals(2, entity.getOtherInfo().size()); Assert.assertNotNull(entity.getOtherInfo().get( - ContainerMetricsConstants.ALLOCATED_HOST_ENTITY_INFO)); + ContainerMetricsConstants.ALLOCATED_HOST_INFO)); Assert.assertNotNull(entity.getOtherInfo().get( - ContainerMetricsConstants.ALLOCATED_PORT_ENTITY_INFO)); + ContainerMetricsConstants.ALLOCATED_PORT_INFO)); Assert.assertEquals( container.getAllocatedNode().getHost(), entity.getOtherInfo().get( - ContainerMetricsConstants.ALLOCATED_HOST_ENTITY_INFO)); + ContainerMetricsConstants.ALLOCATED_HOST_INFO)); Assert.assertEquals( container.getAllocatedNode().getPort(), entity.getOtherInfo().get( - ContainerMetricsConstants.ALLOCATED_PORT_ENTITY_INFO)); + ContainerMetricsConstants.ALLOCATED_PORT_INFO)); } @Test(timeout = 10000) @@ -419,25 +419,25 @@ public class TestSystemMetricsPublisher { Assert.assertEquals( container.getAllocatedNode().getHost(), entity.getOtherInfo().get( - ContainerMetricsConstants.ALLOCATED_HOST_ENTITY_INFO)); + ContainerMetricsConstants.ALLOCATED_HOST_INFO)); Assert.assertEquals( container.getAllocatedNode().getPort(), entity.getOtherInfo().get( - ContainerMetricsConstants.ALLOCATED_PORT_ENTITY_INFO)); + ContainerMetricsConstants.ALLOCATED_PORT_INFO)); Assert.assertEquals(container.getAllocatedResource().getMemorySize(), // KeyValueBasedTimelineStore could cast long to integer, need make sure // variables for compare have same type. ((Integer) entity.getOtherInfo().get( - ContainerMetricsConstants.ALLOCATED_MEMORY_ENTITY_INFO)) + ContainerMetricsConstants.ALLOCATED_MEMORY_INFO)) .longValue()); Assert.assertEquals( container.getAllocatedResource().getVirtualCores(), entity.getOtherInfo().get( - ContainerMetricsConstants.ALLOCATED_VCORE_ENTITY_INFO)); + ContainerMetricsConstants.ALLOCATED_VCORE_INFO)); Assert.assertEquals( container.getAllocatedPriority().getPriority(), entity.getOtherInfo().get( - ContainerMetricsConstants.ALLOCATED_PRIORITY_ENTITY_INFO)); + ContainerMetricsConstants.ALLOCATED_PRIORITY_INFO)); boolean hasCreatedEvent = false; boolean hasFinishedEvent = false; for (TimelineEvent event : entity.getEvents()) { @@ -452,13 +452,13 @@ public class TestSystemMetricsPublisher { Assert.assertEquals( container.getDiagnosticsInfo(), event.getEventInfo().get( - ContainerMetricsConstants.DIAGNOSTICS_INFO_EVENT_INFO)); + ContainerMetricsConstants.DIAGNOSTICS_INFO)); Assert.assertEquals( container.getContainerExitStatus(), event.getEventInfo().get( - ContainerMetricsConstants.EXIT_STATUS_EVENT_INFO)); + ContainerMetricsConstants.EXIT_STATUS_INFO)); Assert.assertEquals(container.getContainerState().toString(), event - .getEventInfo().get(ContainerMetricsConstants.STATE_EVENT_INFO)); + .getEventInfo().get(ContainerMetricsConstants.STATE_INFO)); } } Assert.assertTrue(hasCreatedEvent && hasFinishedEvent); --------------------------------------------------------------------- To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-commits-h...@hadoop.apache.org