public void accumulate(TaggedLogAPIEntity entity) throws Exception{ List<String> groupbyFieldValues = createGroup(entity); List<Double> preAggregatedValues = createPreAggregatedValues(entity); bucket.addDatapoint(groupbyFieldValues, preAggregatedValues); }
protected List<String> createGroup(TaggedLogAPIEntity entity){ List<String> groupbyFieldValues = new ArrayList<String>(); int i = 0; for(String groupbyField : groupbyFields){ String groupbyFieldValue = determineGroupbyFieldValue(entity, groupbyField, i++); groupbyFieldValues.add(groupbyFieldValue); } return groupbyFieldValues; } }
FlatAggregator agg = new FlatAggregator(groupbyFields, aggregateCondition.getAggregateFunctionTypes(), aggregateCondition.getAggregateFields()); StreamReader reader = null; if (this.entityDef.getMetricDefinition() == null) { reader.readAsStream(); ArrayList<Map.Entry<List<String>, List<Double>>> obj = new ArrayList<>(); obj.addAll(agg.result().entrySet()); this.firstTimestamp = reader.getFirstTimestamp(); this.lastTimestamp = reader.getLastTimestamp(); return (List<T>) obj; } else { // has sort options return (List<T>) PostFlatAggregateSort.sort(agg.result(), this.sortOptions, top); sortAgg = new FlatAggregator(groupbyFields, sortFuncs, sortFields); reader.register(sortAgg); return (List<T>) obj; } else { // has sort options return (List<T>) TimeSeriesPostFlatAggregateSort.sort(sortAgg.result(), tsAgg.getMetric(), this.sortOptions, top);
FlatAggregator agg = new FlatAggregator(groupbyFields, comp.aggregateFunctionTypes(), comp.aggregateFields()); StreamReader reader = null; if(ed.getMetricDefinition() == null){ reader.readAsStream(); ArrayList<Map.Entry<List<String>, List<Double>>> obj = new ArrayList<Map.Entry<List<String>, List<Double>>>(); obj.addAll(agg.result().entrySet()); if(comp.sortOptions() == null){ result.setObj(obj); }else{ // has sort options result.setObj(PostFlatAggregateSort.sort(agg.result(), comp.sortOptions(), top)); FlatAggregator agg = new FlatAggregator(groupbyFields, comp.aggregateFunctionTypes(), comp.aggregateFields()); EntityCreationListener listener = EntityCreationListenerFactory.synchronizedEntityCreationListener(agg); StreamReader reader = new GenericEntityStreamReaderMT(serviceName, condition, parallel); reader.readAsStream(); ArrayList<Map.Entry<List<String>, List<Double>>> obj = new ArrayList<Map.Entry<List<String>, List<Double>>>(); obj.addAll(agg.result().entrySet()); if(comp.sortOptions() == null){ result.setObj(obj); }else{ // has sort options result.setObj(PostFlatAggregateSort.sort(agg.result(), comp.sortOptions(), top)); sortAgg = new FlatAggregator(groupbyFields, comp.sortFunctions(), comp.sortFields()); if(parallel <= 0){ reader.register(sortAgg); result.setObj(obj);
FlatAggregator agg = new FlatAggregator(groupbyFields, comp.aggregateFunctionTypes(), comp.aggregateFields()); StreamReader reader = null; if(ed.getMetricDefinition() == null){ reader.readAsStream(); ArrayList<Map.Entry<List<String>, List<Double>>> obj = new ArrayList<Map.Entry<List<String>, List<Double>>>(); obj.addAll(agg.result().entrySet()); if(comp.sortOptions() == null){ result.setObj(obj); }else{ // has sort options result.setObj(PostFlatAggregateSort.sort(agg.result(), comp.sortOptions(), top)); FlatAggregator agg = new FlatAggregator(groupbyFields, comp.aggregateFunctionTypes(), comp.aggregateFields()); EntityCreationListener listener = EntityCreationListenerFactory.synchronizedEntityCreationListener(agg); StreamReader reader = new GenericEntityStreamReaderMT(serviceName, condition, parallel); reader.readAsStream(); ArrayList<Map.Entry<List<String>, List<Double>>> obj = new ArrayList<Map.Entry<List<String>, List<Double>>>(); obj.addAll(agg.result().entrySet()); if(comp.sortOptions() == null){ result.setObj(obj); }else{ // has sort options result.setObj(PostFlatAggregateSort.sort(agg.result(), comp.sortOptions(), top)); sortAgg = new FlatAggregator(groupbyFields, comp.sortFunctions(), comp.sortFields()); if(parallel <= 0){ reader.register(sortAgg); result.setObj(obj);