@Test public void testAmbryStatsReport() throws Exception { StatsManagerConfig config = new StatsManagerConfig(new VerifiableProperties(new Properties())); StatsManager testStatsManager = new StatsManager(new MockStorageManager(Collections.emptyMap(), new MockDataNodeId(Collections.singletonList(new Port(6667, PortType.PLAINTEXT)), Collections.singletonList("/tmp"), "DC1")), Collections.emptyList(), new MetricRegistry(), config, new MockTime(), null); AmbryStatsReport ambryStatsReport = new AmbryStatsReport(testStatsManager, AGGREGATE_INTERVAL_MINS, StatsReportType.ACCOUNT_REPORT); assertEquals("Mismatch in aggregation time interval", AGGREGATE_INTERVAL_MINS, ambryStatsReport.getAggregateIntervalInMinutes()); assertEquals("Mismatch in report name", "AccountReport", ambryStatsReport.getReportName()); assertEquals("Mismatch in stats field name", "AccountStats", ambryStatsReport.getStatsFieldName()); ambryStatsReport = new AmbryStatsReport(testStatsManager, AGGREGATE_INTERVAL_MINS, StatsReportType.PARTITION_CLASS_REPORT); assertEquals("Mismatch in aggregation time interval", AGGREGATE_INTERVAL_MINS, ambryStatsReport.getAggregateIntervalInMinutes()); assertEquals("Mismatch in report name", "PartitionClassReport", ambryStatsReport.getReportName()); assertEquals("Mismatch in stats field name", "PartitionClassStats", ambryStatsReport.getStatsFieldName()); }
AmbryStatsReport(StatsManager statsManager, long aggregatePeriodInMinutes, StatsReportType type) { this.statsManager = statsManager; this.aggregatePeriodInMinutes = aggregatePeriodInMinutes; String reportTypeStr = convertStatsReportTypeToProperString(type); reportName = reportTypeStr + REPORT_NAME_SUFFIX; statsFieldName = reportTypeStr + STATS_FIELD_SUFFIX; statsReportType = type; }
AmbryStatsReport extends HealthReportProvider implements AmbryHealthReport { AmbryStatsReport(StatsManager statsManager, long aggregatePeriodInMinutes, StatsReportType type) { this.statsManager = statsManager; this.aggregatePeriodInMinutes = aggregatePeriodInMinutes; String reportTypeStr = convertStatsReportTypeToProperString(type); reportName = reportTypeStr + REPORT_NAME_SUFFIX; statsFieldName = reportTypeStr + STATS_FIELD_SUFFIX; statsReportType = type; } }
AmbryStatsReport extends HealthReportProvider implements AmbryHealthReport { AmbryStatsReport(StatsManager statsManager, long aggregatePeriodInMinutes, StatsReportType type) { this.statsManager = statsManager; this.aggregatePeriodInMinutes = aggregatePeriodInMinutes; String reportTypeStr = convertStatsReportTypeToProperString(type); reportName = reportTypeStr + REPORT_NAME_SUFFIX; statsFieldName = reportTypeStr + STATS_FIELD_SUFFIX; statsReportType = type; } AmbryStatsReport(StatsManager statsManager, long aggregatePeriodInMinutes, StatsReportType type); }
AmbryStatsReport extends HealthReportProvider implements AmbryHealthReport { AmbryStatsReport(StatsManager statsManager, long aggregatePeriodInMinutes, StatsReportType type) { this.statsManager = statsManager; this.aggregatePeriodInMinutes = aggregatePeriodInMinutes; String reportTypeStr = convertStatsReportTypeToProperString(type); reportName = reportTypeStr + REPORT_NAME_SUFFIX; statsFieldName = reportTypeStr + STATS_FIELD_SUFFIX; statsReportType = type; } AmbryStatsReport(StatsManager statsManager, long aggregatePeriodInMinutes, StatsReportType type); @Override Map<String, String> getRecentHealthReport(); @Override String getReportName(); @Override String getStatsFieldName(); @Override StatsReportType getStatsReportType(); @Override long getAggregateIntervalInMinutes(); @Override void resetStats(); static String convertStatsReportTypeToProperString(StatsReportType type); }
AmbryStatsReport extends HealthReportProvider implements AmbryHealthReport { AmbryStatsReport(StatsManager statsManager, long aggregatePeriodInMinutes, StatsReportType type) { this.statsManager = statsManager; this.aggregatePeriodInMinutes = aggregatePeriodInMinutes; String reportTypeStr = convertStatsReportTypeToProperString(type); reportName = reportTypeStr + REPORT_NAME_SUFFIX; statsFieldName = reportTypeStr + STATS_FIELD_SUFFIX; statsReportType = type; } AmbryStatsReport(StatsManager statsManager, long aggregatePeriodInMinutes, StatsReportType type); @Override Map<String, String> getRecentHealthReport(); @Override String getReportName(); @Override String getStatsFieldName(); @Override StatsReportType getStatsReportType(); @Override long getAggregateIntervalInMinutes(); @Override void resetStats(); static String convertStatsReportTypeToProperString(StatsReportType type); static final String REPORT_NAME_SUFFIX; }