@Test public void testExtrapolationAdjacentAvgAtMiddle() { RawMetricValues rawValues = new RawMetricValues(NUM_WINDOWS_TO_KEEP, MIN_SAMPLES_PER_WINDOW, NUM_RAW_METRICS); prepareWindowMissingAtIndex(rawValues, 1); ValuesAndExtrapolations valuesAndExtrapolations = aggregate(rawValues, allWindowIndices(0)); assertEquals(11.5, valuesAndExtrapolations.metricValues().valuesFor((short) 0).get(1), EPSILON); assertEquals(13.0, valuesAndExtrapolations.metricValues().valuesFor((short) 1).get(1), EPSILON); assertEquals(13.0, valuesAndExtrapolations.metricValues().valuesFor((short) 2).get(1), EPSILON); assertEquals(1, valuesAndExtrapolations.extrapolations().size()); Assert.assertEquals(Extrapolation.AVG_ADJACENT, valuesAndExtrapolations.extrapolations().get(1)); }
public synchronized ValuesAndExtrapolations aggregate(SortedSet<Long> windowIndices, MetricDef metricDef) { return aggregate(windowIndices, metricDef, true); }
RawMetricValues extends WindowIndexedArrays { public synchronized ValuesAndExtrapolations aggregate(SortedSet<Long> windowIndices, MetricDef metricDef) { return aggregate(windowIndices, metricDef, true); } }
RawMetricValues extends WindowIndexedArrays { public synchronized ValuesAndExtrapolations aggregate(SortedSet<Long> windowIndices, MetricDef metricDef) { return aggregate(windowIndices, metricDef, true); } RawMetricValues(int numWindowsToKeep, byte minSamplesPerWindow, int numMetricTypesInSample); }
RawMetricValues extends WindowIndexedArrays { public synchronized ValuesAndExtrapolations aggregate(SortedSet<Long> windowIndices, MetricDef metricDef) { return aggregate(windowIndices, metricDef, true); } RawMetricValues(int numWindowsToKeep, byte minSamplesPerWindow, int numMetricTypesInSample); synchronized void addSample(MetricSample<?, ?> sample, long windowIndex, MetricDef metricDef); synchronized void updateOldestWindowIndex(long newOldestWindowIndex); synchronized boolean isValid(int maxAllowedWindowsWithExtrapolation); synchronized int numWindowsWithExtrapolation(); synchronized boolean isValidAtWindowIndex(long windowIndex); synchronized boolean isExtrapolatedAtWindowIndex(long windowIndex); synchronized byte sampleCountsAtWindowIndex(long windowIndex); synchronized void sanityCheckWindowIndex(long windowIndex); synchronized void sanityCheckWindowRangeReset(long startingWindowIndex, int numWindowIndicesToReset); synchronized int resetWindowIndices(long startingWindowIndex, int numWindowIndicesToReset); synchronized ValuesAndExtrapolations aggregate(SortedSet<Long> windowIndices, MetricDef metricDef); synchronized ValuesAndExtrapolations peekCurrentWindow(long currentWindowIndex, MetricDef metricDef); synchronized int numSamples(); }
RawMetricValues extends WindowIndexedArrays { public synchronized ValuesAndExtrapolations aggregate(SortedSet<Long> windowIndices, MetricDef metricDef) { return aggregate(windowIndices, metricDef, true); } RawMetricValues(int numWindowsToKeep, byte minSamplesPerWindow, int numMetricTypesInSample); synchronized void addSample(MetricSample<?, ?> sample, long windowIndex, MetricDef metricDef); synchronized void updateOldestWindowIndex(long newOldestWindowIndex); synchronized boolean isValid(int maxAllowedWindowsWithExtrapolation); synchronized int numWindowsWithExtrapolation(); synchronized boolean isValidAtWindowIndex(long windowIndex); synchronized boolean isExtrapolatedAtWindowIndex(long windowIndex); synchronized byte sampleCountsAtWindowIndex(long windowIndex); synchronized void sanityCheckWindowIndex(long windowIndex); synchronized void sanityCheckWindowRangeReset(long startingWindowIndex, int numWindowIndicesToReset); synchronized int resetWindowIndices(long startingWindowIndex, int numWindowIndicesToReset); synchronized ValuesAndExtrapolations aggregate(SortedSet<Long> windowIndices, MetricDef metricDef); synchronized ValuesAndExtrapolations peekCurrentWindow(long currentWindowIndex, MetricDef metricDef); synchronized int numSamples();  }