private Callback<Void> securityPostProcessRequestCallback() {
      return buildCallback(metrics.getStatsReportSecurityPostProcessRequestMetrics, securityCheckResult -> {
        String clusterName = RestUtils.getHeader(restRequest.getArgs(), RestUtils.Headers.CLUSTER_NAME, true);
        String reportType = RestUtils.getHeader(restRequest.getArgs(), RestUtils.Headers.GET_STATS_REPORT_TYPE, true);
        StatsReportType statsReportType;
        try {
          statsReportType = StatsReportType.valueOf(reportType);
        } catch (Exception e) {
          throw new RestServiceException(reportType + " is not a valid StatsReportType",
              RestServiceErrorCode.BadRequest);
        }
        Object result;
        switch (statsReportType) {
          case ACCOUNT_REPORT:
            result = accountStatsStore.queryAggregatedAccountStorageStatsByClusterName(clusterName);
            break;
          case PARTITION_CLASS_REPORT:
            result = accountStatsStore.queryAggregatedPartitionClassStorageStatsByClusterName(clusterName);
            break;
          default:
            throw new RestServiceException("StatsReportType " + statsReportType + "not supported",
                RestServiceErrorCode.BadRequest);
        }
        if (result == null) {
          throw new RestServiceException("StatsReport not found for clusterName " + clusterName,
              RestServiceErrorCode.NotFound);
        }
        try {
          byte[] jsonBytes = mapper.writeValueAsBytes(result);
          restResponseChannel.setHeader(RestUtils.Headers.DATE, new GregorianCalendar().getTime());
          restResponseChannel.setHeader(RestUtils.Headers.CONTENT_TYPE, RestUtils.JSON_CONTENT_TYPE);
          restResponseChannel.setHeader(RestUtils.Headers.CONTENT_LENGTH, jsonBytes.length);
          ReadableStreamChannel channel = new ByteBufferReadableStreamChannel(ByteBuffer.wrap(jsonBytes));
          finalCallback.onCompletion(channel, null);
        } catch (Exception e) {
          throw new RestServiceException("Couldn't serialize snapshot", e, RestServiceErrorCode.InternalServerError);
        }
      }, restRequest.getUri(), logger, finalCallback);
    }
After {@link SecurityService#postProcessRequest} finishes, fetch stats report from {@link AccountStatsStore} and construct
a json object to send back to {@link RestResponseChannel}.
@return a {@link Callback} to be used with {@link SecurityService#postProcessRequest}.
ambry-frontend/src/main/java/com/github/ambry/frontend/GetStatsReportHandler.java