Search in sources :

Example 41 with SpanBo

use of com.navercorp.pinpoint.common.server.bo.SpanBo in project pinpoint by naver.

the class ScatterChartServiceImpl method selectScatterData.

@Override
public ScatterData selectScatterData(List<TransactionId> transactionIdList, String applicationName, Range range, int xGroupUnit, int yGroupUnit, Filter filter) {
    if (transactionIdList == null) {
        throw new NullPointerException("transactionIdList must not be null");
    }
    if (applicationName == null) {
        throw new NullPointerException("applicationName must not be null");
    }
    if (filter == null) {
        throw new NullPointerException("filter must not be null");
    }
    final List<List<SpanBo>> traceList = traceDao.selectAllSpans(transactionIdList);
    ScatterData scatterData = new ScatterData(range.getFrom(), range.getTo(), xGroupUnit, yGroupUnit);
    for (List<SpanBo> trace : traceList) {
        if (!filter.include(trace)) {
            continue;
        }
        for (SpanBo span : trace) {
            if (applicationName.equals(span.getApplicationId())) {
                final TransactionId transactionId = span.getTransactionId();
                final Dot dot = new Dot(transactionId, span.getCollectorAcceptTime(), span.getElapsed(), span.getErrCode(), span.getAgentId());
                scatterData.addDot(dot);
            }
        }
    }
    return scatterData;
}
Also used : Dot(com.navercorp.pinpoint.web.vo.scatter.Dot) ArrayList(java.util.ArrayList) List(java.util.List) SpanBo(com.navercorp.pinpoint.common.server.bo.SpanBo) ScatterData(com.navercorp.pinpoint.web.scatter.ScatterData) TransactionId(com.navercorp.pinpoint.common.util.TransactionId)

Example 42 with SpanBo

use of com.navercorp.pinpoint.common.server.bo.SpanBo in project pinpoint by naver.

the class ScatterChartServiceImpl method selectScatterData.

@Override
public List<Dot> selectScatterData(List<TransactionId> transactionIdList, String applicationName, Filter filter) {
    if (transactionIdList == null) {
        throw new NullPointerException("transactionIdList must not be null");
    }
    if (applicationName == null) {
        throw new NullPointerException("applicationName must not be null");
    }
    if (filter == null) {
        throw new NullPointerException("filter must not be null");
    }
    final List<List<SpanBo>> traceList = traceDao.selectAllSpans(transactionIdList);
    final List<Dot> result = new ArrayList<>();
    for (List<SpanBo> trace : traceList) {
        if (!filter.include(trace)) {
            continue;
        }
        for (SpanBo span : trace) {
            if (applicationName.equals(span.getApplicationId())) {
                final TransactionId transactionId = span.getTransactionId();
                final Dot dot = new Dot(transactionId, span.getCollectorAcceptTime(), span.getElapsed(), span.getErrCode(), span.getAgentId());
                result.add(dot);
            }
        }
    }
    return result;
}
Also used : ArrayList(java.util.ArrayList) Dot(com.navercorp.pinpoint.web.vo.scatter.Dot) ArrayList(java.util.ArrayList) List(java.util.List) SpanBo(com.navercorp.pinpoint.common.server.bo.SpanBo) TransactionId(com.navercorp.pinpoint.common.util.TransactionId)

Example 43 with SpanBo

use of com.navercorp.pinpoint.common.server.bo.SpanBo in project pinpoint by naver.

the class AcceptUrlFilterTest method acceptTest_1.

@Test
public void acceptTest_1() {
    AcceptUrlFilter filter = new AcceptUrlFilter(encode("/**/*"));
    SpanBo spanBo = new SpanBo();
    spanBo.setRpc("/test");
    Assert.assertTrue(filter.accept(Arrays.asList(spanBo)));
}
Also used : SpanBo(com.navercorp.pinpoint.common.server.bo.SpanBo) Test(org.junit.Test)

Example 44 with SpanBo

use of com.navercorp.pinpoint.common.server.bo.SpanBo in project pinpoint by naver.

the class LinkFilterTest method fromToFilterAgentTest.

