protected Long getRefreshRequestEndTime(Long existingSeriesStartTime,
      Long existingSeriesEndTime, Long requestedEndTime) {
    Long endTime = requestedEndTime;
    Long diff = requestedEndTime - existingSeriesEndTime;
    if (diff < 0 && requestedEndTime > existingSeriesStartTime) {
      // End time overlaps existing timeseries
      // Get only older data that might not be in the cache
      endTime = existingSeriesStartTime;
    }

    LOG.trace("Requesting timeseries data with new endTime = {}", new Date(getMillisecondsTime(endTime)));
    return endTime;
  }
Update cache with new timeseries data
ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/timeline/cache/TimelineMetricCacheEntryFactory.java