Search in sources :

Example 1 with PinotThirdEyeClient

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

the class TimeSeriesTest method main.

public static void main(String[] args) throws Exception {
    // = System.class.get.getResource("log4j.properties");
    URL resource = null;
    if (resource == null) {
        resource = TimeSeriesHandler.class.getClassLoader().getResource("logback.x");
    }
    // TODO
    PinotThirdEyeClient pinotThirdEyeClient = PinotThirdEyeClient.getDefaultTestClient();
    // make
    // this
    // configurable
    QueryCache queryCache = new QueryCache(pinotThirdEyeClient, Executors.newFixedThreadPool(10));
    TimeSeriesRequest[] requests = new TimeSeriesRequest[] { generateGroupByTimeRequest() };
    for (TimeSeriesRequest timeSeriesRequest : requests) {
        try {
            TimeSeriesHandler handler = new TimeSeriesHandler(queryCache);
            long start = System.currentTimeMillis();
            TimeSeriesResponse response = handler.handle(timeSeriesRequest);
            long end = System.currentTimeMillis();
            System.out.println("Time taken:" + (end - start));
            for (TimeSeriesMetric metric : response.getRow(0).getMetrics()) {
                System.out.print(metric.getMetricName() + "\t\t");
            }
            System.out.println();
            for (int i = 0; i < response.getNumRows(); i++) {
                System.out.println(response.getRow(i));
            }
        } catch (Exception e) {
            System.out.println("Request failed: " + timeSeriesRequest);
            e.printStackTrace();
            System.exit(-1);
        }
    }
    System.out.println("No exceptions encountered during testing... but you still need to check for data quality!");
    System.exit(0);
}
Also used : PinotThirdEyeClient(com.linkedin.thirdeye.client.pinot.PinotThirdEyeClient) QueryCache(com.linkedin.thirdeye.client.cache.QueryCache) TimeSeriesMetric(com.linkedin.thirdeye.client.timeseries.TimeSeriesRow.TimeSeriesMetric) URL(java.net.URL)

Example 2 with PinotThirdEyeClient

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

the class ContributorTest method main.

public static void main(String[] args) throws Exception {
    ContributorViewRequest request = new ContributorViewRequest();
    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));
    ContributorViewHandler handler = new ContributorViewHandler(queryCache);
    ContributorViewResponse 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) ContributorViewResponse(com.linkedin.thirdeye.dashboard.views.contributor.ContributorViewResponse) QueryCache(com.linkedin.thirdeye.client.cache.QueryCache) ContributorViewHandler(com.linkedin.thirdeye.dashboard.views.contributor.ContributorViewHandler) ArrayList(java.util.ArrayList) TimeGranularity(com.linkedin.thirdeye.api.TimeGranularity) ContributorViewRequest(com.linkedin.thirdeye.dashboard.views.contributor.ContributorViewRequest) MetricExpression(com.linkedin.thirdeye.client.MetricExpression) DateTime(org.joda.time.DateTime) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Example 3 with PinotThirdEyeClient

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

the class HeatMapTest method main.

public static void main(String[] args) throws Exception {
    HeatMapViewRequest request = new HeatMapViewRequest();
    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.plusHours(1));
    request.setCurrentStart(baselineStart.plusDays(7));
    request.setCurrentEnd(baselineStart.plusDays(7).plusHours(1));
    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));
    HeatMapViewHandler handler = new HeatMapViewHandler(queryCache);
    HeatMapViewResponse 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) HeatMapViewResponse(com.linkedin.thirdeye.dashboard.views.heatmap.HeatMapViewResponse) ArrayList(java.util.ArrayList) HeatMapViewRequest(com.linkedin.thirdeye.dashboard.views.heatmap.HeatMapViewRequest) TimeGranularity(com.linkedin.thirdeye.api.TimeGranularity) HeatMapViewHandler(com.linkedin.thirdeye.dashboard.views.heatmap.HeatMapViewHandler) MetricExpression(com.linkedin.thirdeye.client.MetricExpression) DateTime(org.joda.time.DateTime) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Example 4 with PinotThirdEyeClient

