Пример #1
0
        /// <summary>
        /// Handle request to start a profiling session
        /// </summary>
        internal async Task HandleStartProfilingRequest(StartProfilingParams parameters, RequestContext <StartProfilingResult> requestContext)
        {
            await Task.Run(async() =>
            {
                try
                {
                    ConnectionInfo connInfo;
                    ConnectionServiceInstance.TryFindConnection(
                        parameters.OwnerUri,
                        out connInfo);
                    if (connInfo != null)
                    {
                        // create a new XEvent session and Profiler session
                        var xeSession = this.XEventSessionFactory.GetXEventSession(parameters.SessionName, connInfo);
                        // start monitoring the profiler session
                        monitor.StartMonitoringSession(parameters.OwnerUri, xeSession);

                        var result = new StartProfilingResult();
                        await requestContext.SendResult(result);
                    }
                    else
                    {
                        throw new Exception(SR.ProfilerConnectionNotFound);
                    }
                }
                catch (Exception e)
                {
                    await requestContext.SendError(new Exception(SR.StartSessionFailed(e.Message)));
                }
            });
        }
Пример #2
0
        /// <summary>
        /// Handle request to start a profiling session
        /// </summary>
        internal async Task HandleStartProfilingRequest(StartProfilingParams parameters, RequestContext <StartProfilingResult> requestContext)
        {
            try
            {
                var            result = new StartProfilingResult();
                ConnectionInfo connInfo;
                ConnectionServiceInstance.TryFindConnection(
                    parameters.OwnerUri,
                    out connInfo);

                if (connInfo != null)
                {
                    ProfilerSession session = StartSession(parameters.OwnerUri, connInfo);
                    result.SessionId = session.SessionId;
                    result.Succeeded = true;
                }
                else
                {
                    result.Succeeded    = false;
                    result.ErrorMessage = SR.ProfilerConnectionNotFound;
                }

                await requestContext.SendResult(result);
            }
            catch (Exception e)
            {
                await requestContext.SendError(e);
            }
        }
        /// <summary>
        /// Handle request to start a profiling session
        /// </summary>
        internal async Task HandleStartProfilingRequest(StartProfilingParams parameters, RequestContext <StartProfilingResult> requestContext)
        {
            try
            {
                var            result = new StartProfilingResult();
                ConnectionInfo connInfo;
                ConnectionServiceInstance.TryFindConnection(
                    parameters.OwnerUri,
                    out connInfo);

                if (connInfo != null)
                {
                    int xEventSessionId = StartSession(parameters.OwnerUri, parameters.TemplateName, connInfo);
                    result.SessionId = xEventSessionId.ToString();
                    result.Succeeded = true;
                }
                else
                {
                    result.Succeeded    = false;
                    result.ErrorMessage = SR.ProfilerConnectionNotFound;
                }

                await requestContext.SendResult(result);
            }
            catch (Exception e)
            {
                await requestContext.SendError(new Exception(SR.StartSessionFailed(e.Message)));
            }
        }