@Test public void testFlushTimer() { Span span = tracer.buildSpan("happy-path").start(); dispatcher.dispatch(span); Awaitility.await() .atMost(flushInterval * 2, TimeUnit.MILLISECONDS) .until(() -> client.getFlushedSpans().size() > 0); Assert.assertEquals(0, client.getReceivedSpans().size()); Assert.assertEquals(1, client.getFlushedSpans().size()); Assert.assertEquals(1, client.getTotalSpans().size()); }
@Override public void dispatch(Span span) { try (Sample timer = dispatchTimer.start()) { if (running.get()) { final boolean accepted = acceptQueue.offer(span); if (!accepted) { dispatchRejectedCounter.increment(); LOGGER.warn("Send queue is rejecting new spans"); } } else { dispatchRejectedCounter.increment(); LOGGER.warn("Dispatcher is shutting down and queue is now rejecting new spans"); } } }
RemoteDispatcher implements Dispatcher { @Override public void dispatch(Span span) { try (Sample timer = dispatchTimer.start()) { if (running.get()) { final boolean accepted = acceptQueue.offer(span); if (!accepted) { dispatchRejectedCounter.increment(); LOGGER.warn("Send queue is rejecting new spans"); } } else { dispatchRejectedCounter.increment(); LOGGER.warn("Dispatcher is shutting down and queue is now rejecting new spans"); } } } }
RemoteDispatcher implements Dispatcher { @Override public void dispatch(Span span) { try (Sample timer = dispatchTimer.start()) { if (running.get()) { final boolean accepted = acceptQueue.offer(span); if (!accepted) { dispatchRejectedCounter.increment(); LOGGER.warn("Send queue is rejecting new spans"); } } else { dispatchRejectedCounter.increment(); LOGGER.warn("Dispatcher is shutting down and queue is now rejecting new spans"); } } } RemoteDispatcher(Metrics metrics, Client client, BlockingQueue<Span> queue, long flushInterval, long shutdownTimeout, ScheduledExecutorService executor); }
RemoteDispatcher implements Dispatcher { @Override public void dispatch(Span span) { try (Sample timer = dispatchTimer.start()) { if (running.get()) { final boolean accepted = acceptQueue.offer(span); if (!accepted) { dispatchRejectedCounter.increment(); LOGGER.warn("Send queue is rejecting new spans"); } } else { dispatchRejectedCounter.increment(); LOGGER.warn("Dispatcher is shutting down and queue is now rejecting new spans"); } } } RemoteDispatcher(Metrics metrics, Client client, BlockingQueue<Span> queue, long flushInterval, long shutdownTimeout, ScheduledExecutorService executor); @Override String toString(); @Override void dispatch(Span span); @Override void close(); @Override void flush(); }
RemoteDispatcher implements Dispatcher { @Override public void dispatch(Span span) { try (Sample timer = dispatchTimer.start()) { if (running.get()) { final boolean accepted = acceptQueue.offer(span); if (!accepted) { dispatchRejectedCounter.increment(); LOGGER.warn("Send queue is rejecting new spans"); } } else { dispatchRejectedCounter.increment(); LOGGER.warn("Dispatcher is shutting down and queue is now rejecting new spans"); } } } RemoteDispatcher(Metrics metrics, Client client, BlockingQueue<Span> queue, long flushInterval, long shutdownTimeout, ScheduledExecutorService executor); @Override String toString(); @Override void dispatch(Span span); @Override void close(); @Override void flush();  }