示例#1
0
        private Task WriteBatchAsync(string[] logEventInfos)
        {
            return(_context.PerformOperationAsync(Tracer, async() =>
            {
                // TODO: retry policy for writing to file?
                var blobName = GenerateBlobName();
                var stagingLogFilePath = _configuration.StagingFolderPath / blobName;
                var logFile = (await WriteLogsToFileAsync(_context, stagingLogFilePath, logEventInfos).ThrowIfFailure()).Value;

                var uploadLogFilePath = _configuration.UploadFolderPath / blobName;
                _fileSystem.MoveFile(stagingLogFilePath, uploadLogFilePath, replaceExisting: true);
                logFile.Path = uploadLogFilePath;
                _uploadQueue.Enqueue(logFile);

                return BoolResult.Success;
            },
                                                  counter: Counters[AzureBlobStorageLogCounters.ProcessBatchCalls]));
        }
示例#2
0
        /// <summary>
        ///     Calculates the hash for the given file (if not given) and queues it up
        ///     to be batch-processed later (<see cref="ProcessAddFilesAsync"/>).
        /// </summary>
        public async Task <AddFileResult> AddFileAsync(IDropItem dropItem)
        {
            Contract.Requires(dropItem != null);

            m_logger.Verbose("Queued file '{0}'", dropItem);

            Interlocked.Increment(ref Stats.NumAddFileRequests);

            var addFileItem = new AddFileItem(dropItem);

            m_nagleQueue.Enqueue(addFileItem);

            var manifestResult = await addFileItem.BuildManifestTaskSource.Task;
            var dropResult     = await addFileItem.DropResultTaskSource.Task;

            return(manifestResult == RegisterFileForBuildManifestResult.Failed
                ? AddFileResult.RegisterFileForBuildManifestFailure
                : dropResult);
        }
示例#3
0
        /// <inheritdoc />
        public async Task <AddDebugEntryResult> AddFileAsync(SymbolFile symbolFile)
        {
            Contract.Requires(symbolFile.IsIndexed, "File has not been indexed.");

            m_counters.IncrementCounter(SymbolClientCounter.NumAddFileRequests);
            if (symbolFile.DebugEntries.Count == 0)
            {
                // If there are no debug entries, ask bxl to log a message and return early.
                Analysis.IgnoreResult(await m_apiClient.LogMessage(I($"File '{symbolFile.FullFilePath}' does not contain symbols and will not be added to '{RequestName}'."), isWarning: false));
                m_counters.IncrementCounter(SymbolClientCounter.NumFilesWithoutDebugEntries);

                return(AddDebugEntryResult.NoSymbolData);
            }

            m_logger.Verbose($"Queued file '{symbolFile}'");
            var batchedFile = new BatchedSymbolFile(symbolFile);

            m_nagleQueue.Enqueue(batchedFile);
            return(await batchedFile.ResultTaskSource.Task);
        }
示例#4
0
 public void Write(string log)
 {
     _writeQueue.Enqueue(log);
 }
示例#5
0
 public void Emit(T row)
 {
     _queue.Enqueue(row);
 }