@SuppressWarnings("deprecation")
  private void writeRegionMetricValues(RegionMXBean regionMxBean, TabularResultModel metricsTable,
      StringBuilder csvBuilder, Set<Category> categoriesToDisplay) {
    if (categoriesToDisplay.contains(Category.region)) {
      writeToTableAndCsv(metricsTable, "region", "lastModifiedTime",
          regionMxBean.getLastModifiedTime(), csvBuilder);
      writeToTableAndCsv(metricsTable, "", "lastAccessedTime", regionMxBean.getLastAccessedTime(),
          csvBuilder);
      writeToTableAndCsv(metricsTable, "", "missCount", regionMxBean.getMissCount(), csvBuilder);
      writeToTableAndCsv(metricsTable, "", "hitCount", regionMxBean.getHitCount(), csvBuilder);
      writeToTableAndCsv(metricsTable, "", "hitRatio", regionMxBean.getHitRatio(), csvBuilder);
      writeToTableAndCsv(metricsTable, "", "getsRate", regionMxBean.getGetsRate(), csvBuilder);
      writeToTableAndCsv(metricsTable, "", "putsRate", regionMxBean.getPutsRate(), csvBuilder);
      writeToTableAndCsv(metricsTable, "", "createsRate", regionMxBean.getCreatesRate(),
          csvBuilder);
      writeToTableAndCsv(metricsTable, "", "destroyRate", regionMxBean.getDestroyRate(),
          csvBuilder);
      writeToTableAndCsv(metricsTable, "", "putAllRate", regionMxBean.getPutAllRate(), csvBuilder);
    }
    if (categoriesToDisplay.contains(Category.partition)) {
      writeToTableAndCsv(metricsTable, "partition", "putLocalRate", regionMxBean.getPutLocalRate(),
          csvBuilder);
      writeToTableAndCsv(metricsTable, "", "putRemoteRate", regionMxBean.getPutRemoteRate(),
          csvBuilder);
      writeToTableAndCsv(metricsTable, "", "putRemoteLatency", regionMxBean.getPutRemoteLatency(),
          csvBuilder);
      writeToTableAndCsv(metricsTable, "", "putRemoteAvgLatency",
          regionMxBean.getPutRemoteAvgLatency(), csvBuilder);

      writeToTableAndCsv(metricsTable, "", "bucketCount", regionMxBean.getBucketCount(),
          csvBuilder);
      writeToTableAndCsv(metricsTable, "", "primaryBucketCount",
          regionMxBean.getPrimaryBucketCount(), csvBuilder);
      writeToTableAndCsv(metricsTable, "", "configuredRedundancy",
          regionMxBean.getConfiguredRedundancy(), csvBuilder);
      writeToTableAndCsv(metricsTable, "", "actualRedundancy", regionMxBean.getActualRedundancy(),
          csvBuilder);
      writeToTableAndCsv(metricsTable, "", "numBucketsWithoutRedundancy",
          regionMxBean.getNumBucketsWithoutRedundancy(), csvBuilder);
      writeToTableAndCsv(metricsTable, "", "totalBucketSize", regionMxBean.getTotalBucketSize(),
          csvBuilder);
    }
    if (categoriesToDisplay.contains(Category.diskstore)) {
      writeToTableAndCsv(metricsTable, "diskstore", "totalEntriesOnlyOnDisk",
          regionMxBean.getTotalEntriesOnlyOnDisk(), csvBuilder);
      writeToTableAndCsv(metricsTable, "", "diskReadsRate", "" + regionMxBean.getDiskReadsRate(),
          csvBuilder);
      writeToTableAndCsv(metricsTable, "", "diskWritesRate", regionMxBean.getDiskWritesRate(),
          csvBuilder);
      writeToTableAndCsv(metricsTable, "", "totalDiskWriteInProgress",
          regionMxBean.getTotalDiskWritesProgress(), csvBuilder);
      writeToTableAndCsv(metricsTable, "", "diskTaskWaiting", regionMxBean.getDiskTaskWaiting(),
          csvBuilder);
    }
    if (categoriesToDisplay.contains(Category.callback)) {
      writeToTableAndCsv(metricsTable, "callback", "cacheWriterCallsAvgLatency",
          regionMxBean.getCacheWriterCallsAvgLatency(), csvBuilder);
      writeToTableAndCsv(metricsTable, "", "cacheListenerCallsAvgLatency",
          regionMxBean.getCacheListenerCallsAvgLatency(), csvBuilder);
    }
    if (categoriesToDisplay.contains(Category.eviction)) {
      writeToTableAndCsv(metricsTable, "eviction", "lruEvictionRate",
          regionMxBean.getLruEvictionRate(), csvBuilder);
      writeToTableAndCsv(metricsTable, "", "lruDestroyRate", regionMxBean.getLruDestroyRate(),
          csvBuilder);
    }
  }
Gets the metrics of region on a given member

@return ResultData with required Region statistics or ErrorResultData if Region MBean is not
        found to gather metrics
geode-gfsh/src/main/java/org/apache/geode/management/internal/cli/commands/ShowMetricsCommand.java