@Test public void testFlushIsCalledOnSender() throws InterruptedException { CountDownLatch latch = new CountDownLatch(1); InMemorySender sender = new InMemorySender() { @Override public int flush() throws SenderException { latch.countDown(); return super.flush(); } }; RemoteReporter remoteReporter = new Builder() .withSender(sender) .withFlushInterval(flushInterval) .withMaxQueueSize(maxQueueSize) .withMetrics(metrics) .build(); tracer = new JaegerTracer.Builder("test-remote-reporter") .withReporter(remoteReporter) .withSampler(new ConstSampler(true)) .withMetrics(metrics) .build(); tracer.buildSpan("mySpan").start().finish(); remoteReporter.flush(); latch.await(); assertEquals("Should have called the custom sender flush", 0, latch.getCount()); assertEquals("mySpan", (sender.getReceived().get(0)).getOperationName()); }
void flush() { metrics.reporterQueueLength.update(commandQueue.size()); commandQueue.offer(new FlushCommand()); }
RemoteReporter implements Reporter { void flush() { metrics.reporterQueueLength.update(commandQueue.size()); commandQueue.offer(new FlushCommand()); } }
RemoteReporter implements Reporter { void flush() { metrics.reporterQueueLength.update(commandQueue.size()); commandQueue.offer(new FlushCommand()); } private  RemoteReporter(Sender sender, int flushInterval, int maxQueueSize, int closeEnqueueTimeout,
      Metrics metrics); }
RemoteReporter implements Reporter { void flush() { metrics.reporterQueueLength.update(commandQueue.size()); commandQueue.offer(new FlushCommand()); } private  RemoteReporter(Sender sender, int flushInterval, int maxQueueSize, int closeEnqueueTimeout,
      Metrics metrics); @Override void report(JaegerSpan span); @Override void close(); }
RemoteReporter implements Reporter { void flush() { metrics.reporterQueueLength.update(commandQueue.size()); commandQueue.offer(new FlushCommand()); } private  RemoteReporter(Sender sender, int flushInterval, int maxQueueSize, int closeEnqueueTimeout,
      Metrics metrics); @Override void report(JaegerSpan span); @Override void close(); static final int DEFAULT_FLUSH_INTERVAL_MS; static final int DEFAULT_MAX_QUEUE_SIZE; }