use of com.linkedin.thirdeye.client.ThirdEyeRequest.ThirdEyeRequestBuilder in project pinot by linkedin.
the class PinotThirdEyeSummaryClient method constructTimeOnTimeBulkRequests.
/**
* Returns the baseline and current requests for the given GroupBy dimensions.
*
* @param groupBy the dimensions to do GroupBy queries
* @return Baseline and Current requests.
*/
private List<ThirdEyeRequest> constructTimeOnTimeBulkRequests(List<String> groupBy) {
List<ThirdEyeRequest> requests = new ArrayList<>();
;
// baseline requests
ThirdEyeRequestBuilder builder = ThirdEyeRequest.newBuilder();
builder.setCollection(collection);
builder.setMetricFunctions(metricFunctions);
builder.setGroupBy(groupBy);
builder.setStartTimeInclusive(baselineStartInclusive);
builder.setEndTimeExclusive(baselineEndExclusive);
ThirdEyeRequest baselineRequest = builder.build("baseline");
requests.add(baselineRequest);
// current requests
builder = ThirdEyeRequest.newBuilder();
builder.setCollection(collection);
builder.setMetricFunctions(metricFunctions);
builder.setGroupBy(groupBy);
builder.setStartTimeInclusive(currentStartInclusive);
builder.setEndTimeExclusive(currentEndExclusive);
ThirdEyeRequest currentRequest = builder.build("current");
requests.add(currentRequest);
return requests;
}
use of com.linkedin.thirdeye.client.ThirdEyeRequest.ThirdEyeRequestBuilder in project pinot by linkedin.
the class ThirdEyeRequestGenerator method generateRequest.
public static ThirdEyeRequest generateRequest(String name, TimeOnTimeComparisonRequest comparisonRequest, DateTime start, DateTime end, String groupByDimension, TimeGranularity aggTimeGranularity) {
ThirdEyeRequestBuilder requestBuilder = new ThirdEyeRequestBuilder();
// COMMON to ALL REQUESTS
requestBuilder.setCollection(comparisonRequest.getCollectionName());
requestBuilder.setFilterSet(comparisonRequest.getFilterSet());
requestBuilder.setFilterClause(comparisonRequest.getFilterClause());
List<MetricFunction> metricFunctionsFromExpressions = Utils.computeMetricFunctionsFromExpressions(comparisonRequest.getMetricExpressions());
requestBuilder.setMetricFunctions(metricFunctionsFromExpressions);
// REQUEST to get total value with out break down.
requestBuilder.setStartTimeInclusive(start);
requestBuilder.setEndTimeExclusive(end);
if (groupByDimension != null) {
requestBuilder.setGroupBy(groupByDimension);
}
if (aggTimeGranularity != null) {
requestBuilder.setGroupByTimeGranularity(aggTimeGranularity);
}
ThirdEyeRequest request = requestBuilder.build(name);
return request;
}
use of com.linkedin.thirdeye.client.ThirdEyeRequest.ThirdEyeRequestBuilder in project pinot by linkedin.
the class TimeOnTimeComparisonHandler method createThirdEyeRequest.
private static ThirdEyeRequest createThirdEyeRequest(String requestReference, TimeOnTimeComparisonRequest comparisonRequest, DateTime start, DateTime end) {
ThirdEyeRequestBuilder requestBuilder = ThirdEyeRequest.newBuilder();
requestBuilder.setCollection(comparisonRequest.getCollectionName());
requestBuilder.setStartTimeInclusive(start);
requestBuilder.setEndTimeExclusive(end);
requestBuilder.setFilterSet(comparisonRequest.getFilterSet());
requestBuilder.addGroupBy(comparisonRequest.getGroupByDimensions());
requestBuilder.setGroupByTimeGranularity(comparisonRequest.getAggregationTimeGranularity());
List<MetricExpression> metricExpressions = comparisonRequest.getMetricExpressions();
List<MetricFunction> metricFunctionsFromExpressions = Utils.computeMetricFunctionsFromExpressions(metricExpressions);
requestBuilder.setMetricFunctions(metricFunctionsFromExpressions);
return requestBuilder.build(requestReference);
}
use of com.linkedin.thirdeye.client.ThirdEyeRequest.ThirdEyeRequestBuilder in project pinot by linkedin.
the class TimeSeriesHandler method createThirdEyeRequest.
private static ThirdEyeRequest createThirdEyeRequest(String requestReference, TimeSeriesRequest timeSeriesRequest, DateTime start, DateTime end) {
ThirdEyeRequestBuilder requestBuilder = ThirdEyeRequest.newBuilder();
requestBuilder.setCollection(timeSeriesRequest.getCollectionName());
requestBuilder.setStartTimeInclusive(start);
requestBuilder.setEndTimeExclusive(end);
requestBuilder.setFilterSet(timeSeriesRequest.getFilterSet());
requestBuilder.addGroupBy(timeSeriesRequest.getGroupByDimensions());
requestBuilder.setGroupByTimeGranularity(timeSeriesRequest.getAggregationTimeGranularity());
List<MetricExpression> metricExpressions = timeSeriesRequest.getMetricExpressions();
List<MetricFunction> metricFunctionsFromExpressions = Utils.computeMetricFunctionsFromExpressions(metricExpressions);
requestBuilder.setMetricFunctions(metricFunctionsFromExpressions);
return requestBuilder.build(requestReference);
}
Aggregations