@Test public void logsWhenEmpty() { storageConsumer.accept(Collections.emptyList()); assertThat(logger.lines()) .extracting("level", "text") .containsExactly(tuple(LogLevel.DebugLevel, "Input was empty")); }
@Override public final void accept(Iterable<Span> spansSharingId) { List<Span> list = asList(spansSharingId); if (list.isEmpty()) { log().debug("Input was empty"); return; } CallbackCaptor<Void> blockingCallback = new CallbackCaptor<>(); try { get().asyncSpanConsumer().accept(list, blockingCallback); blockingCallback.get(); log().debug("Wrote {} spans", list.size()); } catch (RuntimeException e) { Throwable toLog = e.getClass().equals(RuntimeException.class) && e.getCause() != null ? e.getCause() : e; String message = "Dropped " + list.size() + " spans: " + toLog.getMessage(); if (log().isWarnEnabled()) { log().warn(message, toLog); } else { log().warn(message); } } }
StorageConsumer implements Consumer, Component { @Override public final void accept(Iterable<Span> spansSharingId) { List<Span> list = asList(spansSharingId); if (list.isEmpty()) { log().debug("Input was empty"); return; } CallbackCaptor<Void> blockingCallback = new CallbackCaptor<>(); try { get().asyncSpanConsumer().accept(list, blockingCallback); blockingCallback.get(); log().debug("Wrote {} spans", list.size()); } catch (RuntimeException e) { Throwable toLog = e.getClass().equals(RuntimeException.class) && e.getCause() != null ? e.getCause() : e; String message = "Dropped " + list.size() + " spans: " + toLog.getMessage(); if (log().isWarnEnabled()) { log().warn(message, toLog); } else { log().warn(message); } } } }
StorageConsumer implements Consumer, Component { @Override public final void accept(Iterable<Span> spansSharingId) { List<Span> list = asList(spansSharingId); if (list.isEmpty()) { log().debug("Input was empty"); return; } CallbackCaptor<Void> blockingCallback = new CallbackCaptor<>(); try { get().asyncSpanConsumer().accept(list, blockingCallback); blockingCallback.get(); log().debug("Wrote {} spans", list.size()); } catch (RuntimeException e) { Throwable toLog = e.getClass().equals(RuntimeException.class) && e.getCause() != null ? e.getCause() : e; String message = "Dropped " + list.size() + " spans: " + toLog.getMessage(); if (log().isWarnEnabled()) { log().warn(message, toLog); } else { log().warn(message); } } }  }
StorageConsumer implements Consumer, Component { @Override public final void accept(Iterable<Span> spansSharingId) { List<Span> list = asList(spansSharingId); if (list.isEmpty()) { log().debug("Input was empty"); return; } CallbackCaptor<Void> blockingCallback = new CallbackCaptor<>(); try { get().asyncSpanConsumer().accept(list, blockingCallback); blockingCallback.get(); log().debug("Wrote {} spans", list.size()); } catch (RuntimeException e) { Throwable toLog = e.getClass().equals(RuntimeException.class) && e.getCause() != null ? e.getCause() : e; String message = "Dropped " + list.size() + " spans: " + toLog.getMessage(); if (log().isWarnEnabled()) { log().warn(message, toLog); } else { log().warn(message); } } }  @Override final void accept(Iterable<Span> spansSharingId); @Override CheckResult check(); @Override final void close(); }
StorageConsumer implements Consumer, Component { @Override public final void accept(Iterable<Span> spansSharingId) { List<Span> list = asList(spansSharingId); if (list.isEmpty()) { log().debug("Input was empty"); return; } CallbackCaptor<Void> blockingCallback = new CallbackCaptor<>(); try { get().asyncSpanConsumer().accept(list, blockingCallback); blockingCallback.get(); log().debug("Wrote {} spans", list.size()); } catch (RuntimeException e) { Throwable toLog = e.getClass().equals(RuntimeException.class) && e.getCause() != null ? e.getCause() : e; String message = "Dropped " + list.size() + " spans: " + toLog.getMessage(); if (log().isWarnEnabled()) { log().warn(message, toLog); } else { log().warn(message); } } }  @Override final void accept(Iterable<Span> spansSharingId); @Override CheckResult check(); @Override final void close();  }