use of com.megaease.easeagent.plugin.api.trace.Span in project easeagent by megaease.
the class MessagingTracingImplTest method producerExtractor.
@Test
public void producerExtractor() {
Span span = messagingTracing.producerSpan(new MessagingRequestMock().setOperation(operation).setChannelKind(channelKind).setChannelName(channelName));
MessagingRequestMock messagingRequestMock = new MessagingRequestMock();
messagingTracing.producerInjector().inject(span, messagingRequestMock);
Message message = messagingTracing.producerExtractor().extract(messagingRequestMock);
check(span, message);
Span span2 = messagingTracing.consumerSpan(new MessagingRequestMock().setOperation(operation).setChannelKind(channelKind).setChannelName(channelName));
MessagingRequestMock messagingRequestMock2 = new MessagingRequestMock();
messagingTracing.consumerInjector().inject(span2, messagingRequestMock2);
Message message2 = messagingTracing.consumerExtractor().extract(messagingRequestMock2);
check(span2, message2);
}
use of com.megaease.easeagent.plugin.api.trace.Span in project easeagent by megaease.
the class MessagingTracingImplTest method consumerSpan.
@Test
public void consumerSpan() {
Span span = messagingTracing.consumerSpan(new MessagingRequestMock().setOperation(operation).setChannelKind(channelKind).setChannelName(channelName));
assertFalse(span.isNoop());
MutableSpan state = AgentFieldReflectAccessor.getFieldValue(span.unwrap(), "state");
assertNotNull(state);
checkTag(state);
span = messagingTracing.producerSpan(new MessagingRequestMock().setOperation(operation).setChannelKind(channelKind).setChannelName(channelName));
MessagingRequestMock messagingRequestMock = new MessagingRequestMock();
messagingTracing.producerInjector().inject(span, messagingRequestMock);
MessagingRequestMock request1 = new MessagingRequestMock();
request1.setHeaders(messagingRequestMock.getHeaders());
Span newSpan1 = messagingTracing.consumerSpan(request1);
assertEquals(span.traceIdString(), newSpan1.traceIdString());
assertNotEquals(span.spanIdString(), newSpan1.spanIdString());
MessagingRequestMock request2 = new MessagingRequestMock();
request2.setHeaders(messagingRequestMock.getHeaders());
Span newSpan2 = messagingTracing.consumerSpan(request1);
assertEquals(span.traceIdString(), newSpan2.traceIdString());
assertNotEquals(span.spanIdString(), newSpan2.spanIdString());
assertNotEquals(newSpan1.spanIdString(), newSpan2.spanIdString());
}
use of com.megaease.easeagent.plugin.api.trace.Span in project easeagent by megaease.
the class MessagingTracingImplTest method consumerSampler.
@Test
public void consumerSampler() {
Span span = messagingTracing.consumerSpan(new MessagingRequestMock().setOperation(operation).setChannelKind(channelKind).setChannelName(channelName));
MessagingRequestMock messagingRequestMock = new MessagingRequestMock();
messagingTracing.consumerInjector().inject(span, messagingRequestMock);
assertNull(messagingTracing.consumerSampler().apply(messagingRequestMock));
}
use of com.megaease.easeagent.plugin.api.trace.Span in project easeagent by megaease.
the class MessagingTracingImplTest method consumerInjector.
@Test
public void consumerInjector() {
Span span = messagingTracing.consumerSpan(new MessagingRequestMock().setOperation(operation).setChannelKind(channelKind).setChannelName(channelName));
MessagingRequestMock messagingRequestMock = new MessagingRequestMock();
messagingTracing.consumerInjector().inject(span, messagingRequestMock);
assertTrue(messagingRequestMock.getHeaders().size() > 0);
assertEquals(1, messagingRequestMock.getHeaders().size());
assertNotNull(messagingRequestMock.header(MESSAGE_B3_HEADER_NAME));
assertTrue(messagingRequestMock.header(MESSAGE_B3_HEADER_NAME).contains(span.traceIdString()));
}
use of com.megaease.easeagent.plugin.api.trace.Span in project easeagent by megaease.
the class MessagingTracingImplTest method consumerExtractor.
@Test
public void consumerExtractor() {
Span span = messagingTracing.consumerSpan(new MessagingRequestMock().setOperation(operation).setChannelKind(channelKind).setChannelName(channelName));
MessagingRequestMock messagingRequestMock = new MessagingRequestMock();
messagingTracing.consumerInjector().inject(span, messagingRequestMock);
Message message = messagingTracing.consumerExtractor().extract(messagingRequestMock);
check(span, message);
}
Aggregations