code: private void addMetrics(List<MetricDatum> list,
              MetricValues metricValues,
              StandardUnit unit) {
          List<MachineMetric> machineMetrics = metricValues.getMetrics();
          List<Long> values = metricValues.getValues();
          for (int i=0; i < machineMetrics.size(); i++) {
              MachineMetric metric = machineMetrics.get(i);
              long val = values.get(i).longValue();
              // skip zero values in some cases
              if (val != 0 || metric.includeZeroValue()) {
                  MetricDatum datum = new MetricDatum()
                      .withMetricName(metric.getMetricName())
                      .withDimensions(
                          new Dimension()
                          .withName(metric.getDimensionName())
                          .withValue(metric.name()))
                      .withUnit(unit)
                      .withValue((double) val)
                      ;
                  list.add(datum);
              }
          }
      }
docs: Add the given list of metrics and corresponding values specified in
  "metricValues" to the given list of metric datum.
  
  @param list
  list of metric data
  @param metricValues
  list of metrics and their corresponding values