@Test public void testConstantTimeRate() throws Exception { SortedMapIterator source = new SortedMapIterator(table); RateIterator iter = new RateIterator(); IteratorSetting settings = new IteratorSetting(100, RateIterator.class); iter.init(source, settings.getOptions(), SCAN_IE); iter.seek(new Range(), EMPTY_COL_FAMS, true); for (int i = 0; i < 99; i++) { assertTrue(iter.hasTop()); assertEquals(0.001D, MetricAdapter.decodeValue(iter.getTopValue().get()), 0.0D); iter.next(); } assertFalse(iter.hasTop()); }
@Override public void init(SortedKeyValueIterator<Key, Value> source, Map<String, String> options, IteratorEnvironment env) throws IOException { if (options.containsKey(COUNTER_MAX)) { this.isCounter = true; this.maxCounter = Long.parseLong(options.get(COUNTER_MAX)); this.resetValue = Long.parseLong(options.get(RATE_RESET_VALUE)); LOG.trace("Setting rate counter options cm:{}, rv:{}", this.maxCounter, this.resetValue); } Map<String, String> opts = new HashMap<>(options); opts.put(TimeSeriesGroupingIterator.FILTER, "-1,1"); super.init(source, opts, env); }
RateIterator extends TimeSeriesGroupingIterator { @Override public void init(SortedKeyValueIterator<Key, Value> source, Map<String, String> options, IteratorEnvironment env) throws IOException { if (options.containsKey(COUNTER_MAX)) { this.isCounter = true; this.maxCounter = Long.parseLong(options.get(COUNTER_MAX)); this.resetValue = Long.parseLong(options.get(RATE_RESET_VALUE)); LOG.trace("Setting rate counter options cm:{}, rv:{}", this.maxCounter, this.resetValue); } Map<String, String> opts = new HashMap<>(options); opts.put(TimeSeriesGroupingIterator.FILTER, "-1,1"); super.init(source, opts, env); } }
RateIterator extends TimeSeriesGroupingIterator { @Override public void init(SortedKeyValueIterator<Key, Value> source, Map<String, String> options, IteratorEnvironment env) throws IOException { if (options.containsKey(COUNTER_MAX)) { this.isCounter = true; this.maxCounter = Long.parseLong(options.get(COUNTER_MAX)); this.resetValue = Long.parseLong(options.get(RATE_RESET_VALUE)); LOG.trace("Setting rate counter options cm:{}, rv:{}", this.maxCounter, this.resetValue); } Map<String, String> opts = new HashMap<>(options); opts.put(TimeSeriesGroupingIterator.FILTER, "-1,1"); super.init(source, opts, env); }  }
RateIterator extends TimeSeriesGroupingIterator { @Override public void init(SortedKeyValueIterator<Key, Value> source, Map<String, String> options, IteratorEnvironment env) throws IOException { if (options.containsKey(COUNTER_MAX)) { this.isCounter = true; this.maxCounter = Long.parseLong(options.get(COUNTER_MAX)); this.resetValue = Long.parseLong(options.get(RATE_RESET_VALUE)); LOG.trace("Setting rate counter options cm:{}, rv:{}", this.maxCounter, this.resetValue); } Map<String, String> opts = new HashMap<>(options); opts.put(TimeSeriesGroupingIterator.FILTER, "-1,1"); super.init(source, opts, env); }  static void setRateOptions(IteratorSetting is, QueryRequest.RateOption options); @Override void init(SortedKeyValueIterator<Key, Value> source, Map<String, String> options, IteratorEnvironment env); }
RateIterator extends TimeSeriesGroupingIterator { @Override public void init(SortedKeyValueIterator<Key, Value> source, Map<String, String> options, IteratorEnvironment env) throws IOException { if (options.containsKey(COUNTER_MAX)) { this.isCounter = true; this.maxCounter = Long.parseLong(options.get(COUNTER_MAX)); this.resetValue = Long.parseLong(options.get(RATE_RESET_VALUE)); LOG.trace("Setting rate counter options cm:{}, rv:{}", this.maxCounter, this.resetValue); } Map<String, String> opts = new HashMap<>(options); opts.put(TimeSeriesGroupingIterator.FILTER, "-1,1"); super.init(source, opts, env); }  static void setRateOptions(IteratorSetting is, QueryRequest.RateOption options); @Override void init(SortedKeyValueIterator<Key, Value> source, Map<String, String> options, IteratorEnvironment env); static final Logger LOG; }