Search in sources :

Example 6 with TabularViewRequest

use of com.linkedin.thirdeye.dashboard.views.tabular.TabularViewRequest in project pinot by linkedin.

the class TabularTest method main.

public static void main(String[] args) throws Exception {
    TabularViewRequest request = new TabularViewRequest();
    String collection = "thirdeyeAbook";
    DateTime baselineStart = new DateTime(2016, 3, 23, 00, 00);
    List<MetricExpression> metricExpressions = new ArrayList<>();
    metricExpressions.add(new MetricExpression("__COUNT", "__COUNT"));
    request.setCollection(collection);
    request.setBaselineStart(baselineStart);
    request.setBaselineEnd(baselineStart.plusDays(1));
    request.setCurrentStart(baselineStart.plusDays(7));
    request.setCurrentEnd(baselineStart.plusDays(8));
    request.setTimeGranularity(new TimeGranularity(1, TimeUnit.HOURS));
    request.setMetricExpressions(metricExpressions);
    // TODO
    PinotThirdEyeClient pinotThirdEyeClient = PinotThirdEyeClient.getDefaultTestClient();
    // make
    // this
    // configurable;
    QueryCache queryCache = new QueryCache(pinotThirdEyeClient, Executors.newFixedThreadPool(10));
    TabularViewHandler handler = new TabularViewHandler(queryCache);
    TabularViewResponse response = handler.process(request);
    ObjectMapper mapper = new ObjectMapper();
    String jsonResponse = mapper.writeValueAsString(response);
    System.out.println(jsonResponse);
}
Also used : PinotThirdEyeClient(com.linkedin.thirdeye.client.pinot.PinotThirdEyeClient) QueryCache(com.linkedin.thirdeye.client.cache.QueryCache) TabularViewHandler(com.linkedin.thirdeye.dashboard.views.tabular.TabularViewHandler) ArrayList(java.util.ArrayList) TimeGranularity(com.linkedin.thirdeye.api.TimeGranularity) TabularViewResponse(com.linkedin.thirdeye.dashboard.views.tabular.TabularViewResponse) MetricExpression(com.linkedin.thirdeye.client.MetricExpression) DateTime(org.joda.time.DateTime) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) TabularViewRequest(com.linkedin.thirdeye.dashboard.views.tabular.TabularViewRequest)

Aggregations

MetricExpression (com.linkedin.thirdeye.client.MetricExpression)6 TabularViewHandler (com.linkedin.thirdeye.dashboard.views.tabular.TabularViewHandler)6 TabularViewRequest (com.linkedin.thirdeye.dashboard.views.tabular.TabularViewRequest)6 TabularViewResponse (com.linkedin.thirdeye.dashboard.views.tabular.TabularViewResponse)6 DateTime (org.joda.time.DateTime)6 DateTimeZone (org.joda.time.DateTimeZone)5 MetricConfigDTO (com.linkedin.thirdeye.datalayer.dto.MetricConfigDTO)4 ArrayList (java.util.ArrayList)4 GET (javax.ws.rs.GET)4 Path (javax.ws.rs.Path)4 TimeGranularity (com.linkedin.thirdeye.api.TimeGranularity)3 WebApplicationException (javax.ws.rs.WebApplicationException)3 MetricDataset (com.linkedin.thirdeye.client.cache.MetricDataset)2 MetricSummary (com.linkedin.thirdeye.dashboard.resources.v2.pojo.MetricSummary)2 GenericResponse (com.linkedin.thirdeye.dashboard.views.GenericResponse)2 IOException (java.io.IOException)2 HashMap (java.util.HashMap)2 LinkedHashMap (java.util.LinkedHashMap)2 ExecutionException (java.util.concurrent.ExecutionException)2 Produces (javax.ws.rs.Produces)2