コード例 #1
0
  private void logStatisticsByOperation(MonitoringStatistics monitoringStatistics) {
    for (Map.Entry<Class<?>, ResourceStatistics> classStatsEntry :
        monitoringStatistics.getResourceClassStatistics().entrySet()) {

      for (Map.Entry<ResourceMethod, ResourceMethodStatistics> methodStatsEntry :
          classStatsEntry.getValue().getResourceMethodStatistics().entrySet()) {

        if (ApiResource.class.isAssignableFrom(classStatsEntry.getKey())) {
          TimeWindowStatistics timeWindowStatistics =
              methodStatsEntry
                  .getValue()
                  .getRequestStatistics()
                  .getTimeWindowStatistics()
                  .get(STATISTICS_TIME_WINDOW);

          String fullPath =
              getFullPath(
                  classStatsEntry.getKey(),
                  methodStatsEntry.getKey().getInvocable().getHandlingMethod());

          LOGGER.info(
              "Last hour statistics - {} - {} - {}",
              methodStatsEntry.getKey().getHttpMethod(),
              fullPath,
              getStatsMessage(timeWindowStatistics));
        }
      }
    }
  }
コード例 #2
0
 private void logSummaryStatistics(MonitoringStatistics monitoringStatistics) {
   TimeWindowStatistics timeWindowStatistics =
       monitoringStatistics
           .getRequestStatistics()
           .getTimeWindowStatistics()
           .get(STATISTICS_TIME_WINDOW);
   LOGGER.info("Last hour statistics - Summary - {} ", getStatsMessage(timeWindowStatistics));
 }