use of com.navercorp.pinpoint.common.server.bo.SpanEventBo in project pinpoint by naver.
the class LinkFilterTest method wasToUnknownFilter.
@Test
public void wasToUnknownFilter() {
final ServiceType tomcat = serviceTypeRegistryService.findServiceTypeByName(TOMCAT_TYPE_NAME);
final ServiceType unknown = serviceTypeRegistryService.findServiceTypeByName(UNKNOWN_TYPE_NAME);
final String rpcHost = "some.domain.name";
final String rpcUrl = "http://" + rpcHost + "/some/test/path";
final String urlPattern = "/some/test/**";
FilterDescriptor.FromNode fromNode = new FilterDescriptor.FromNode("APP_A", tomcat.getName(), null);
FilterDescriptor.ToNode toNode = new FilterDescriptor.ToNode(rpcHost, unknown.getName(), null);
FilterDescriptor.SelfNode selfNode = new FilterDescriptor.SelfNode(null, null, null);
FilterDescriptor.Option option = new FilterDescriptor.Option(encodeUrl(urlPattern), null);
FilterDescriptor.ResponseTime responseTime = new FilterDescriptor.ResponseTime(null, null);
FilterDescriptor descriptor = new FilterDescriptor(fromNode, toNode, selfNode, responseTime, option);
FilterHint hint = new FilterHint(Collections.emptyList());
LinkFilter linkFilter = newLinkFilter(descriptor, hint);
logger.debug(linkFilter.toString());
// Reject - no rpc span event
SpanBo spanBo = new SpanBo();
spanBo.setSpanId(1);
spanBo.setParentSpanId(-1);
spanBo.setApplicationId("APP_A");
spanBo.setApplicationServiceType(tomcat.getCode());
Assert.assertFalse(linkFilter.include(Collections.singletonList(spanBo)));
// Accept - has matching rpc span event
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));
spanBo.addSpanEvent(rpcSpanEvent);
Assert.assertTrue(linkFilter.include(Collections.singletonList(spanBo)));
}
use of com.navercorp.pinpoint.common.server.bo.SpanEventBo in project pinpoint by naver.
the class RpcURLPatternFilterTest method createTestRpcSpans.
private List<SpanBo> createTestRpcSpans(String... rpcUrls) {
List<SpanBo> spanBos = new ArrayList<>();
for (String rpcUrl : rpcUrls) {
SpanEventBo testRpcSpanEvent = new SpanEventBo();
testRpcSpanEvent.setServiceType(TEST_RPC_SERVICE_TYPE_CODE);
AnnotationBo testRpcAnnotationBo = new AnnotationBo(TEST_RPC_URL_ANNOTATION_KEY.getCode(), rpcUrl);
testRpcSpanEvent.setAnnotationBoList(Collections.singletonList(testRpcAnnotationBo));
SpanBo spanBo = new SpanBo();
spanBo.addSpanEvent(testRpcSpanEvent);
spanBos.add(spanBo);
}
return spanBos;
}
use of com.navercorp.pinpoint.common.server.bo.SpanEventBo in project pinpoint by naver.
the class CallStackMock method push.
public void push() {
final SpanEventBo spanEvent = new SpanEventBo();
final int startElapsed = (int) (currentTime - spanBo.getStartTime());
currentTime++;
spanEvent.setStartElapsed(startElapsed);
spanEvent.setSequence(sequence++);
checkExtend(index + 1);
stack[index++] = spanEvent;
if (this.latestStackIndex != this.index) {
this.latestStackIndex = this.index;
spanEvent.setDepth(this.latestStackIndex);
}
final SpanEventAlign spanEventAlign;
if (this.async) {
LocalAsyncIdBo localAsyncIdBo = new LocalAsyncIdBo(asyncId, 1);
SpanChunkBo spanChunkBo = new SpanChunkBo();
spanChunkBo.setLocalAsyncId(localAsyncIdBo);
spanEventAlign = new SpanChunkEventAlign(spanBo, spanChunkBo, spanEvent);
} else {
spanEventAlign = new SpanEventAlign(spanBo, spanEvent);
}
callTree.add(spanEvent.getDepth(), spanEventAlign);
}
use of com.navercorp.pinpoint.common.server.bo.SpanEventBo in project pinpoint by naver.
the class SpanAlignerTest method makeSpanEvent.
private SpanEventBo makeSpanEvent(int sequence, int depth, int nextSpanId, int endElapsed) {
SpanEventBo event = new SpanEventBo();
event.setSequence((short) sequence);
event.setDepth(depth);
event.setNextSpanId(nextSpanId);
event.setEndElapsed(endElapsed);
return event;
}
Aggregations