Search in sources :

Example 1 with PinotThirdEyeResponse

use of com.linkedin.thirdeye.client.pinot.PinotThirdEyeResponse in project pinot by linkedin.

the class AnomalyApplicationEndToEndTest method getMockResponse.

private ThirdEyeResponse getMockResponse(ThirdEyeRequest request) {
    ThirdEyeResponse response = null;
    Random rand = new Random();
    DatasetConfigDTO datasetConfig = datasetConfigDAO.findByDataset(collection);
    TimeSpec dataTimeSpec = ThirdEyeUtils.getTimeSpecFromDatasetConfig(datasetConfig);
    List<String[]> rows = new ArrayList<>();
    DateTime start = request.getStartTimeInclusive();
    DateTime end = request.getEndTimeExclusive();
    List<String> metrics = request.getMetricNames();
    int bucket = 0;
    while (start.isBefore(end)) {
        String[] row = new String[metrics.size() + 1];
        row[0] = String.valueOf(bucket);
        bucket++;
        for (int i = 0; i < metrics.size(); i++) {
            row[i + 1] = String.valueOf(rand.nextInt(1000));
        }
        rows.add(row);
        start = start.plusHours(1);
    }
    response = new PinotThirdEyeResponse(request, rows, dataTimeSpec);
    return response;
}
Also used : DatasetConfigDTO(com.linkedin.thirdeye.datalayer.dto.DatasetConfigDTO) Random(java.util.Random) ArrayList(java.util.ArrayList) ThirdEyeResponse(com.linkedin.thirdeye.client.ThirdEyeResponse) PinotThirdEyeResponse(com.linkedin.thirdeye.client.pinot.PinotThirdEyeResponse) PinotThirdEyeResponse(com.linkedin.thirdeye.client.pinot.PinotThirdEyeResponse) DateTime(org.joda.time.DateTime) TimeSpec(com.linkedin.thirdeye.api.TimeSpec)

Aggregations

TimeSpec (com.linkedin.thirdeye.api.TimeSpec)1 ThirdEyeResponse (com.linkedin.thirdeye.client.ThirdEyeResponse)1 PinotThirdEyeResponse (com.linkedin.thirdeye.client.pinot.PinotThirdEyeResponse)1 DatasetConfigDTO (com.linkedin.thirdeye.datalayer.dto.DatasetConfigDTO)1 ArrayList (java.util.ArrayList)1 Random (java.util.Random)1 DateTime (org.joda.time.DateTime)1