Search in sources :

Example 1 with DBQuery

use of org.apache.drill.exec.store.openTSDB.client.query.DBQuery in project drill by apache.

the class ServiceImpl method getAllMetricsFromDBByTags.

private Set<MetricDTO> getAllMetricsFromDBByTags(Map<String, String> queryParams) throws IOException {
    Map<String, String> tags = new HashMap<>();
    DBQuery baseQuery = getConfiguredDbQuery(tags, queryParams);
    Set<MetricDTO> metrics = getBaseMetric(baseQuery);
    if (metrics == null || metrics.isEmpty()) {
        throw UserException.validationError().message(String.format("Table '%s' not found. Please check your query and params", queryParams.get(METRIC_PARAM))).build(log);
    }
    Set<String> extractedTags = getTagsFromMetrics(metrics);
    return getMetricsByTags(extractedTags, queryParams);
}
Also used : MetricDTO(org.apache.drill.exec.store.openTSDB.dto.MetricDTO) HashMap(java.util.HashMap) DBQuery(org.apache.drill.exec.store.openTSDB.client.query.DBQuery)

Example 2 with DBQuery

use of org.apache.drill.exec.store.openTSDB.client.query.DBQuery in project drill by apache.

the class ServiceImpl method getConfiguredDbQuery.

private DBQuery getConfiguredDbQuery(Map<String, String> tags, Map<String, String> queryParams) {
    Query subQuery = new Query.Builder(queryParams.get(METRIC_PARAM)).setAggregator(queryParams.get(AGGREGATOR_PARAM)).setDownsample(queryParams.get(DOWNSAMPLE_PARAM)).setTags(tags).build();
    Set<Query> queries = new HashSet<>();
    queries.add(subQuery);
    return new DBQuery.Builder().setStartTime(queryParams.get(TIME_PARAM)).setEndTime(queryParams.get(END_TIME_PARAM)).setQueries(queries).build();
}
Also used : Query(org.apache.drill.exec.store.openTSDB.client.query.Query) DBQuery(org.apache.drill.exec.store.openTSDB.client.query.DBQuery) HashSet(java.util.HashSet)

Example 3 with DBQuery

use of org.apache.drill.exec.store.openTSDB.client.query.DBQuery in project drill by axbaretto.

the class ServiceImpl method getConfiguredDbQuery.

private DBQuery getConfiguredDbQuery(Map<String, String> tags, Map<String, String> queryParams) {
    Query subQuery = new Query.Builder(queryParams.get(METRIC_PARAM)).setAggregator(queryParams.get(AGGREGATOR_PARAM)).setDownsample(queryParams.get(DOWNSAMPLE_PARAM)).setTags(tags).build();
    Set<Query> queries = new HashSet<>();
    queries.add(subQuery);
    return new DBQuery.Builder().setStartTime(queryParams.get(TIME_PARAM)).setEndTime(queryParams.get(END_TIME_PARAM)).setQueries(queries).build();
}
Also used : Query(org.apache.drill.exec.store.openTSDB.client.query.Query) DBQuery(org.apache.drill.exec.store.openTSDB.client.query.DBQuery) HashSet(java.util.HashSet)

Example 4 with DBQuery

use of org.apache.drill.exec.store.openTSDB.client.query.DBQuery in project drill by axbaretto.

the class ServiceImpl method getAllMetricsFromDBByTags.

private Set<MetricDTO> getAllMetricsFromDBByTags(Map<String, String> queryParams) throws IOException {
    Map<String, String> tags = new HashMap<>();
    DBQuery baseQuery = getConfiguredDbQuery(tags, queryParams);
    Set<MetricDTO> metrics = getBaseMetric(baseQuery);
    if (metrics == null || metrics.isEmpty()) {
        throw UserException.validationError().message(String.format("Table '%s' not found. Please check your query and params", queryParams.get(METRIC_PARAM))).build(log);
    }
    Set<String> extractedTags = getTagsFromMetrics(metrics);
    return getMetricsByTags(extractedTags, queryParams);
}
Also used : MetricDTO(org.apache.drill.exec.store.openTSDB.dto.MetricDTO) HashMap(java.util.HashMap) DBQuery(org.apache.drill.exec.store.openTSDB.client.query.DBQuery)

Aggregations

DBQuery (org.apache.drill.exec.store.openTSDB.client.query.DBQuery)4 HashMap (java.util.HashMap)2 HashSet (java.util.HashSet)2 Query (org.apache.drill.exec.store.openTSDB.client.query.Query)2 MetricDTO (org.apache.drill.exec.store.openTSDB.dto.MetricDTO)2