Package net.opentsdb.core

Examples of net.opentsdb.core.Query


      final boolean rate = parts[--i].startsWith("rate");
      final RateOptions rate_options = QueryRpc.parseRateOptions(rate, parts[i]);
      if (rate) {
        i--;  // Move to the next part.
      }
      final Query tsdbquery = tsdb.newQuery();
      try {
        tsdbquery.setTimeSeries(metric, parsedtags, agg, rate, rate_options);
      } catch (NoSuchUniqueName e) {
        throw new BadRequestException(e.getMessage());
      }
      // downsampling function & interval.
      if (i > 0) {
        final int dash = parts[1].indexOf('-', 1)// 1st char can't be `-'.
        if (dash < 0) {
          throw new BadRequestException("Invalid downsampling specifier '"
                                        + parts[1] + "' in m=" + m);
        }
        Aggregator downsampler;
        try {
          downsampler = Aggregators.get(parts[1].substring(dash + 1));
        } catch (NoSuchElementException e) {
          throw new BadRequestException("No such downsampling function: "
                                        + parts[1].substring(dash + 1));
        }
        final long interval = DateTime.parseDuration(parts[1].substring(0, dash));
        tsdbquery.downsample(interval, downsampler);
      } else {
        tsdbquery.downsample(1000, agg);
      }
      tsdbqueries[nqueries++] = tsdbquery;
    }
    return tsdbqueries;
  }
View Full Code Here


        Tags.parse(tags, args[i++]);
      }
      if (i < args.length && args[i].indexOf(' ', 1) > 0) {
        plotoptions.add(args[i++]);
      }
      final Query query = tsdb.newQuery();
      query.setStartTime(start_ts);
      if (end_ts > 0) {
        query.setEndTime(end_ts);
      }
      query.setTimeSeries(metric, tags, agg, rate, rate_options);
      if (downsample) {
        query.downsample(interval, sampler);
      }
      queries.add(query);
    }
  }
View Full Code Here

TOP

Related Classes of net.opentsdb.core.Query

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.