@Test public void testGetStatsSnapshots() throws StoreException { BlobStoreStats blobStoreStats = setupBlobStoreStats(0, 0); long deleteAndExpirationRefTimeInMs = state.time.milliseconds(); Map<String, Map<String, Long>> utilizationMap = blobStoreStats.getValidDataSizeByContainer(deleteAndExpirationRefTimeInMs); Map<StatsReportType, StatsSnapshot> snapshotsByType = blobStoreStats.getStatsSnapshots(EnumSet.of(StatsReportType.ACCOUNT_REPORT), deleteAndExpirationRefTimeInMs); verifyStatsSnapshots(utilizationMap, snapshotsByType, EnumSet.of(StatsReportType.ACCOUNT_REPORT)); snapshotsByType = blobStoreStats.getStatsSnapshots(EnumSet.of(StatsReportType.PARTITION_CLASS_REPORT), deleteAndExpirationRefTimeInMs); verifyStatsSnapshots(utilizationMap, snapshotsByType, EnumSet.of(StatsReportType.PARTITION_CLASS_REPORT)); Map<StatsReportType, StatsSnapshot> allStatsSnapshots = blobStoreStats.getStatsSnapshots(EnumSet.allOf(StatsReportType.class), deleteAndExpirationRefTimeInMs); verifyStatsSnapshots(utilizationMap, allStatsSnapshots, EnumSet.allOf(StatsReportType.class)); }
@Override public Map<StatsReportType, StatsSnapshot> getStatsSnapshots(Set<StatsReportType> statsReportTypes, long referenceTimeInMs) throws StoreException { Map<StatsReportType, StatsSnapshot> statsSnapshotsByType = new HashMap<>(); Map<String, Map<String, Long>> utilizationMap = getValidDataSizeByContainer(referenceTimeInMs); for (StatsReportType reportType : statsReportTypes) { switch (reportType) { case ACCOUNT_REPORT: statsSnapshotsByType.put(StatsReportType.ACCOUNT_REPORT, convertStoreUsageToAccountStatsSnapshot(utilizationMap)); break; case PARTITION_CLASS_REPORT: statsSnapshotsByType.put(StatsReportType.PARTITION_CLASS_REPORT, convertStoreUsageToContainerStatsSnapshot(utilizationMap)); break; default: logger.error("Unrecognized stats report type: {}", reportType); } } return statsSnapshotsByType; }
BlobStoreStats implements StoreStats, Closeable { @Override public Map<StatsReportType, StatsSnapshot> getStatsSnapshots(Set<StatsReportType> statsReportTypes, long referenceTimeInMs) throws StoreException { Map<StatsReportType, StatsSnapshot> statsSnapshotsByType = new HashMap<>(); Map<String, Map<String, Long>> utilizationMap = getValidDataSizeByContainer(referenceTimeInMs); for (StatsReportType reportType : statsReportTypes) { switch (reportType) { case ACCOUNT_REPORT: statsSnapshotsByType.put(StatsReportType.ACCOUNT_REPORT, convertStoreUsageToAccountStatsSnapshot(utilizationMap)); break; case PARTITION_CLASS_REPORT: statsSnapshotsByType.put(StatsReportType.PARTITION_CLASS_REPORT, convertStoreUsageToContainerStatsSnapshot(utilizationMap)); break; default: logger.error("Unrecognized stats report type: {}", reportType); } } return statsSnapshotsByType; } }
BlobStoreStats implements StoreStats, Closeable { @Override public Map<StatsReportType, StatsSnapshot> getStatsSnapshots(Set<StatsReportType> statsReportTypes, long referenceTimeInMs) throws StoreException { Map<StatsReportType, StatsSnapshot> statsSnapshotsByType = new HashMap<>(); Map<String, Map<String, Long>> utilizationMap = getValidDataSizeByContainer(referenceTimeInMs); for (StatsReportType reportType : statsReportTypes) { switch (reportType) { case ACCOUNT_REPORT: statsSnapshotsByType.put(StatsReportType.ACCOUNT_REPORT, convertStoreUsageToAccountStatsSnapshot(utilizationMap)); break; case PARTITION_CLASS_REPORT: statsSnapshotsByType.put(StatsReportType.PARTITION_CLASS_REPORT, convertStoreUsageToContainerStatsSnapshot(utilizationMap)); break; default: logger.error("Unrecognized stats report type: {}", reportType); } } return statsSnapshotsByType; } BlobStoreStats(String storeId, PersistentIndex index, int bucketCount, long bucketSpanTimeInMs,
      long logSegmentForecastOffsetMs, long queueProcessingPeriodInMs, long waitTimeoutInSecs,
      boolean enableBucketForLogSegmentReports, Time time, ScheduledExecutorService longLiveTaskScheduler,
      ScheduledExecutorService shortLiveTaskScheduler, DiskIOScheduler diskIOScheduler, StoreMetrics metrics); }
