use of zipkin2.collector.scribe.generated.LogEntry in project zipkin by openzipkin.
the class ScribeSpanConsumerTest method entriesWithoutSpansAreSkipped.
@Test
void entriesWithoutSpansAreSkipped() throws Exception {
SpanConsumer consumer = (callback) -> {
// as we shouldn't get here.
throw new AssertionError();
};
ScribeSpanConsumer scribe = newScribeSpanConsumer("zipkin", consumer);
LogEntry entry = new LogEntry();
entry.category = "notzipkin";
entry.message = "hello world";
expectSuccess(scribe, entry);
// Storage finishes after callback so wait for it.
await().untilAsserted(() -> assertThat(scribeMetrics.messages()).isEqualTo(1));
assertThat(scribeMetrics.messagesDropped()).isZero();
assertThat(scribeMetrics.bytes()).isZero();
assertThat(scribeMetrics.spans()).isZero();
assertThat(scribeMetrics.spansDropped()).isZero();
}
use of zipkin2.collector.scribe.generated.LogEntry in project zipkin by openzipkin.
the class ScribeSpanConsumerTest method consumerExceptionBeforeCallbackDoesntSetFutureException.
@Test
void consumerExceptionBeforeCallbackDoesntSetFutureException() {
consumer = (input) -> {
throw new NullPointerException("endpoint was null");
};
ScribeSpanConsumer scribe = newScribeSpanConsumer("zipkin", consumer);
LogEntry entry = new LogEntry();
entry.category = "zipkin";
entry.message = encodedSpan;
CaptureAsyncMethodCallback callback = new CaptureAsyncMethodCallback();
scribe.Log(asList(entry), callback);
// Storage related exceptions are not propagated to the caller. Only marshalling ones are.
assertThat(callback.error).isNull();
// Storage finishes after callback so wait for it.
await().untilAsserted(() -> assertThat(scribeMetrics.messages()).isEqualTo(1));
assertThat(scribeMetrics.messagesDropped()).isZero();
assertThat(scribeMetrics.bytes()).isEqualTo(bytes.length);
assertThat(scribeMetrics.spans()).isEqualTo(1);
assertThat(scribeMetrics.spansDropped()).isEqualTo(1);
}
use of zipkin2.collector.scribe.generated.LogEntry in project zipkin by openzipkin.
the class ScribeSpanConsumerTest method malformedDataIsDropped.
@Test
void malformedDataIsDropped() {
ScribeSpanConsumer scribe = newScribeSpanConsumer("zipkin", consumer);
LogEntry entry = new LogEntry();
entry.category = "zipkin";
entry.message = "notbase64";
CaptureAsyncMethodCallback callback = new CaptureAsyncMethodCallback();
scribe.Log(asList(entry), callback);
assertThat(callback.error).isInstanceOf(IllegalArgumentException.class);
// Storage finishes after callback so wait for it.
await().untilAsserted(() -> assertThat(scribeMetrics.messages()).isEqualTo(1));
assertThat(scribeMetrics.messagesDropped()).isEqualTo(1);
assertThat(scribeMetrics.bytes()).isZero();
assertThat(scribeMetrics.spans()).isZero();
assertThat(scribeMetrics.spansDropped()).isZero();
}
use of zipkin2.collector.scribe.generated.LogEntry in project zipkin by openzipkin.
the class ScribeSpanConsumerTest method decodesSpanGeneratedByFinagle.
/**
* Finagle's zipkin tracer breaks on a column width with a trailing newline
*/
@Test
void decodesSpanGeneratedByFinagle() throws Exception {
LogEntry entry = new LogEntry();
entry.category = "zipkin";
entry.message = "" + "CgABq/sBMnzE048LAAMAAAAOZ2V0VHJhY2VzQnlJZHMKAATN0p+4EGfTdAoABav7ATJ8xNOPDwAGDAAAAAQKAAEABR/wq+2DeAsAAgAAAAJzcgwAAwgAAX8AAAEGAAIkwwsAAwAAAAx6aXBraW4tcXVlcnkAAAoAAQAFH/Cr7zj4CwACAAAIAGFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYW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SpanConsumer(entry.category, consumer);
expectSuccess(scribe, entry);
// Storage finishes after callback so wait for it.
await().untilAsserted(() -> assertThat(storage.getTraces()).containsExactly(asList(v2)));
assertThat(scribeMetrics.messages()).isEqualTo(1);
assertThat(scribeMetrics.messagesDropped()).isZero();
assertThat(scribeMetrics.bytes()).isEqualTo(Base64.getMimeDecoder().decode(entry.message).length);
assertThat(scribeMetrics.spans()).isEqualTo(1);
assertThat(scribeMetrics.spansDropped()).isZero();
}
use of zipkin2.collector.scribe.generated.LogEntry in project zipkin by openzipkin.
the class ScribeSpanConsumerTest method callbackExceptionDoesntThrow.
/**
* Callbacks are performed asynchronously. If they throw, it hints that we are chaining futures
* when we shouldn't
*/
@Test
void callbackExceptionDoesntThrow() throws Exception {
consumer = (input) -> new Call.Base<Void>() {
@Override
protected Void doExecute() {
throw new AssertionError();
}
@Override
protected void doEnqueue(Callback<Void> callback) {
callback.onError(new NullPointerException());
}
@Override
public Call<Void> clone() {
throw new AssertionError();
}
};
ScribeSpanConsumer scribe = newScribeSpanConsumer("zipkin", consumer);
LogEntry entry = new LogEntry();
entry.category = "zipkin";
entry.message = encodedSpan;
expectSuccess(scribe, entry);
// Storage finishes after callback so wait for it.
await().untilAsserted(() -> assertThat(scribeMetrics.messages()).isEqualTo(1));
assertThat(scribeMetrics.messagesDropped()).isZero();
assertThat(scribeMetrics.bytes()).isEqualTo(bytes.length);
assertThat(scribeMetrics.spans()).isEqualTo(1);
assertThat(scribeMetrics.spansDropped()).isEqualTo(1);
}
Aggregations