public static List<alluxio.grpc.Metric> reportWorkerMetrics() {
    long start = System.currentTimeMillis();
    List<alluxio.grpc.Metric> metricsList = reportMetrics(InstanceType.WORKER);
    LOG.debug("Get the worker metrics list contains {} metrics to report to leading master in {}ms",
        metricsList.size(), System.currentTimeMillis() - start);
    return metricsList;
  }
@Test
  public void testReportWorkerMetrics() {
    String metricName = "Worker.TestMetric";
    Counter counter = MetricsSystem.counter(metricName);
    if (!MetricKey.isValid(metricName)) {
      MetricKey.register(new MetricKey.Builder(metricName)
          .setMetricType(MetricType.COUNTER).setIsClusterAggregated(true).build());
      MetricsSystem.initShouldReportMetrics(MetricsSystem.InstanceType.WORKER);
    }
    counter.inc();
    assertEquals(1.0, MetricsSystem.reportWorkerMetrics().get(0).getValue(), 0);
    assertEquals(0, MetricsSystem.reportWorkerMetrics().size());
    counter.inc();
    assertEquals(1.0, MetricsSystem.reportWorkerMetrics().get(0).getValue(), 0);
  }