use of com.navercorp.pinpoint.common.server.bo.SpanEventBo in project pinpoint by naver.
the class GrpcSpanBinder method bindSpanEventBoList.
public List<SpanEventBo> bindSpanEventBoList(List<PSpanEvent> spanEventList) {
if (CollectionUtils.isEmpty(spanEventList)) {
return Collections.emptyList();
}
List<SpanEventBo> spanEventBoList = new ArrayList<>(spanEventList.size());
SpanEventBo prevSpanEvent = null;
for (PSpanEvent pSpanEvent : spanEventList) {
final SpanEventBo spanEventBo = buildSpanEventBo(pSpanEvent, prevSpanEvent);
spanEventBoList.add(spanEventBo);
prevSpanEvent = spanEventBo;
}
spanEventBoList.sort(SpanEventComparator.INSTANCE);
return spanEventBoList;
}
use of com.navercorp.pinpoint.common.server.bo.SpanEventBo in project pinpoint by naver.
the class SpanReader method accept.
public boolean accept(SpanVisitor spanVisitor) {
Objects.requireNonNull(spanVisitor, "spanVisitor");
if (CollectionUtils.isEmpty(spanBoList)) {
return SpanVisitor.REJECT;
}
for (SpanBo spanBo : spanBoList) {
if (spanVisitor.visit(spanBo)) {
return SpanVisitor.ACCEPT;
}
final List<SpanEventBo> spanEventBoList = spanBo.getSpanEventBoList();
if (visitSpanEventList(spanVisitor, spanEventBoList)) {
return SpanVisitor.ACCEPT;
}
List<SpanChunkBo> spanChunkBoList = spanBo.getSpanChunkBoList();
if (CollectionUtils.hasLength(spanChunkBoList)) {
for (SpanChunkBo spanChunkBo : spanChunkBoList) {
if (spanVisitor.visit(spanChunkBo)) {
return SpanVisitor.ACCEPT;
}
List<SpanEventBo> spanChunkEventBoList = spanChunkBo.getSpanEventBoList();
if (visitSpanEventList(spanVisitor, spanChunkEventBoList)) {
return SpanVisitor.ACCEPT;
}
}
}
}
return SpanVisitor.REJECT;
}
use of com.navercorp.pinpoint.common.server.bo.SpanEventBo in project pinpoint by naver.
the class WasToUnknownFilter method include.
public boolean include(LinkContext spanContainer) {
/*
* WAS -> UNKNOWN
*/
final List<SpanBo> fromNode = spanContainer.findFromNode();
if (!rpcUrlFilter.accept(fromNode)) {
return false;
}
SpanAcceptor acceptor = new SpanReader(fromNode);
return acceptor.accept(new SpanEventVisitor() {
@Override
public boolean visit(SpanEventBo spanEventBo) {
return filter(spanEventBo, spanContainer);
}
});
}
use of com.navercorp.pinpoint.common.server.bo.SpanEventBo in project pinpoint by naver.
the class LinkFilterTest method wasToQueueFilter.
@Test
public void wasToQueueFilter() {
final ServiceType tomcat = serviceTypeRegistryService.findServiceTypeByName(TOMCAT_TYPE_NAME);
final ServiceType messageQueue = serviceTypeRegistryService.findServiceTypeByName(MESSAGE_QUEUE_TYPE_NAME);
final String messageQueueA = "QUEUE_A";
final String messageQueueB = "QUEUE_B";
FilterDescriptor.FromNode fromNode = new FilterDescriptor.FromNode("APP_A", tomcat.getName(), null);
FilterDescriptor.ToNode toNode = new FilterDescriptor.ToNode(messageQueueA, messageQueue.getName(), null);
FilterDescriptor.SelfNode selfNode = new FilterDescriptor.SelfNode(null, null, null);
FilterDescriptor.ResponseTime responseTime = new FilterDescriptor.ResponseTime(null, null);
FilterDescriptor.Option option = mock(FilterDescriptor.Option.class);
FilterDescriptor descriptor = new FilterDescriptor(fromNode, toNode, selfNode, responseTime, option);
FilterHint hint = new FilterHint(Collections.emptyList());
LinkFilter linkFilter = newLinkFilter(descriptor, hint);
logger.debug(linkFilter.toString());
SpanBo matchingSpan = new SpanBo();
matchingSpan.setApplicationId("APP_A");
matchingSpan.setApplicationServiceType(tomcat.getCode());
SpanEventBo spanEventDestinationA = new SpanEventBo();
spanEventDestinationA.setDestinationId(messageQueueA);
spanEventDestinationA.setServiceType(MESSAGE_QUEUE_TYPE_CODE);
matchingSpan.addSpanEvent(spanEventDestinationA);
Assert.assertTrue(linkFilter.include(Collections.singletonList(matchingSpan)));
SpanBo unmatchingSpan = new SpanBo();
unmatchingSpan.setApplicationId("APP_A");
unmatchingSpan.setApplicationServiceType(tomcat.getCode());
SpanEventBo spanEventDestinationB = new SpanEventBo();
spanEventDestinationB.setDestinationId(messageQueueB);
spanEventDestinationB.setServiceType(MESSAGE_QUEUE_TYPE_CODE);
unmatchingSpan.addSpanEvent(spanEventDestinationB);
Assert.assertFalse(linkFilter.include(Collections.singletonList(unmatchingSpan)));
Assert.assertTrue(linkFilter.include(Arrays.asList(matchingSpan, unmatchingSpan)));
SpanBo bothSpan = new SpanBo();
bothSpan.setApplicationId("APP_A");
bothSpan.setApplicationServiceType(tomcat.getCode());
bothSpan.addSpanEventBoList(Arrays.asList(spanEventDestinationA, spanEventDestinationB));
Assert.assertTrue(linkFilter.include(Collections.singletonList(bothSpan)));
}
use of com.navercorp.pinpoint.common.server.bo.SpanEventBo in project pinpoint by naver.
the class CallStackMock method pop.
public SpanEventBo pop() {
final SpanEventBo spanEvent = peek();
if (spanEvent != null) {
stack[index - 1] = null;
index--;
final int endElapsed = (int) (currentTime - (spanBo.getStartTime() + spanEvent.getStartElapsed()));
spanEvent.setEndElapsed(endElapsed);
}
return spanEvent;
}
Aggregations