use of com.navercorp.pinpoint.web.filter.visitor.SpanEventVisitAdaptor in project pinpoint by naver.
the class FilteredMapBuilder method getParentsSpan.
private SpanBo getParentsSpan(SpanBo currentSpan, MultiValueMap<Long, SpanBo> transactionSpanMap) {
List<SpanBo> parentSpanCandidateList = transactionSpanMap.get(currentSpan.getParentSpanId());
if (parentSpanCandidateList == null) {
return null;
}
if (CollectionUtils.nullSafeSize(parentSpanCandidateList) == 1) {
return parentSpanCandidateList.get(0);
} else {
for (SpanBo parentSpanCandidate : parentSpanCandidateList) {
SpanAcceptor acceptor = new SpanReader(Collections.singletonList(parentSpanCandidate));
boolean accept = acceptor.accept(new SpanEventVisitAdaptor(new SpanEventVisitor() {
@Override
public boolean visit(SpanEventBo spanEventBo) {
if (spanEventBo.getNextSpanId() == currentSpan.getSpanId()) {
return SpanVisitor.ACCEPT;
}
return SpanVisitor.REJECT;
}
}));
if (accept) {
return parentSpanCandidate;
}
}
logger.warn("Can not find suitable ParentSpan.(CurrentSpan:{})", currentSpan);
return parentSpanCandidateList.get(0);
}
}
use of com.navercorp.pinpoint.web.filter.visitor.SpanEventVisitAdaptor in project pinpoint by naver.
the class FilteredMapBuilder method addNodeFromSpanEvent.
private void addNodeFromSpanEvent(SpanBo span, Application srcApplication, MultiValueMap<Long, SpanBo> transactionSpanMap) {
/*
* add span event statistics
*/
LinkDataMap sourceLinkDataMap = linkDataDuplexMap.getSourceLinkDataMap();
SpanAcceptor acceptor = new SpanReader(Collections.singletonList(span));
acceptor.accept(new SpanEventVisitAdaptor(new SpanEventVisitor() {
@Override
public boolean visit(SpanEventBo spanEventBo) {
addNode(span, transactionSpanMap, srcApplication, sourceLinkDataMap, spanEventBo);
return SpanVisitor.REJECT;
}
}));
}
Aggregations