use of com.linkedin.thirdeye.client.pinot.PinotThirdEyeClient 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)

Example 5 with PinotThirdEyeClient

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

the class TimeOnTimeTest method main.

public static void main(String[] args) throws Exception {
    // TODO
    PinotThirdEyeClient pinotThirdEyeClient = PinotThirdEyeClient.getDefaultTestClient();
    // make
    // this
    // configurable;
    // PinotThirdEyeClient pinotThirdEyeClient =
    // PinotThirdEyeClient.fromHostList("localhost", 8100, "localhost:8099");
    QueryCache queryCache = new QueryCache(pinotThirdEyeClient, Executors.newFixedThreadPool(10));
    // QueryCache queryCache = new QueryCache(pinotThirdEyeClient, Executors.newCachedThreadPool());
    TimeOnTimeComparisonRequest comparisonRequest;
    comparisonRequest = generateGroupByTimeRequest();
    // comparisonRequest = generateGroupByDimensionRequest();
    // comparisonRequest = generateGroupByTimeAndDimension();
    TimeOnTimeComparisonHandler handler = new TimeOnTimeComparisonHandler(queryCache);
    // long start;
    // long end;
    // // Thread.sleep(30000);
    // for (int i = 0; i < 5; i++) {
    // start = System.currentTimeMillis();
    // handler.handle(comparisonRequest);
    // end = System.currentTimeMillis();
    // System.out.println("Time taken:" + (end - start));
    // }
    // System.exit(0);
    long start = System.currentTimeMillis();
    TimeOnTimeComparisonResponse response = handler.handle(comparisonRequest);
    long end = System.currentTimeMillis();
    System.out.println("Time taken:" + (end - start));
    for (Metric metric : response.getRow(0).getMetrics()) {
        System.out.print(metric.getMetricName() + "\t\t");
    }
    System.out.println();
    for (int i = 0; i < response.getNumRows(); i++) {
        System.out.println(response.getRow(i));
    }
    System.exit(0);
}
Also used : PinotThirdEyeClient(com.linkedin.thirdeye.client.pinot.PinotThirdEyeClient) QueryCache(com.linkedin.thirdeye.client.cache.QueryCache) Metric(com.linkedin.thirdeye.client.comparison.Row.Metric)

Aggregations

QueryCache (com.linkedin.thirdeye.client.cache.QueryCache)5 PinotThirdEyeClient (com.linkedin.thirdeye.client.pinot.PinotThirdEyeClient)5 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)3 TimeGranularity (com.linkedin.thirdeye.api.TimeGranularity)3 MetricExpression (com.linkedin.thirdeye.client.MetricExpression)3 ArrayList (java.util.ArrayList)3 DateTime (org.joda.time.DateTime)3 Metric (com.linkedin.thirdeye.client.comparison.Row.Metric)1 TimeSeriesMetric (com.linkedin.thirdeye.client.timeseries.TimeSeriesRow.TimeSeriesMetric)1 ContributorViewHandler (com.linkedin.thirdeye.dashboard.views.contributor.ContributorViewHandler)1 ContributorViewRequest (com.linkedin.thirdeye.dashboard.views.contributor.ContributorViewRequest)1 ContributorViewResponse (com.linkedin.thirdeye.dashboard.views.contributor.ContributorViewResponse)1 HeatMapViewHandler (com.linkedin.thirdeye.dashboard.views.heatmap.HeatMapViewHandler)1 HeatMapViewRequest (com.linkedin.thirdeye.dashboard.views.heatmap.HeatMapViewRequest)1 HeatMapViewResponse (com.linkedin.thirdeye.dashboard.views.heatmap.HeatMapViewResponse)1 TabularViewHandler (com.linkedin.thirdeye.dashboard.views.tabular.TabularViewHandler)1 TabularViewRequest (com.linkedin.thirdeye.dashboard.views.tabular.TabularViewRequest)1 TabularViewResponse (com.linkedin.thirdeye.dashboard.views.tabular.TabularViewResponse)1 URL (java.net.URL)1