BlobStoreStats implements StoreStats, Closeable { @Override public Map<StatsReportType, StatsSnapshot> getStatsSnapshots(Set<StatsReportType> statsReportTypes, long referenceTimeInMs) throws StoreException { Map<StatsReportType, StatsSnapshot> statsSnapshotsByType = new HashMap<>(); Map<String, Map<String, Long>> utilizationMap = getValidDataSizeByContainer(referenceTimeInMs); for (StatsReportType reportType : statsReportTypes) { switch (reportType) { case ACCOUNT_REPORT: statsSnapshotsByType.put(StatsReportType.ACCOUNT_REPORT, convertStoreUsageToAccountStatsSnapshot(utilizationMap)); break; case PARTITION_CLASS_REPORT: statsSnapshotsByType.put(StatsReportType.PARTITION_CLASS_REPORT, convertStoreUsageToContainerStatsSnapshot(utilizationMap)); break; default: logger.error("Unrecognized stats report type: {}", reportType); } } return statsSnapshotsByType; } BlobStoreStats(String storeId, PersistentIndex index, int bucketCount, long bucketSpanTimeInMs,
      long logSegmentForecastOffsetMs, long queueProcessingPeriodInMs, long waitTimeoutInSecs,
      boolean enableBucketForLogSegmentReports, Time time, ScheduledExecutorService longLiveTaskScheduler,
      ScheduledExecutorService shortLiveTaskScheduler, DiskIOScheduler diskIOScheduler, StoreMetrics metrics); @Override Pair<Long, Long> getValidSize(TimeRange timeRange); @Override Map<StatsReportType, StatsSnapshot> getStatsSnapshots(Set<StatsReportType> statsReportTypes,
      long referenceTimeInMs); @Override void close(); }
BlobStoreStats implements StoreStats, Closeable { @Override public Map<StatsReportType, StatsSnapshot> getStatsSnapshots(Set<StatsReportType> statsReportTypes, long referenceTimeInMs) throws StoreException { Map<StatsReportType, StatsSnapshot> statsSnapshotsByType = new HashMap<>(); Map<String, Map<String, Long>> utilizationMap = getValidDataSizeByContainer(referenceTimeInMs); for (StatsReportType reportType : statsReportTypes) { switch (reportType) { case ACCOUNT_REPORT: statsSnapshotsByType.put(StatsReportType.ACCOUNT_REPORT, convertStoreUsageToAccountStatsSnapshot(utilizationMap)); break; case PARTITION_CLASS_REPORT: statsSnapshotsByType.put(StatsReportType.PARTITION_CLASS_REPORT, convertStoreUsageToContainerStatsSnapshot(utilizationMap)); break; default: logger.error("Unrecognized stats report type: {}", reportType); } } return statsSnapshotsByType; } BlobStoreStats(String storeId, PersistentIndex index, int bucketCount, long bucketSpanTimeInMs,
      long logSegmentForecastOffsetMs, long queueProcessingPeriodInMs, long waitTimeoutInSecs,
      boolean enableBucketForLogSegmentReports, Time time, ScheduledExecutorService longLiveTaskScheduler,
      ScheduledExecutorService shortLiveTaskScheduler, DiskIOScheduler diskIOScheduler, StoreMetrics metrics); @Override Pair<Long, Long> getValidSize(TimeRange timeRange); @Override Map<StatsReportType, StatsSnapshot> getStatsSnapshots(Set<StatsReportType> statsReportTypes,
      long referenceTimeInMs); @Override void close();  }