use of com.navercorp.pinpoint.common.server.bo.SpanEventBo in project pinpoint by naver.
the class SpanAsyncEventMap method toAlignList.
private List<Align> toAlignList(SpanBo spanBo, SpanChunkBo spanChunkBo, List<SpanEventBo> spanEventBoList) {
List<Align> alignList = new ArrayList<>(spanEventBoList.size());
for (SpanEventBo spanEventBo : spanEventBoList) {
SpanChunkEventAlign spanChunkEventAlign = new SpanChunkEventAlign(spanBo, spanChunkBo, spanEventBo);
alignList.add(spanChunkEventAlign);
}
return alignList;
}
use of com.navercorp.pinpoint.common.server.bo.SpanEventBo in project pinpoint by naver.
the class TraceService method insertSpanEventList.
private void insertSpanEventList(List<SpanEventBo> spanEventList, ServiceType applicationServiceType, String applicationId, String agentId, String endPoint) {
for (SpanEventBo spanEvent : spanEventList) {
final ServiceType spanEventType = registry.findServiceType(spanEvent.getServiceType());
if (isAlias(spanEventType, spanEvent)) {
insertAcceptorHost(spanEvent, applicationId, applicationServiceType);
continue;
}
if (!spanEventType.isRecordStatistics()) {
continue;
}
final String spanEventApplicationName = normalize(spanEvent.getDestinationId(), spanEventType);
final String spanEventEndPoint = spanEvent.getEndPoint();
// if terminal update statistics
final int elapsed = spanEvent.getEndElapsed();
final boolean hasException = spanEvent.hasException();
if (applicationId == null || spanEventApplicationName == null) {
logger.warn("Failed to insert statistics. Cause:SpanEvent has invalid format.(application:{}/{}[{}], spanEventApplication:{}[{}])", applicationId, agentId, applicationServiceType, spanEventApplicationName, spanEventType);
continue;
}
/*
* save information to draw a server map based on statistics
*/
// save the information of caller (the spanevent that called span)
statisticsService.updateCaller(applicationId, applicationServiceType, agentId, spanEventApplicationName, spanEventType, spanEventEndPoint, elapsed, hasException);
// save the information of callee (the span that spanevent called)
statisticsService.updateCallee(spanEventApplicationName, spanEventType, applicationId, applicationServiceType, endPoint, elapsed, hasException);
}
}
use of com.navercorp.pinpoint.common.server.bo.SpanEventBo in project pinpoint by naver.
the class TraceService method insertSpanEventStat.
private void insertSpanEventStat(SpanBo span) {
final List<SpanEventBo> spanEventList = span.getSpanEventBoList();
if (CollectionUtils.isEmpty(spanEventList)) {
return;
}
if (logger.isDebugEnabled()) {
logger.debug("handle spanEvent size:{}", spanEventList.size());
}
final ServiceType applicationServiceType = getApplicationServiceType(span);
// TODO need to batch update later.
insertSpanEventList(spanEventList, applicationServiceType, span.getApplicationId(), span.getAgentId(), span.getEndPoint());
}
use of com.navercorp.pinpoint.common.server.bo.SpanEventBo in project pinpoint by naver.
the class AlignComparator method compare.
@Override
public int compare(Align a1, Align a2) {
final SpanEventBo event1 = a1.getSpanEventBo();
final SpanEventBo event2 = a2.getSpanEventBo();
return SpanEventComparator.INSTANCE.compare(event1, event2);
}
use of com.navercorp.pinpoint.common.server.bo.SpanEventBo in project pinpoint by naver.
the class LinkFilterTest method wasToWasFilter_noMatch_missingReceivingSpan.
@Test
public void wasToWasFilter_noMatch_missingReceivingSpan() {
final ServiceType tomcat = serviceTypeRegistryService.findServiceTypeByName(TOMCAT_TYPE_NAME);
final String rpcHost = "some.domain.name";
final String rpcUrl = "http://" + rpcHost + "/some/test/path";
FilterDescriptor.FromNode fromNode = new FilterDescriptor.FromNode("APP_A", tomcat.getName(), null);
FilterDescriptor.ToNode toNode = new FilterDescriptor.ToNode("APP_B", tomcat.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 emptyHint = new FilterHint(Collections.emptyList());
FilterHint unmatchingHint = new FilterHint(Collections.singletonList(new RpcHint("APP_B", Collections.singletonList(new RpcType("different.domain.name", RPC_TYPE_CODE)))));
FilterHint matchingHint = new FilterHint(Collections.singletonList(new RpcHint("APP_B", Collections.singletonList(new RpcType(rpcHost, RPC_TYPE_CODE)))));
LinkFilter emptyHintLinkFilter = newLinkFilter(descriptor, emptyHint);
LinkFilter unmatchingHintLinkFilter = newLinkFilter(descriptor, unmatchingHint);
LinkFilter matchingHintLinkFilter = newLinkFilter(descriptor, matchingHint);
logger.debug("emptyHintLinkFilter : {}", emptyHintLinkFilter.toString());
logger.debug("unmatchingHintLinkFilter : {}", unmatchingHintLinkFilter.toString());
logger.debug("matchingHintLinkFilter : {}", matchingHintLinkFilter.toString());
SpanBo fromSpan = new SpanBo();
fromSpan.setSpanId(1);
fromSpan.setParentSpanId(-1);
fromSpan.setApplicationId("APP_A");
fromSpan.setApplicationServiceType(tomcat.getCode());
AnnotationBo rpcAnnotation = new AnnotationBo(RPC_ANNOTATION_CODE, rpcUrl);
SpanEventBo rpcSpanEvent = new SpanEventBo();
rpcSpanEvent.setServiceType(RPC_TYPE_CODE);
rpcSpanEvent.setDestinationId(rpcHost);
rpcSpanEvent.setAnnotationBoList(Collections.singletonList(rpcAnnotation));
fromSpan.addSpanEvent(rpcSpanEvent);
// Reject - filter hint empty
Assert.assertFalse(emptyHintLinkFilter.include(Collections.singletonList(fromSpan)));
// Reject - filter hint does not match
Assert.assertFalse(unmatchingHintLinkFilter.include(Collections.singletonList(fromSpan)));
// Accept - filter hint matches
Assert.assertTrue(matchingHintLinkFilter.include(Collections.singletonList(fromSpan)));
// Check rpc url as well
final String unmatchingUrlPattern = "/other/test/**";
final String matchingUrlPattern = "/some/test/**";
// Reject - url pattern does not match
when(option.getUrlPattern()).thenReturn(unmatchingUrlPattern);
LinkFilter matchingHintLinkFilterWithUnmatchingUrlPattern = newLinkFilter(descriptor, matchingHint);
Assert.assertFalse(matchingHintLinkFilterWithUnmatchingUrlPattern.include(Collections.singletonList(fromSpan)));
// Accept - url pattern matches
when(option.getUrlPattern()).thenReturn(matchingUrlPattern);
LinkFilter matchingHintLinkFilterWithMatchingUrlPattern = newLinkFilter(descriptor, matchingHint);
Assert.assertTrue(matchingHintLinkFilterWithMatchingUrlPattern.include(Collections.singletonList(fromSpan)));
}
Aggregations