Package org.kairosdb.client.response

Examples of org.kairosdb.client.response.QueryResponse


      builder.setStart(1, TimeUnit.MINUTES);
      builder.addMetric(TELNET_METRIC_NAME_1);
      builder.addMetric(TELNET_METRIC_NAME_2);

      HttpClient httpClient = new HttpClient("http://localhost:8080");
      QueryResponse query = httpClient.query(builder);
      assertThat(query.getQueries().size(), equalTo(2));

      assertThat(query.getQueries().get(0).getResults().size(), equalTo(1));
      List<DataPoint> dataPoints = query.getQueries().get(0).getResults().get(0).getDataPoints();
      System.out.println(timestamp1);
      assertThat(dataPoints.size(), equalTo(1));
      assertThat(dataPoints.get(0).getTimestamp(), equalTo(timestamp1));
      assertThat(dataPoints.get(0).longValue(), equalTo(20L));

      assertThat(query.getQueries().get(1).getResults().size(), equalTo(1));
      dataPoints = query.getQueries().get(1).getResults().get(0).getDataPoints();
      assertThat(dataPoints.size(), equalTo(1));
      assertThat(dataPoints.get(0).getTimestamp(), equalTo(timestamp2));
      assertThat(dataPoints.get(0).longValue(), equalTo(40L));
    }
    finally
View Full Code Here


      // Query metrics
      QueryBuilder builder = QueryBuilder.getInstance();
      builder.setStart(1, TimeUnit.MINUTES);
      builder.addMetric("bogus");

      QueryResponse query = client.query(builder);
      assertThat(query.getQueries().size(), equalTo(1));
      assertThat(query.getQueries().get(0).getResults().size(), equalTo(1));

      List<DataPoint> dataPoints = query.getQueries().get(0).getResults().get(0).getDataPoints();
      assertThat(dataPoints.size(), equalTo(0));
    }
    finally
    {
      client.shutdown();
View Full Code Here

      QueryBuilder builder = QueryBuilder.getInstance();
      builder.setStart(1, TimeUnit.MINUTES);
      builder.addMetric(HTTP_METRIC_NAME_1);
      builder.addMetric(HTTP_METRIC_NAME_2);

      QueryResponse query = client.query(builder);
      assertThat(query.getQueries().size(), equalTo(2));
      assertThat(query.getQueries().get(0).getResults().size(), equalTo(1));

      List<DataPoint> dataPoints = query.getQueries().get(0).getResults().get(0).getDataPoints();
      assertThat(dataPoints.size(), equalTo(1));
      assertThat(dataPoints.get(0).getTimestamp(), equalTo(timestamp1));
      assertThat(dataPoints.get(0).longValue(), equalTo(20L));
    }
    finally
View Full Code Here

      QueryBuilder builder = QueryBuilder.getInstance();
      builder.setStart(1, TimeUnit.MINUTES);
      QueryMetric queryMetric = builder.addMetric(HTTP_METRIC_NAME_1);
      queryMetric.addTag(HTTP_TAG_NAME_1, HTTP_TAG_VALUE_2, HTTP_TAG_VALUE_3);

      QueryResponse query = client.query(builder);

      assertThat(query.getQueries().size(), equalTo(1));
      assertThat(query.getQueries().get(0).getResults().size(), equalTo(1));
      assertThat(query.getQueries().get(0).getResults().get(0).getTags().size(), equalTo(1));
      assertThat(query.getQueries().get(0).getResults().get(0).getTags().get(HTTP_TAG_NAME_1).size(), equalTo(2));
      assertThat(query.getQueries().get(0).getResults().get(0).getTags().get(HTTP_TAG_NAME_1), hasItems(HTTP_TAG_VALUE_2, HTTP_TAG_VALUE_3));

      List<DataPoint> dataPoints = query.getQueries().get(0).getResults().get(0).getDataPoints();
      assertThat(dataPoints.size(), equalTo(2));
      assertThat(dataPoints.get(0).getTimestamp(), equalTo(timestamp2));
      assertThat(dataPoints.get(0).longValue(), equalTo(30L));
      assertThat(dataPoints.get(1).getTimestamp(), equalTo(timestamp3));
      assertThat(dataPoints.get(1).longValue(), equalTo(40L));
View Full Code Here

      metric.addGrouper(new TagGrouper(HTTP_TAG_NAME_1, HTTP_TAG_NAME_2));
      metric.addGrouper(new TimeGrouper(new RelativeTime(1, TimeUnit.MILLISECONDS), 3));
      metric.addGrouper(new ValueGrouper(4));

      QueryResponse query = client.query(builder);
      assertThat(query.getErrors().size(), equalTo(0));
    }
    finally
    {
      client.shutdown();
    }
View Full Code Here

      QueryBuilder builder = QueryBuilder.getInstance();
      builder.setStart(1, TimeUnit.MINUTES);
      builder.addMetric(SSL_METRIC_NAME_1);
      builder.addMetric(SSL_METRIC_NAME_2);

      QueryResponse query = client.query(builder);
      assertThat(query.getQueries().size(), equalTo(2));
      assertThat(query.getQueries().get(0).getResults().size(), equalTo(1));

      List<DataPoint> dataPoints = query.getQueries().get(0).getResults().get(0).getDataPoints();
      assertThat(dataPoints.size(), equalTo(1));
      assertThat(dataPoints.get(0).getTimestamp(), equalTo(timestamp1));
      assertThat(dataPoints.get(0).longValue(), equalTo(20L));
    }
    finally
View Full Code Here

      builder.setStart(1, TimeUnit.MINUTES);

      QueryMetric query = builder.addMetric("limitMetric");
      query.setLimit(5);

      QueryResponse response = client.query(builder);
      assertThat(response.getErrors().size(), equalTo(0));

      List<DataPoint> dataPoints = response.getQueries().get(0).getResults().get(0).getDataPoints();
      assertThat(dataPoints.size(), equalTo(5));

      assertThat(dataPoints.get(0).longValue(), equalTo(20L));
      assertThat(dataPoints.get(1).longValue(), equalTo(21L));
      assertThat(dataPoints.get(2).longValue(), equalTo(22L));
View Full Code Here

      builder.setStart(1, TimeUnit.MINUTES);

      QueryMetric query = builder.addMetric("orderMetric");
      query.setOrder(QueryMetric.Order.DESCENDING);

      QueryResponse response = client.query(builder);
      assertThat(response.getErrors().size(), equalTo(0));

      List<DataPoint> dataPoints = response.getQueries().get(0).getResults().get(0).getDataPoints();
      assertThat(dataPoints.size(), equalTo(5));

      assertThat(dataPoints.get(0).longValue(), equalTo(24L));
      assertThat(dataPoints.get(1).longValue(), equalTo(23L));
      assertThat(dataPoints.get(2).longValue(), equalTo(22L));
View Full Code Here

      // Query Metric
      QueryBuilder queryBuilder = QueryBuilder.getInstance();
      queryBuilder.setStart(2, TimeUnit.MINUTES);
      queryBuilder.addMetric("metric1");

      QueryResponse queryResponse = client.query(queryBuilder);
      assertThat(queryResponse.getQueries().size(), equalTo(1));
      assertThat(queryResponse.getQueries().get(0).getResults().size(), equalTo(1));

      List<DataPoint> dataPoints = queryResponse.getQueries().get(0).getResults().get(0).getDataPoints();
      assertThat(dataPoints, hasItem(new DataPoint(timestamp1, new Complex(4, 5))));
    }
    finally
    {
            client.shutdown();
View Full Code Here

TOP

Related Classes of org.kairosdb.client.response.QueryResponse

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.