public static String getMetricName(String name) {
    if (name.startsWith(CLUSTER)) {
      return name;
    }
    switch (CommonUtils.PROCESS_TYPE.get()) {
      case CLIENT:
        return getClientMetricName(name);
      case MASTER:
        return getMasterMetricName(name);
      case PROXY:
        return getProxyMetricName(name);
      case WORKER:
        return getWorkerMetricName(name);
      case JOB_MASTER:
        return getJobMasterMetricName(name);
      case JOB_WORKER:
        return getJobWorkerMetricName(name);
      case PLUGIN:
        return getPluginMetricName(name);
      case SECURITY:
        return getSecurityMetricName(name);
      default:
        throw new IllegalStateException("Unknown process type");
    }
  }
@Test
  public void getMetricNameTest() {
    assertEquals("Cluster.counter", MetricsSystem.getMetricName("Cluster.counter"));
    assertEquals("Master.timer", MetricsSystem.getMetricName("Master.timer"));
    String workerGaugeName = "Worker.gauge";
    assertEquals(workerGaugeName, MetricsSystem.getMetricName(workerGaugeName));
    assertTrue(MetricsSystem.getMetricName(workerGaugeName).startsWith(workerGaugeName));
    String clientCounterName = "Client.counter";
    assertEquals(clientCounterName, MetricsSystem.getMetricName(clientCounterName));
    assertTrue(MetricsSystem.getMetricName(clientCounterName).startsWith(clientCounterName));
  }