code: private MetricData _parseMetricData(List<Metric> metrics) {
          long dataPointsSize = 0;
          Long minDiff = null;
          Map<Metric, List<Long>> metricCategoryMap = new HashMap<Metric, List<Long>>();
          List<Long> metricList;
  
          for (Metric metric : metrics) {
              dataPointsSize += metric.getDatapoints().size();
  
              Metric metricCategory = new Metric(metric.getScope(), metric.getMetric());
  
              metricCategory.setTags(metric.getTags());
              if (metricCategoryMap.containsKey(metricCategory)) {
                  metricList = metricCategoryMap.get(metricCategory);
                  metricList.addAll(metric.getDatapoints().keySet());
              } else {
                  metricCategoryMap.put(metricCategory, new ArrayList<Long>(metric.getDatapoints().keySet()));
              }
          }
          for (Entry<Metric, List<Long>> entry : metricCategoryMap.entrySet()) {
              Long minDiffInMetricCategory = null;
              List<Long> dataPointsTimeStampList = entry.getValue();
  
              if (dataPointsTimeStampList.size() >= 2) {
                  Collections.sort(dataPointsTimeStampList);
                  minDiffInMetricCategory = dataPointsTimeStampList.get(1) - dataPointsTimeStampList.get(0);
                  for (int i = 2; i < dataPointsTimeStampList.size(); i++) {
                      minDiffInMetricCategory = Math.min(minDiffInMetricCategory, dataPointsTimeStampList.get(i) - dataPointsTimeStampList.get(i - 1));
                  }
                  if (minDiff == null) {
                      minDiff = minDiffInMetricCategory;
                  }
                  minDiff = Math.min(minDiffInMetricCategory, minDiff);
              }
          }
          return new MetricData(dataPointsSize, minDiff);
      }
docs: /*
  Parses the metrics, and gets data points size and minimum resolution of data points across all metrics. To get minimum resolution, calculate
  the minimum of the minimum resolution across each metric category If there is not more than 1 data point in a metric category, then don't
  compute timestamp diff.