private ResultModel getRegionMetricsFromMember(String regionName,
      DistributedMember distributedMember, String export_to_report_to, String[] categoriesArr,
      StringBuilder csvBuilder) {

    final SystemManagementService managementService = getManagementService();

    ObjectName regionMBeanName =
        managementService.getRegionMBeanName(distributedMember, regionName);
    RegionMXBean regionMxBean =
        managementService.getMBeanInstance(regionMBeanName, RegionMXBean.class);

    if (regionMxBean == null) {
      String errorMessage = CliStrings.format(CliStrings.SHOW_METRICS__ERROR,
          "Region MBean for " + regionName + " on member "
              + MBeanJMXAdapter.getMemberNameOrUniqueId(distributedMember) + " not found");
      return ResultModel.createError(errorMessage);
    }

    ResultModel result = new ResultModel();
    TabularResultModel metricsTable = result.addTable("metrics");
    metricsTable.setHeader("Metrics for region:" + regionName + " On Member "
        + MBeanJMXAdapter.getMemberNameOrUniqueId(distributedMember));

    Set<Category> categoriesToDisplay = ArrayUtils.isNotEmpty(categoriesArr)
        ? getCategorySet(categoriesArr) : new HashSet<>(REGION_METRIC_CATEGORIES);

    writeRegionMetricValues(regionMxBean, metricsTable, csvBuilder, categoriesToDisplay);
    if (StringUtils.isNotEmpty(export_to_report_to)) {
      result.addFile(export_to_report_to, csvBuilder != null ? csvBuilder.toString() : null);
    }

    return result;
  }
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