@Test
public void fromToFilterAgentTest() {
    final ServiceType tomcat = serviceTypeRegistryService.findServiceTypeByName("TOMCAT");
    final short tomcatServiceType = tomcat.getCode();
    FilterDescriptor descriptor = new FilterDescriptor();
    descriptor.setFromApplicationName("APP_A");
    descriptor.setFromServiceType(tomcat.getName());
    descriptor.setFromAgentId("AGENT_A");
    descriptor.setToApplicationName("APP_B");
    descriptor.setToServiceType(tomcat.getName());
    descriptor.setToAgentId("AGENT_B");
    FilterHint hint = new FilterHint(Collections.<RpcHint>emptyList());
    LinkFilter linkFilter = new LinkFilter(descriptor, hint, serviceTypeRegistryService);
    logger.debug(linkFilter.toString());
    SpanBo fromSpanBo = new SpanBo();
    fromSpanBo.setApplicationId("APP_A");
    fromSpanBo.setServiceType(tomcatServiceType);
    fromSpanBo.setAgentId("AGENT_A");
    fromSpanBo.setSpanId(100);
    SpanBo toSpanBO = new SpanBo();
    toSpanBO.setApplicationId("APP_B");
    toSpanBO.setServiceType(tomcatServiceType);
    toSpanBO.setAgentId("AGENT_B");
    toSpanBO.setParentSpanId(100);
    SpanBo spanBoC = new SpanBo();
    spanBoC.setApplicationId("APP_C");
    spanBoC.setServiceType(tomcatServiceType);
    spanBoC.setAgentId("AGENT_C");
    Assert.assertTrue(linkFilter.include(Arrays.asList(fromSpanBo, toSpanBO)));
    Assert.assertFalse(linkFilter.include(Arrays.asList(fromSpanBo, spanBoC)));
}
Also used : ServiceType(com.navercorp.pinpoint.common.trace.ServiceType) SpanBo(com.navercorp.pinpoint.common.server.bo.SpanBo) Test(org.junit.Test)

Example 45 with SpanBo

use of com.navercorp.pinpoint.common.server.bo.SpanBo in project pinpoint by naver.

the class LinkFilterTest method fromToFilterTest.

@Test
public void fromToFilterTest() {
    ServiceType tomcat = serviceTypeRegistryService.findServiceTypeByName("TOMCAT");
    final short tomcatServiceType = tomcat.getCode();
    FilterDescriptor descriptor = new FilterDescriptor();
    descriptor.setFromApplicationName("APP_A");
    descriptor.setFromServiceType(tomcat.getName());
    //        descriptor.setFromAgentId("AGENT_A");
    descriptor.setToApplicationName("APP_B");
    descriptor.setToServiceType(tomcat.getName());
    //        descriptor.setToAgentId("AGENT_B");
    FilterHint hint = new FilterHint(Collections.<RpcHint>emptyList());
    LinkFilter linkFilter = new LinkFilter(descriptor, hint, serviceTypeRegistryService);
    logger.debug(linkFilter.toString());
    SpanBo fromSpanBo = new SpanBo();
    fromSpanBo.setApplicationId("APP_A");
    fromSpanBo.setServiceType(tomcatServiceType);
    fromSpanBo.setAgentId("AGENT_A");
    fromSpanBo.setSpanId(100);
    SpanBo toSpanBO = new SpanBo();
    toSpanBO.setApplicationId("APP_B");
    toSpanBO.setServiceType(tomcatServiceType);
    toSpanBO.setAgentId("AGENT_B");
    toSpanBO.setParentSpanId(100);
    SpanBo spanBoC = new SpanBo();
    spanBoC.setApplicationId("APP_C");
    spanBoC.setServiceType(tomcatServiceType);
    spanBoC.setAgentId("AGENT_C");
    Assert.assertTrue(linkFilter.include(Arrays.asList(fromSpanBo, toSpanBO)));
    Assert.assertFalse(linkFilter.include(Arrays.asList(fromSpanBo, spanBoC)));
}
Also used : ServiceType(com.navercorp.pinpoint.common.trace.ServiceType) SpanBo(com.navercorp.pinpoint.common.server.bo.SpanBo) Test(org.junit.Test)

Aggregations

SpanBo (com.navercorp.pinpoint.common.server.bo.SpanBo)65 Test (org.junit.Test)32 SpanEventBo (com.navercorp.pinpoint.common.server.bo.SpanEventBo)14 ArrayList (java.util.ArrayList)10 Buffer (com.navercorp.pinpoint.common.buffer.Buffer)8 TransactionId (com.navercorp.pinpoint.common.util.TransactionId)8 OffsetFixedBuffer (com.navercorp.pinpoint.common.buffer.OffsetFixedBuffer)7 ByteBuffer (java.nio.ByteBuffer)7 AnnotationBo (com.navercorp.pinpoint.common.server.bo.AnnotationBo)5 ServiceType (com.navercorp.pinpoint.common.trace.ServiceType)4 BasePinpointTest (com.navercorp.pinpoint.test.junit4.BasePinpointTest)4 IsRootSpan (com.navercorp.pinpoint.test.junit4.IsRootSpan)4 List (java.util.List)4 SpanChunkBo (com.navercorp.pinpoint.common.server.bo.SpanChunkBo)2 SpanDecodingContext (com.navercorp.pinpoint.common.server.bo.serializer.trace.v2.SpanDecodingContext)2 Application (com.navercorp.pinpoint.web.vo.Application)2 Dot (com.navercorp.pinpoint.web.vo.scatter.Dot)2 Cell (org.apache.hadoop.hbase.Cell)2 AutomaticBuffer (com.navercorp.pinpoint.common.buffer.AutomaticBuffer)1 SpanDecodingContext (com.navercorp.pinpoint.common.server.bo.serializer.trace.v1.SpanDecodingContext)1