コード例 #1
0
        public async Task <IEnumerable <AggregatedDataRange> > GetAggregatedData(Guid entity, Guid attribute, int aggregationSeconds, TimeRange timeRange)
        {
            var series = await _model.ResolveSeries(entity, attribute, aggregationSeconds);

            var query           = $"SELECT Time, Value FROM deepflowdata WHERE Guid = {series} AND Time >= {timeRange.Min} AND Time < {timeRange.Max};";
            var aggregationTask = _model.ResolveAggregationForSeries(series);
            var timeRangesTask  = GetAllTimeRanges(entity, attribute);
            var rowSet          = await _session.ExecuteAsync(new SimpleStatement(query)).ConfigureAwait(false);

            var alTimeRanges = await timeRangesTask.ConfigureAwait(false);

            var timeRanges  = _filterer.FilterRanges(alTimeRanges, timeRange);
            var aggregation = await aggregationTask.ConfigureAwait(false);

            return(ToDataRanges(timeRanges, rowSet.Reverse().ToList(), timeRange, aggregation));
        }