BatchingPluginSink implements PluginSink { @Override public void sendMetric(final Metric metric) { if (filter != null && !filter.matchesMetric(metric)) { batchingStatistics.reportMetricsDroppedByFilter(1); return; } batchingStatistics.reportQueueSizeInc(1); queueToBatch(batch -> batch.metrics.add(metric)); } BatchingPluginSink(
        final long flushInterval, final Optional<Long> batchSizeLimit,
        final Optional<Long> maxPendingFlushes
    );  BatchingPluginSink(long flushInterval, long batchSizeLimit, long maxPendingFlushes); @Override void init(); @Override void sendMetric(final Metric metric); @Override void sendBatch(final com.spotify.ffwd.model.Batch b); @Override AsyncFuture<Void> start(); @Override AsyncFuture<Void> stop(); @Override boolean isReady(); static final long DEFAULT_BATCH_SIZE_LIMIT; static final long DEFAULT_MAX_PENDING_FLUSHES; }
@Test public void testSendMetric() { assertEquals(0, sink.nextBatch.size()); doNothing().when(sink).checkBatch(sink.nextBatch); sink.sendMetric(metric); assertEquals(1, sink.nextBatch.size()); verify(sink).checkBatch(sink.nextBatch); }