コード例 #1
0
        public Task <ActionResult> CaptureGcDump(
            [FromQuery]
            int?pid = null,
            [FromQuery]
            Guid?uid = null,
            [FromQuery]
            string name = null,
            [FromQuery]
            string egressProvider = null)
        {
            ProcessKey?processKey = GetProcessKey(pid, uid, name);

            return(InvokeForProcess(processInfo =>
            {
                string fileName = FormattableString.Invariant($"{Utilities.GetFileNameTimeStampUtcNow()}_{processInfo.EndpointInfo.ProcessId}.gcdump");

                return Result(
                    Utilities.ArtifactType_GCDump,
                    egressProvider,
                    (stream, token) => GCDumpUtilities.CaptureGCDumpAsync(processInfo.EndpointInfo, stream, token),
                    fileName,
                    ContentTypes.ApplicationOctetStream,
                    processInfo.EndpointInfo);
            }, processKey, Utilities.ArtifactType_GCDump));
        }
コード例 #2
0
            protected override async Task <CollectionRuleActionResult> ExecuteCoreAsync(
                TaskCompletionSource <object> startCompleteSource,
                CancellationToken token)
            {
                string egress = Options.Egress;

                string gcdumpFileName = GCDumpUtilities.GenerateGCDumpFileName(EndpointInfo);

                KeyValueLogScope scope = Utils.CreateArtifactScope(Utils.ArtifactType_GCDump, EndpointInfo);

                EgressOperation egressOperation = new EgressOperation(
                    (stream, token) =>
                {
                    startCompleteSource.TrySetResult(null);
                    return(GCDumpUtilities.CaptureGCDumpAsync(EndpointInfo, stream, token));
                },
                    egress,
                    gcdumpFileName,
                    EndpointInfo,
                    ContentTypes.ApplicationOctetStream,
                    scope);

                ExecutionResult <EgressResult> result = await egressOperation.ExecuteAsync(_serviceProvider, token);

                string gcdumpFilePath = result.Result.Value;

                return(new CollectionRuleActionResult()
                {
                    OutputValues = new Dictionary <string, string>(StringComparer.Ordinal)
                    {
                        { CollectionRuleActionConstants.EgressPathOutputValueName, gcdumpFilePath }
                    }
                });
            }