public static FetchStatsResponse create(DistributionManager dm,
      InternalDistributedMember recipient, final String statisticsTypeName) {
    FetchStatsResponse response = new FetchStatsResponse();
    response.setRecipient(recipient);

    List<Statistics> statsList = dm.getSystem().getStatisticsManager().getStatsList();
    if (statisticsTypeName == null) {
      response.stats = statsList.stream()
          .map(RemoteStatResource::new)
          .toArray(RemoteStatResource[]::new);
    } else {
      response.stats = statsList.stream()
          .filter(s -> s.getType().getName().equals(statisticsTypeName))
          .map(RemoteStatResource::new)
          .toArray(RemoteStatResource[]::new);
    }
    return response;
  }
Generate a complete response to request for stats.

@param dm DistributionManager that is responding
@param recipient the recipient who made the original request
@return response containing all remote stat resources
geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchStatsResponse.java