예제 #1
0
        private static bool CheckMonitoringEnabled()
        {
            MonitoringSessionController sessionController = new MonitoringSessionController();
            var session = sessionController.GetActiveSession();

            if (session == null)
            {
                return(false);
            }
            else
            {
                if (m_MonitoringSession == null)
                {
                    m_MonitoringSession = session;
                }
                else
                {
                    // Check if it is the same session or not
                    if (m_MonitoringSession.SessionId != session.SessionId)
                    {
                        Logger.LogCpuMonitoringVerboseEvent($"Reloading monitoring session as session has changed, old={m_MonitoringSession.SessionId}, new={session.SessionId}", m_MonitoringSession.SessionId);
                        m_MonitoringSession = session;
                        m_CpuMonitoring.InitializeMonitoring(m_MonitoringSession);
                    }
                }

                return(true);
            }
        }
예제 #2
0
        public HttpResponseMessage GetActiveSession()
        {
            var monitoringController = new MonitoringSessionController();

            try
            {
                var session = monitoringController.GetActiveSession();
                return(Request.CreateResponse(HttpStatusCode.OK, session));
            }
            catch (Exception ex)
            {
                Logger.LogCpuMonitoringErrorEvent("Controller API Failure - GetActiveSession", ex, string.Empty);
                return(Request.CreateErrorResponse(HttpStatusCode.NotFound, ex.Message));
            }
        }
예제 #3
0
        public HttpResponseMessage GetActiveSessionDetails()
        {
            ActiveMonitoringSession activeSession = new ActiveMonitoringSession();
            var monitoringController = new MonitoringSessionController();

            try
            {
                activeSession.Session = monitoringController.GetActiveSession();
                if (activeSession.Session != null)
                {
                    var sessionLogs = monitoringController.GetActiveSessionMonitoringLogs();
                    activeSession.MonitoringLogs         = sessionLogs.ToList();
                    activeSession.Session.FilesCollected = monitoringController.GetCollectedLogsForSession(activeSession.Session.SessionId, activeSession.Session.BlobSasUri);
                }

                return(Request.CreateResponse(HttpStatusCode.OK, activeSession));
            }
            catch (Exception ex)
            {
                Logger.LogCpuMonitoringErrorEvent("Controller API Failure - GetActiveSessionDetails", ex, string.Empty);
                return(Request.CreateErrorResponse(HttpStatusCode.NotFound, ex.Message));
            }
        }