Example #1
0
        private static TimelineEntity CreateApplicationTimelineEntity(ApplicationId appId
                                                                      , bool emptyACLs, bool noAttemptId, bool wrongAppId)
        {
            TimelineEntity entity = new TimelineEntity();

            entity.SetEntityType(ApplicationMetricsConstants.EntityType);
            if (wrongAppId)
            {
                entity.SetEntityId("wrong_app_id");
            }
            else
            {
                entity.SetEntityId(appId.ToString());
            }
            entity.SetDomainId(TimelineDataManager.DefaultDomainId);
            entity.AddPrimaryFilter(TimelineStore.SystemFilter.EntityOwner.ToString(), "yarn"
                                    );
            IDictionary <string, object> entityInfo = new Dictionary <string, object>();

            entityInfo[ApplicationMetricsConstants.NameEntityInfo]          = "test app";
            entityInfo[ApplicationMetricsConstants.TypeEntityInfo]          = "test app type";
            entityInfo[ApplicationMetricsConstants.UserEntityInfo]          = "user1";
            entityInfo[ApplicationMetricsConstants.QueueEntityInfo]         = "test queue";
            entityInfo[ApplicationMetricsConstants.SubmittedTimeEntityInfo] = int.MaxValue +
                                                                              1L;
            entityInfo[ApplicationMetricsConstants.AppMemMetrics] = 123;
            entityInfo[ApplicationMetricsConstants.AppCpuMetrics] = 345;
            if (emptyACLs)
            {
                entityInfo[ApplicationMetricsConstants.AppViewAclsEntityInfo] = string.Empty;
            }
            else
            {
                entityInfo[ApplicationMetricsConstants.AppViewAclsEntityInfo] = "user2";
            }
            entity.SetOtherInfo(entityInfo);
            TimelineEvent tEvent = new TimelineEvent();

            tEvent.SetEventType(ApplicationMetricsConstants.CreatedEventType);
            tEvent.SetTimestamp(int.MaxValue + 2L + appId.GetId());
            entity.AddEvent(tEvent);
            tEvent = new TimelineEvent();
            tEvent.SetEventType(ApplicationMetricsConstants.FinishedEventType);
            tEvent.SetTimestamp(int.MaxValue + 3L + appId.GetId());
            IDictionary <string, object> eventInfo = new Dictionary <string, object>();

            eventInfo[ApplicationMetricsConstants.DiagnosticsInfoEventInfo] = "test diagnostics info";
            eventInfo[ApplicationMetricsConstants.FinalStatusEventInfo]     = FinalApplicationStatus
                                                                              .Undefined.ToString();
            eventInfo[ApplicationMetricsConstants.StateEventInfo] = YarnApplicationState.Finished
                                                                    .ToString();
            if (!noAttemptId)
            {
                eventInfo[ApplicationMetricsConstants.LatestAppAttemptEventInfo] = ApplicationAttemptId
                                                                                   .NewInstance(appId, 1);
            }
            tEvent.SetEventInfo(eventInfo);
            entity.AddEvent(tEvent);
            return(entity);
        }
Example #2
0
        private void PublishApplicationFinishedEvent(ApplicationFinishedEvent @event)
        {
            TimelineEntity entity = CreateApplicationEntity(@event.GetApplicationId());
            TimelineEvent  tEvent = new TimelineEvent();

            tEvent.SetEventType(ApplicationMetricsConstants.FinishedEventType);
            tEvent.SetTimestamp(@event.GetTimestamp());
            IDictionary <string, object> eventInfo = new Dictionary <string, object>();

            eventInfo[ApplicationMetricsConstants.DiagnosticsInfoEventInfo] = @event.GetDiagnosticsInfo
                                                                                  ();
            eventInfo[ApplicationMetricsConstants.FinalStatusEventInfo] = @event.GetFinalApplicationStatus
                                                                              ().ToString();
            eventInfo[ApplicationMetricsConstants.StateEventInfo] = @event.GetYarnApplicationState
                                                                        ().ToString();
            if (@event.GetLatestApplicationAttemptId() != null)
            {
                eventInfo[ApplicationMetricsConstants.LatestAppAttemptEventInfo] = @event.GetLatestApplicationAttemptId
                                                                                       ().ToString();
            }
            RMAppMetrics appMetrics = @event.GetAppMetrics();

            entity.AddOtherInfo(ApplicationMetricsConstants.AppCpuMetrics, appMetrics.GetVcoreSeconds
                                    ());
            entity.AddOtherInfo(ApplicationMetricsConstants.AppMemMetrics, appMetrics.GetMemorySeconds
                                    ());
            tEvent.SetEventInfo(eventInfo);
            entity.AddEvent(tEvent);
            PutEntity(entity);
        }
