private static void StopMonitoringSession() { SessionMode sessionMode = SessionMode.Collect; string sessionId = ""; if (m_MonitoringSession != null) { sessionMode = m_MonitoringSession.Mode; sessionId = m_MonitoringSession.SessionId; } Logger.LogCpuMonitoringVerboseEvent($"Stopping a monitoring session", sessionId); MonitoringSessionController sessionController = new MonitoringSessionController(); var sessionStopped = sessionController.StopMonitoringSession(); if (!sessionStopped) { Logger.LogCpuMonitoringVerboseEvent($"Failed while stopping the session", sessionId); m_FailedStoppingSession = true; } else { var blobSasUri = m_MonitoringSession.BlobSasUri; m_MonitoringEnabled = false; m_MonitoringSession = null; m_FailedStoppingSession = false; if (sessionMode == SessionMode.CollectKillAndAnalyze && !string.IsNullOrWhiteSpace(sessionId)) { MonitoringSessionController controller = new MonitoringSessionController(); controller.AnalyzeSession(sessionId, blobSasUri); } } }
public HttpResponseMessage Analyze(string sessionId) { var monitoringController = new MonitoringSessionController(); var session = monitoringController.GetSession(sessionId); try { var result = monitoringController.AnalyzeSession(sessionId, session.BlobSasUri); return(Request.CreateResponse(HttpStatusCode.OK, result)); } catch (Exception ex) { Logger.LogCpuMonitoringErrorEvent("Controller API Failure - Analyze", ex, string.Empty); return(Request.CreateErrorResponse(HttpStatusCode.NotFound, ex.Message)); } }