Exemple #1
0
        internal static async Task<List<LineChartSeries>> BuildChartData(IDiagnosticsModuleStore context, DateTime from, DateTime to, Func<DiagnosticsEntry, string> propertyFilter,
                Func<DiagnosticsEntry, string> nameFunction)
        {
            var results = new List<LineChartSeries>();

            var data = await context.FilterAsync(from, to, null, null, null, null, null, null, null, null, null, null, null, null);

            var groupedSeries = data.GroupBy(propertyFilter).ToList();

            foreach (var seriesData in groupedSeries)
            {
                var series = new LineChartSeries(nameFunction(seriesData.First()));

                foreach (var date in ChartingUtilities.BuildLineChartAxis(from, to))
                {
                    series.Data.Add(date);
                }

                var groupedData = seriesData.GroupBy(x => x.Timestamp.Date).ToList();

                foreach (var itemData in groupedData)
                {
                    var date = itemData.Key;
                    var errors = itemData.Count();

                    var point = series.Data.First(x => x.Date == date);

                    point.Value = errors;
                }

                results.Add(series);
            }

            return results;
        }
            protected override async Task <object> ExecuteAsync(Command request)
            {
                var data = await _context.FilterAsync(request.DateFrom, request.DateTo, null, null, null, null, null, null, null, null, null, null, null, null);

                var groupedData = data.GroupBy(x => x.Timestamp.Date).ToList();

                var chartData = ChartingUtilities.BuildLineChartAxis(request.DateFrom, request.DateTo);

                foreach (var itemData in groupedData)
                {
                    var date   = itemData.Key;
                    var errors = itemData.Count();

                    var point = chartData.First(x => x.Date == date);

                    point.Value = errors;
                }

                return(chartData);
            }
Exemple #3
0
            protected override async Task <object> ExecuteAsync(Command request)
            {
                var data = await _context.FilterAsync(request.DateFrom, request.DateTo, null, null, null, null, null,
                                                      null, null, null, 0, null);

                var groupedData = data.GroupBy(x => x.Timestamp.Date).ToList();

                var chartData = ChartingUtilities.BuildLineChartAxis(request.DateFrom, request.DateTo);

                foreach (var itemData in groupedData)
                {
                    var date      = itemData.Key;
                    var totalSize = itemData.Sum(x => x.RequestSize);

                    var point = chartData.First(x => x.Date == date);

                    // TODO: passar a unidade como configuração da lib
                    point.Value = totalSize / 1024;
                }

                return(chartData);
            }