use of brave.handler.MutableSpan in project brave by openzipkin.
the class ITSpringRabbitTracing method propagates_trace_info_across_amqp_from_producer.
@Test
public void propagates_trace_info_across_amqp_from_producer() {
produceMessage();
awaitMessageConsumed();
MutableSpan producerSpan = producerSpanHandler.takeRemoteSpan(PRODUCER);
assertThat(producerSpan.parentId()).isNull();
MutableSpan consumerSpan = consumerSpanHandler.takeRemoteSpan(CONSUMER);
assertChildOf(consumerSpan, producerSpan);
MutableSpan listenerSpan = consumerSpanHandler.takeLocalSpan();
assertChildOf(listenerSpan, consumerSpan);
}
use of brave.handler.MutableSpan in project brave by openzipkin.
the class ITSpringRabbitTracing method creates_dependency_links.
@Test
public void creates_dependency_links() {
produceMessage();
awaitMessageConsumed();
MutableSpan producerSpan = producerSpanHandler.takeRemoteSpan(PRODUCER);
MutableSpan consumerSpan = consumerSpanHandler.takeRemoteSpan(CONSUMER);
assertThat(producerSpan.localServiceName()).isEqualTo("producer");
assertThat(producerSpan.remoteServiceName()).isEqualTo("rabbitmq");
assertThat(consumerSpan.remoteServiceName()).isEqualTo("rabbitmq");
assertThat(consumerSpan.localServiceName()).isEqualTo("consumer");
consumerSpanHandler.takeLocalSpan();
}
use of brave.handler.MutableSpan in project brave by openzipkin.
the class ITSpringRabbitTracing method traceContinuesToReply.
@Test
public void traceContinuesToReply() {
produceUntracedMessage(TEST_EXCHANGE_REQUEST_REPLY, binding_request);
awaitReplyMessageConsumed();
MutableSpan requestConsumerSpan = consumerSpanHandler.takeRemoteSpan(CONSUMER);
MutableSpan replyProducerSpan = consumerSpanHandler.takeRemoteSpan(PRODUCER);
MutableSpan requestListenerSpan = consumerSpanHandler.takeLocalSpan();
MutableSpan replyConsumerSpan = consumerSpanHandler.takeRemoteSpan(CONSUMER);
MutableSpan replyListenerSpan = consumerSpanHandler.takeLocalSpan();
assertThat(requestConsumerSpan.parentId()).isNull();
assertThat(requestListenerSpan.parentId()).isEqualTo(requestConsumerSpan.id());
assertThat(replyProducerSpan.parentId()).isEqualTo(requestListenerSpan.id());
assertThat(replyConsumerSpan.parentId()).isEqualTo(replyProducerSpan.id());
assertThat(replyListenerSpan.parentId()).isEqualTo(replyConsumerSpan.id());
assertThat(Arrays.asList(requestListenerSpan, replyProducerSpan, replyConsumerSpan, replyListenerSpan)).extracting(MutableSpan::traceId).containsOnly(requestConsumerSpan.traceId());
}
use of brave.handler.MutableSpan in project brave by openzipkin.
the class ITTracingFilter_Consumer method setsError_onUnimplemented.
@Test
public void setsError_onUnimplemented() {
assertThatThrownBy(() -> wrongClient.get().sayHello("jorge")).isInstanceOf(RpcException.class);
MutableSpan span = testSpanHandler.takeRemoteSpanWithErrorMessage(CLIENT, ".*Not found exported service.*");
assertThat(span.tags()).containsEntry("dubbo.error_code", "1");
}
use of brave.handler.MutableSpan in project brave by openzipkin.
the class IntegrationTestSpanHandler method doTakeSpan.
MutableSpan doTakeSpan(boolean flushed) {
MutableSpan result;
try {
// Same rationale as ITRemote: tests should never take 5s in normal circumstances.
// However, @SpringBootTest with web environment and a lot in the classpath can take >3s
result = spans.poll(10, TimeUnit.SECONDS);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new AssertionError(e);
}
assertThat(result).withFailMessage("Timeout waiting for span").isNotNull();
assertThat(result.containsAnnotation("brave.flush")).withFailMessage("Orphaned span found: %s\n" + "Look for code missing span.flush() or span.finish().", result).isFalse();
assertThat(result.startTimestamp()).withFailMessage("Expected a startTimestamp: %s\n" + "Look for code missing span.start().", result).isNotZero();
if (flushed) {
assertThat(result.finishTimestamp()).withFailMessage("Expected no finishTimestamp: %s", result).isZero();
} else {
assertThat(result.finishTimestamp()).withFailMessage("Expected a finishTimestamp: %s", result).isNotZero();
}
return result;
}
Aggregations