Example #1
0
        public Task Performance()
        {
            var stats = GetProcessesToReportOn().Select(x => new EtlTaskPerformanceStats
            {
                TaskName = x.Key,
                TaskId   = x.Value.First().TaskId, // since we grouped by task name it implies each task id inside group is the same
                EtlType  = x.Value.First().EtlType,
                Stats    = x.Value.Select(y => new EtlProcessPerformanceStats
                {
                    TransformationName = y.TransformationName,
                    Performance        = y.GetPerformanceStats()
                }).ToArray()
            }).ToArray();

            using (Database.DocumentsStorage.ContextPool.AllocateOperationContext(out JsonOperationContext context))
                using (var writer = new BlittableJsonTextWriter(context, ResponseBodyStream()))
                {
                    writer.WriteEtlTaskPerformanceStats(context, stats);
                }

            return(Task.CompletedTask);
        }