private String getHigherPrecision(URIBuilder uriBuilder, Long startTime, Long endTime) throws URISyntaxException {

    Precision currentPrecision = null;
    List<NameValuePair> queryParams = uriBuilder.getQueryParams();
    for (Iterator<NameValuePair> it = queryParams.iterator(); it.hasNext();) {
      NameValuePair nvp = it.next();
      if (nvp.getName().equals("precision")) {
        currentPrecision = Precision.getPrecision(nvp.getValue());
      }
    }
    if (currentPrecision == null && startTime != null && endTime != null) {
      currentPrecision = Precision.getPrecision(startTime, endTime);
    }
    Precision higherPrecision = Precision.getHigherPrecision(currentPrecision);

    return (higherPrecision != null) ? higherPrecision.toString() : null;
  }
Helper class to call AMS backend that is utilized by @AMSPropertyProvider
and @AMSReportPropertyProvider as well as @TimelineMetricCacheEntryFactory
ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/timeline/MetricsRequestHelper.java