Example #3
0
        private void PublishContainerFinishedEvent(ContainerFinishedEvent @event)
        {
            TimelineEntity entity = CreateContainerEntity(@event.GetContainerId());
            TimelineEvent  tEvent = new TimelineEvent();

            tEvent.SetEventType(ContainerMetricsConstants.FinishedEventType);
            tEvent.SetTimestamp(@event.GetTimestamp());
            IDictionary <string, object> eventInfo = new Dictionary <string, object>();

            eventInfo[ContainerMetricsConstants.DiagnosticsInfoEventInfo] = @event.GetDiagnosticsInfo
                                                                                ();
            eventInfo[ContainerMetricsConstants.ExitStatusEventInfo] = @event.GetContainerExitStatus
                                                                           ();
            eventInfo[ContainerMetricsConstants.StateEventInfo] = @event.GetContainerState().
                                                                  ToString();
            tEvent.SetEventInfo(eventInfo);
            entity.AddEvent(tEvent);
            PutEntity(entity);
        }
Example #4
0
        private static TimelineEntity CreateAppAttemptTimelineEntity(ApplicationAttemptId
                                                                     appAttemptId)
        {
            TimelineEntity entity = new TimelineEntity();

            entity.SetEntityType(AppAttemptMetricsConstants.EntityType);
            entity.SetEntityId(appAttemptId.ToString());
            entity.SetDomainId(TimelineDataManager.DefaultDomainId);
            entity.AddPrimaryFilter(AppAttemptMetricsConstants.ParentPrimaryFilter, appAttemptId
                                    .GetApplicationId().ToString());
            entity.AddPrimaryFilter(TimelineStore.SystemFilter.EntityOwner.ToString(), "yarn"
                                    );
            TimelineEvent tEvent = new TimelineEvent();

            tEvent.SetEventType(AppAttemptMetricsConstants.RegisteredEventType);
            tEvent.SetTimestamp(int.MaxValue + 1L);
            IDictionary <string, object> eventInfo = new Dictionary <string, object>();

            eventInfo[AppAttemptMetricsConstants.TrackingUrlEventInfo]         = "test tracking url";
            eventInfo[AppAttemptMetricsConstants.OriginalTrackingUrlEventInfo] = "test original tracking url";
            eventInfo[AppAttemptMetricsConstants.HostEventInfo]            = "test host";
            eventInfo[AppAttemptMetricsConstants.RpcPortEventInfo]         = 100;
            eventInfo[AppAttemptMetricsConstants.MasterContainerEventInfo] = ContainerId.NewContainerId
                                                                                 (appAttemptId, 1);
            tEvent.SetEventInfo(eventInfo);
            entity.AddEvent(tEvent);
            tEvent = new TimelineEvent();
            tEvent.SetEventType(AppAttemptMetricsConstants.FinishedEventType);
            tEvent.SetTimestamp(int.MaxValue + 2L);
            eventInfo = new Dictionary <string, object>();
            eventInfo[AppAttemptMetricsConstants.TrackingUrlEventInfo]         = "test tracking url";
            eventInfo[AppAttemptMetricsConstants.OriginalTrackingUrlEventInfo] = "test original tracking url";
            eventInfo[AppAttemptMetricsConstants.DiagnosticsInfoEventInfo]     = "test diagnostics info";
            eventInfo[AppAttemptMetricsConstants.FinalStatusEventInfo]         = FinalApplicationStatus
                                                                                 .Undefined.ToString();
            eventInfo[AppAttemptMetricsConstants.StateEventInfo] = YarnApplicationAttemptState
                                                                   .Finished.ToString();
            tEvent.SetEventInfo(eventInfo);
            entity.AddEvent(tEvent);
            return(entity);
        }
