RemoteReporter implements Reporter { @Override public void report(JaegerSpan span) { boolean added = commandQueue.offer(new AppendCommand(span)); if (!added) { metrics.reporterDropped.inc(1); } } 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; }
@Test public void testRemoteReporterReport() { JaegerSpan span = tracer.buildSpan("raza").start(); reporter.report(span); await() .with() .pollInterval(1, TimeUnit.MILLISECONDS) .atMost(flushInterval + 20, TimeUnit.MILLISECONDS) .until(() -> sender.getReceived().size() > 0); List<JaegerSpan> received = sender.getReceived(); assertEquals(1, received.size()); }
@Test public void testAppendWhenQueueFull() { sender.permitAppend(0); for (int i = 0; i < maxQueueSize; i++) { reporter.report(newSpan()); } reporter.report(newSpan()); reporter.report(newSpan()); long droppedCount = metricsFactory.getCounter("jaeger_tracer_reporter_spans", "result=dropped"); assertThat(droppedCount, anyOf(equalTo(1L), equalTo(2L))); }