Example #1
0
        private async Task <StreamWithCleanupResult> StartTrace(int?pid, MonitoringSourceConfiguration configuration, TimeSpan duration)
        {
            int pidValue = _diagnosticServices.ResolveProcess(pid);
            IStreamWithCleanup result = await _diagnosticServices.StartTrace(pidValue, configuration, duration, this.HttpContext.RequestAborted);

            return(new StreamWithCleanupResult(result, "application/octet-stream", FormattableString.Invariant($"{Guid.NewGuid()}.nettrace")));
        }
Example #2
0
        public Task <ActionResult> Trace(int?pid, [FromQuery][Range(-1, int.MaxValue)] int durationSeconds = 30)
        {
            TimeSpan duration = ConvertSecondsToTimeSpan(durationSeconds);

            return(InvokeService(async() =>
            {
                int pidValue = _diagnosticServices.ResolveProcess(pid);
                IStreamWithCleanup result = await _diagnosticServices.StartTrace(pidValue, duration, this.HttpContext.RequestAborted);
                return new StreamWithCleanupResult(result, "application/octet-stream", Invariant($"{Guid.NewGuid()}.nettrace"));
            }));
        }
Example #3
0
        private async Task <StreamWithCleanupResult> StartTrace(
            ProcessFilter?processFilter,
            MonitoringSourceConfiguration configuration,
            TimeSpan duration)
        {
            IProcessInfo processInfo = await _diagnosticServices.GetProcessAsync(processFilter, HttpContext.RequestAborted);

            IStreamWithCleanup result = await _diagnosticServices.StartTrace(processInfo, configuration, duration, this.HttpContext.RequestAborted);

            return(new StreamWithCleanupResult(result, "application/octet-stream", FormattableString.Invariant($"{GetFileNameTimeStampUtcNow()}_{processInfo.ProcessId}.nettrace")));
        }