Example #5
0
        private void PublishAppAttemptRegisteredEvent(AppAttemptRegisteredEvent @event)
        {
            TimelineEntity entity = CreateAppAttemptEntity(@event.GetApplicationAttemptId());
            TimelineEvent  tEvent = new TimelineEvent();

            tEvent.SetEventType(AppAttemptMetricsConstants.RegisteredEventType);
            tEvent.SetTimestamp(@event.GetTimestamp());
            IDictionary <string, object> eventInfo = new Dictionary <string, object>();

            eventInfo[AppAttemptMetricsConstants.TrackingUrlEventInfo] = @event.GetTrackingUrl
                                                                             ();
            eventInfo[AppAttemptMetricsConstants.OriginalTrackingUrlEventInfo] = @event.GetOriginalTrackingURL
                                                                                     ();
            eventInfo[AppAttemptMetricsConstants.HostEventInfo]            = @event.GetHost();
            eventInfo[AppAttemptMetricsConstants.RpcPortEventInfo]         = @event.GetRpcPort();
            eventInfo[AppAttemptMetricsConstants.MasterContainerEventInfo] = @event.GetMasterContainerId
                                                                                 ().ToString();
            tEvent.SetEventInfo(eventInfo);
            entity.AddEvent(tEvent);
            PutEntity(entity);
        }
Example #6
0
        private void PublishAppAttemptFinishedEvent(AppAttemptFinishedEvent @event)
        {
            TimelineEntity entity = CreateAppAttemptEntity(@event.GetApplicationAttemptId());
            TimelineEvent  tEvent = new TimelineEvent();

            tEvent.SetEventType(AppAttemptMetricsConstants.FinishedEventType);
            tEvent.SetTimestamp(@event.GetTimestamp());
            IDictionary <string, object> eventInfo = new Dictionary <string, object>();

            eventInfo[AppAttemptMetricsConstants.TrackingUrlEventInfo] = @event.GetTrackingUrl
                                                                             ();
            eventInfo[AppAttemptMetricsConstants.OriginalTrackingUrlEventInfo] = @event.GetOriginalTrackingURL
                                                                                     ();
            eventInfo[AppAttemptMetricsConstants.DiagnosticsInfoEventInfo] = @event.GetDiagnosticsInfo
                                                                                 ();
            eventInfo[AppAttemptMetricsConstants.FinalStatusEventInfo] = @event.GetFinalApplicationStatus
                                                                             ().ToString();
            eventInfo[AppAttemptMetricsConstants.StateEventInfo] = @event.GetYarnApplicationAttemptState
                                                                       ().ToString();
            tEvent.SetEventInfo(eventInfo);
            entity.AddEvent(tEvent);
            PutEntity(entity);
        }
Example #7
0
        private static TimelineEntity CreateContainerEntity(ContainerId containerId)
        {
            TimelineEntity entity = new TimelineEntity();

            entity.SetEntityType(ContainerMetricsConstants.EntityType);
            entity.SetEntityId(containerId.ToString());
            entity.SetDomainId(TimelineDataManager.DefaultDomainId);
            entity.AddPrimaryFilter(ContainerMetricsConstants.ParentPrimariyFilter, containerId
                                    .GetApplicationAttemptId().ToString());
            entity.AddPrimaryFilter(TimelineStore.SystemFilter.EntityOwner.ToString(), "yarn"
                                    );
            IDictionary <string, object> entityInfo = new Dictionary <string, object>();

            entityInfo[ContainerMetricsConstants.AllocatedMemoryEntityInfo]   = -1;
            entityInfo[ContainerMetricsConstants.AllocatedVcoreEntityInfo]    = -1;
            entityInfo[ContainerMetricsConstants.AllocatedHostEntityInfo]     = "test host";
            entityInfo[ContainerMetricsConstants.AllocatedPortEntityInfo]     = 100;
            entityInfo[ContainerMetricsConstants.AllocatedPriorityEntityInfo] = -1;
            entity.SetOtherInfo(entityInfo);
            TimelineEvent tEvent = new TimelineEvent();

            tEvent.SetEventType(ContainerMetricsConstants.CreatedEventType);
            tEvent.SetTimestamp(int.MaxValue + 1L);
            entity.AddEvent(tEvent);
            tEvent = new TimelineEvent();
            tEvent.SetEventType(ContainerMetricsConstants.FinishedEventType);
            tEvent.SetTimestamp(int.MaxValue + 2L);
            IDictionary <string, object> eventInfo = new Dictionary <string, object>();

            eventInfo[ContainerMetricsConstants.DiagnosticsInfoEventInfo] = "test diagnostics info";
            eventInfo[ContainerMetricsConstants.ExitStatusEventInfo]      = -1;
            eventInfo[ContainerMetricsConstants.StateEventInfo]           = ContainerState.Complete.ToString
                                                                                ();
            tEvent.SetEventInfo(eventInfo);
            entity.AddEvent(tEvent);
            return(entity);
        }