Collector { void handleStorageError(List<Span> spans, Throwable e, Callback<Void> callback) { metrics.incrementSpansDropped(spans.size()); handleError(e, () -> appendSpanIds(spans, new StringBuilder("Cannot store spans ")), callback); } Collector(Builder builder); static Builder newBuilder(Class<?> loggingClass); void accept(List<Span> spans, Callback<Void> callback); void accept(List<Span> spans, Callback<Void> callback, Executor executor); void acceptSpans(ByteBuffer encoded, SpanBytesDecoder decoder, Callback<Void> callback,
    Executor executor); void acceptSpans(byte[] serialized, Callback<Void> callback); void acceptSpans(
    byte[] serializedSpans, BytesDecoder<Span> decoder, Callback<Void> callback);  }
@Test public void errorAcceptingSpans_onErrorRejectedExecution() { RuntimeException error = new RejectedExecutionException("slow down"); collector.handleStorageError(TRACE, error, callback); verify(callback).onError(error); assertDebugLogIs( "Cannot store spans [1, 1, 2, ...] due to RejectedExecutionException(slow down)"); verify(metrics).incrementSpansDropped(4); }
@Test public void handleStorageError_onErrorWithMessage() { RuntimeException error = new IllegalArgumentException("no beer"); collector.handleStorageError(TRACE, error, callback); verify(callback).onError(error); assertDebugLogIs("Cannot store spans [1, 1, 2, ...] due to IllegalArgumentException(no beer)"); verify(metrics).incrementSpansDropped(4); }