private void writeCacheServerMetricValues(CacheServerMXBean csMxBean,
      TabularResultModel metricsTable, StringBuilder csvBuilder,
      Set<Category> categoriesToDisplay) {
    if (categoriesToDisplay.contains(Category.cacheserver)) {

      writeToTableAndCsv(metricsTable, "cacheserver", "clientConnectionCount",
          csMxBean.getClientConnectionCount(), csvBuilder);
      writeToTableAndCsv(metricsTable, "", "hostnameForClients", csMxBean.getHostNameForClients(),
          csvBuilder);
      writeToTableAndCsv(metricsTable, "", "getRequestAvgLatency",
          csMxBean.getGetRequestAvgLatency(), csvBuilder);
      writeToTableAndCsv(metricsTable, "", "putRequestAvgLatency",
          csMxBean.getPutRequestAvgLatency(), csvBuilder);
      writeToTableAndCsv(metricsTable, "", "totalConnectionsTimedOut",
          csMxBean.getTotalConnectionsTimedOut(), csvBuilder);
      writeToTableAndCsv(metricsTable, "", "threadQueueSize", csMxBean.getPutRequestAvgLatency(),
          csvBuilder);
      writeToTableAndCsv(metricsTable, "", "connectionThreads", csMxBean.getConnectionThreads(),
          csvBuilder);
      writeToTableAndCsv(metricsTable, "", "connectionLoad", csMxBean.getConnectionLoad(),
          csvBuilder);
      writeToTableAndCsv(metricsTable, "", "loadPerConnection", csMxBean.getLoadPerConnection(),
          csvBuilder);
      writeToTableAndCsv(metricsTable, "", "queueLoad", csMxBean.getQueueLoad(), csvBuilder);
      writeToTableAndCsv(metricsTable, "", "loadPerQueue", csMxBean.getLoadPerQueue(), csvBuilder);
      writeToTableAndCsv(metricsTable, "", "getRequestRate", csMxBean.getGetRequestRate(),
          csvBuilder);
      writeToTableAndCsv(metricsTable, "", "putRequestRate", csMxBean.getPutRequestRate(),
          csvBuilder);
    }
    if (categoriesToDisplay.contains(Category.notification)) {
      writeToTableAndCsv(metricsTable, "notification", "numClientNotificationRequests",
          csMxBean.getNumClientNotificationRequests(), csvBuilder);
      writeToTableAndCsv(metricsTable, "", "clientNotificationRate",
          csMxBean.getClientNotificationRate(), csvBuilder);
      writeToTableAndCsv(metricsTable, "", "clientNotificationAvgLatency",
          csMxBean.getClientNotificationAvgLatency(), csvBuilder);
    }
    if (categoriesToDisplay.contains(Category.query)) {
      writeToTableAndCsv(metricsTable, "query", "activeCQCount", csMxBean.getActiveCQCount(),
          csvBuilder);
      writeToTableAndCsv(metricsTable, "", "queryRequestRate", csMxBean.getQueryRequestRate(),
          csvBuilder);

      writeToTableAndCsv(metricsTable, "", "indexCount", csMxBean.getIndexCount(), csvBuilder);

      writeToTableAndCsv(metricsTable, "", "index list", csMxBean.getIndexList(), csvBuilder);
      writeToTableAndCsv(metricsTable, "", "totalIndexMaintenanceTime",
          csMxBean.getTotalIndexMaintenanceTime(), 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