@Test public void testAddSamplesWithLargeInterval() { MetricSampleAggregator<String, IntegerEntity> aggregator = new MetricSampleAggregator<>(NUM_WINDOWS, WINDOW_MS, MIN_SAMPLES_PER_WINDOW, 0, _metricDef); CruiseControlUnitTestUtils.populateSampleAggregator(NUM_WINDOWS + 1, MIN_SAMPLES_PER_WINDOW, aggregator, ENTITY1, 0, WINDOW_MS, _metricDef); CruiseControlUnitTestUtils.populateSampleAggregator(NUM_WINDOWS, MIN_SAMPLES_PER_WINDOW, aggregator, ENTITY1, 4 * NUM_WINDOWS, WINDOW_MS, _metricDef); List<Long> availableWindows = aggregator.availableWindows(); assertEquals(NUM_WINDOWS, availableWindows.size()); for (int i = 0; i < NUM_WINDOWS; i++) { assertEquals((i + 4 * NUM_WINDOWS) * WINDOW_MS, availableWindows.get(i).longValue()); } }
public List<Long> availableWindows() { return getWindowList(_oldestWindowIndex, _currentWindowIndex - 1); }
MetricSampleAggregator extends LongGenerationed { public List<Long> availableWindows() { return getWindowList(_oldestWindowIndex, _currentWindowIndex - 1); } }
MetricSampleAggregator extends LongGenerationed { public List<Long> availableWindows() { return getWindowList(_oldestWindowIndex, _currentWindowIndex - 1); } MetricSampleAggregator(int numWindows,
                                long windowMs,
                                byte minSamplesPerWindow,
                                int completenessCacheSize,
                                MetricDef metricDef); }
MetricSampleAggregator extends LongGenerationed { public List<Long> availableWindows() { return getWindowList(_oldestWindowIndex, _currentWindowIndex - 1); } MetricSampleAggregator(int numWindows,
                                long windowMs,
                                byte minSamplesPerWindow,
                                int completenessCacheSize,
                                MetricDef metricDef); boolean addSample(MetricSample<G, E> sample); MetricSampleAggregationResult<G, E> aggregate(long from, long to, AggregationOptions<G, E> options); Map<E, ValuesAndExtrapolations> peekCurrentWindow(); MetricSampleCompleteness<G, E> completeness(long from, long to, AggregationOptions<G, E> options); List<Long> availableWindows(); int numAvailableWindows(); int numAvailableWindows(long from, long to); List<Long> allWindows(); Long earliestWindow(); int numSamples(); void retainEntities(Set<E> entities); void removeEntities(Set<E> entities); void retainEntityGroup(Set<G> entityGroups); void removeEntityGroup(Set<G> entityGroups); void clear(); long monitoringPeriodMs(); }
MetricSampleAggregator extends LongGenerationed { public List<Long> availableWindows() { return getWindowList(_oldestWindowIndex, _currentWindowIndex - 1); } MetricSampleAggregator(int numWindows,
                                long windowMs,
                                byte minSamplesPerWindow,
                                int completenessCacheSize,
                                MetricDef metricDef); boolean addSample(MetricSample<G, E> sample); MetricSampleAggregationResult<G, E> aggregate(long from, long to, AggregationOptions<G, E> options); Map<E, ValuesAndExtrapolations> peekCurrentWindow(); MetricSampleCompleteness<G, E> completeness(long from, long to, AggregationOptions<G, E> options); List<Long> availableWindows(); int numAvailableWindows(); int numAvailableWindows(long from, long to); List<Long> allWindows(); Long earliestWindow(); int numSamples(); void retainEntities(Set<E> entities); void removeEntities(Set<E> entities); void retainEntityGroup(Set<G> entityGroups); void removeEntityGroup(Set<G> entityGroups); void clear(); long monitoringPeriodMs();  }