Package co.cask.cdap.metrics.data

Examples of co.cask.cdap.metrics.data.Interpolator


    long start = request.getStartTime();
    long end = request.getEndTime();

    // if we're interpolating, expand the time window a little to allow interpolation at the start and end.
    // Before returning the results, we'll make sure to only return what the client requested.
    Interpolator interpolator = request.getInterpolator();
    if (interpolator != null) {
      // try and expand the window by the max allowed gap for interpolation, but cap it so we dont have
      // super big windows.  The worry being that somebody sets the max allowed gap to Long.MAX_VALUE
      // to tell us to always interpolate.
      long expandCap = Math.max(Interpolators.DEFAULT_MAX_ALLOWED_GAP, (end - start) / 4);
      start -= Math.min(interpolator.getMaxAllowedGap(), expandCap);
      end += Math.min(interpolator.getMaxAllowedGap(), expandCap);
      // no use going past the current time
      end = Math.min(end, TimeUnit.SECONDS.convert(System.currentTimeMillis(), TimeUnit.MILLISECONDS));
    }

    return new MetricsScanQueryBuilder()
View Full Code Here


    builder.setType(MetricsRequest.Type.TIME_SERIES);
    setInterpolator(queryParams, builder);
  }

  private static void setInterpolator(Map<String, List<String>> queryParams, MetricsRequestBuilder builder) {
    Interpolator interpolator = null;

    if (queryParams.containsKey(INTERPOLATE)) {
      String interpolatorType = queryParams.get(INTERPOLATE).get(0);
      // timeLimit used in case there is a big gap in the data and we don't want to interpolate points.
      // the limit defines how big the gap has to be in seconds before we just say they're all zeroes.
View Full Code Here

TOP

Related Classes of co.cask.cdap.metrics.data.Interpolator

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.