Search in sources :

Example 1 with SpanEventBo

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

the class RedisPluginTest method jedis.

@Test
public void jedis() {
    JedisMock jedis = new JedisMock("localhost", 6379);
    try {
        jedis.get("foo");
    } finally {
        if (jedis != null) {
            jedis.close();
        }
    }
    final List<SpanEventBo> events = getCurrentSpanEvents();
    assertEquals(1, events.size());
    final SpanEventBo eventBo = events.get(0);
    assertEquals(HOST + ":" + PORT, eventBo.getEndPoint());
    assertEquals("REDIS", eventBo.getDestinationId());
}
Also used : SpanEventBo(com.navercorp.pinpoint.common.server.bo.SpanEventBo) BasePinpointTest(com.navercorp.pinpoint.test.junit4.BasePinpointTest) Test(org.junit.Test)

Example 2 with SpanEventBo

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

the class FilteredMapServiceImpl method linkStatistics.

@Override
@Deprecated
public LoadFactor linkStatistics(Range range, List<TransactionId> traceIdSet, Application sourceApplication, Application destinationApplication, Filter filter) {
    if (sourceApplication == null) {
        throw new NullPointerException("sourceApplication must not be null");
    }
    if (destinationApplication == null) {
        throw new NullPointerException("destApplicationName must not be null");
    }
    if (filter == null) {
        throw new NullPointerException("filter must not be null");
    }
    StopWatch watch = new StopWatch();
    watch.start();
    List<List<SpanBo>> originalList = this.traceDao.selectAllSpans(traceIdSet);
    List<SpanBo> filteredTransactionList = filterList(originalList, filter);
    LoadFactor statistics = new LoadFactor(range);
    // scan transaction list
    for (SpanBo span : filteredTransactionList) {
        if (sourceApplication.equals(span.getApplicationId(), registry.findServiceType(span.getApplicationServiceType()))) {
            List<SpanEventBo> spanEventBoList = span.getSpanEventBoList();
            if (spanEventBoList == null) {
                continue;
            }
            // find dest elapsed time
            for (SpanEventBo spanEventBo : spanEventBoList) {
                if (destinationApplication.equals(spanEventBo.getDestinationId(), registry.findServiceType(spanEventBo.getServiceType()))) {
                    // find exception
                    boolean hasException = spanEventBo.hasException();
                    // add sample
                    // TODO : need timeslot value instead of the actual value
                    statistics.addSample(span.getStartTime() + spanEventBo.getStartElapsed(), spanEventBo.getEndElapsed(), 1, hasException);
                    break;
                }
            }
        }
    }
    watch.stop();
    logger.info("Fetch link statistics elapsed. {}ms", watch.getLastTaskTimeMillis());
    return statistics;
}
Also used : LoadFactor(com.navercorp.pinpoint.web.vo.LoadFactor) ArrayList(java.util.ArrayList) List(java.util.List) SpanBo(com.navercorp.pinpoint.common.server.bo.SpanBo) SpanEventBo(com.navercorp.pinpoint.common.server.bo.SpanEventBo) StopWatch(org.springframework.util.StopWatch)

Example 3 with SpanEventBo

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

the class FilteredMapServiceImpl method addNodeFromSpanEvent.

private void addNodeFromSpanEvent(SpanBo span, TimeWindow window, LinkDataDuplexMap linkDataDuplexMap, Map<Long, SpanBo> transactionSpanMap) {
    /*
         * add span event statistics
         */
    final List<SpanEventBo> spanEventBoList = span.getSpanEventBoList();
    if (CollectionUtils.isEmpty(spanEventBoList)) {
        return;
    }
    final Application srcApplication = applicationFactory.createApplication(span.getApplicationId(), span.getApplicationServiceType());
    LinkDataMap sourceLinkDataMap = linkDataDuplexMap.getSourceLinkDataMap();
    for (SpanEventBo spanEvent : spanEventBoList) {
        ServiceType destServiceType = registry.findServiceType(spanEvent.getServiceType());
        if (!destServiceType.isRecordStatistics()) {
            // internal method
            continue;
        }
        // logic for checking acceptor
        if (destServiceType.isRpcClient()) {
            if (!transactionSpanMap.containsKey(spanEvent.getNextSpanId())) {
                destServiceType = ServiceType.UNKNOWN;
            }
        }
        String dest = spanEvent.getDestinationId();
        if (dest == null) {
            dest = "Unknown";
        }
        final Application destApplication = this.applicationFactory.createApplication(dest, destServiceType);
        final short slotTime = getHistogramSlotTime(spanEvent, destServiceType);
        // FIXME
        final long spanEventTimeStamp = window.refineTimestamp(span.getStartTime() + spanEvent.getStartElapsed());
        if (logger.isTraceEnabled()) {
            logger.trace("spanEvent  src:{} {} -> dest:{} {}", srcApplication, span.getAgentId(), destApplication, spanEvent.getEndPoint());
        }
        // endPoint may be null
        final String destinationAgentId = StringUtils.defaultString(spanEvent.getEndPoint());
        sourceLinkDataMap.addLinkData(srcApplication, span.getAgentId(), destApplication, destinationAgentId, spanEventTimeStamp, slotTime, 1);
    }
}
Also used : ServiceType(com.navercorp.pinpoint.common.trace.ServiceType) Application(com.navercorp.pinpoint.web.vo.Application) SpanEventBo(com.navercorp.pinpoint.common.server.bo.SpanEventBo) LinkDataMap(com.navercorp.pinpoint.web.applicationmap.rawdata.LinkDataMap)

Example 4 with SpanEventBo

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

the class SpanHandler method insertSpanEventStat.

private void insertSpanEventStat(SpanBo span) {
    final List<SpanEventBo> spanEventList = span.getSpanEventBoList();
    if (CollectionUtils.isEmpty(spanEventList)) {
        return;
    }
    final ServiceType applicationServiceType = getApplicationServiceType(span);
    logger.debug("handle spanEvent size:{}", spanEventList.size());
    // TODO need to batch update later.
    for (SpanEventBo spanEvent : spanEventList) {
        final ServiceType spanEventType = registry.findServiceType(spanEvent.getServiceType());
        if (!spanEventType.isRecordStatistics()) {
            continue;
        }
        // if terminal update statistics
        final int elapsed = spanEvent.getEndElapsed();
        final boolean hasException = spanEvent.hasException();
        /*
             * save information to draw a server map based on statistics
             */
        // save the information of caller (the spanevent that called span)
        statisticsHandler.updateCaller(span.getApplicationId(), applicationServiceType, span.getAgentId(), spanEvent.getDestinationId(), spanEventType, spanEvent.getEndPoint(), elapsed, hasException);
        // save the information of callee (the span that spanevent called)
        statisticsHandler.updateCallee(spanEvent.getDestinationId(), spanEventType, span.getApplicationId(), applicationServiceType, span.getEndPoint(), elapsed, hasException);
    }
}
Also used : ServiceType(com.navercorp.pinpoint.common.trace.ServiceType) SpanEventBo(com.navercorp.pinpoint.common.server.bo.SpanEventBo)

Example 5 with SpanEventBo

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

the class SequenceSpanEventFilterTest method testFilter_accept.

@Test
public void testFilter_accept() throws Exception {
    SpanEventFilter filter = new SequenceSpanEventFilter(100);
    final SpanEventBo spanEventBo = new SpanEventBo();
    spanEventBo.setSequence((short) 11);
    Assert.assertEquals(filter.filter(spanEventBo), SpanEventFilter.ACCEPT);
}
Also used : SpanEventBo(com.navercorp.pinpoint.common.server.bo.SpanEventBo) Test(org.junit.Test)

Aggregations

SpanEventBo (com.navercorp.pinpoint.common.server.bo.SpanEventBo)94 Test (org.junit.Test)39 SpanBo (com.navercorp.pinpoint.common.server.bo.SpanBo)26 AnnotationBo (com.navercorp.pinpoint.common.server.bo.AnnotationBo)14 SpanChunkBo (com.navercorp.pinpoint.common.server.bo.SpanChunkBo)13 ServiceType (com.navercorp.pinpoint.common.trace.ServiceType)11 ArrayList (java.util.ArrayList)11 Buffer (com.navercorp.pinpoint.common.buffer.Buffer)9 ByteBuffer (java.nio.ByteBuffer)8 AutomaticBuffer (com.navercorp.pinpoint.common.buffer.AutomaticBuffer)4 LocalAsyncIdBo (com.navercorp.pinpoint.common.server.bo.LocalAsyncIdBo)4 Header (com.navercorp.pinpoint.grpc.Header)4 PSpanChunk (com.navercorp.pinpoint.grpc.trace.PSpanChunk)4 TSpanEvent (com.navercorp.pinpoint.thrift.dto.TSpanEvent)4 SpanAcceptor (com.navercorp.pinpoint.web.filter.visitor.SpanAcceptor)4 SpanEventVisitor (com.navercorp.pinpoint.web.filter.visitor.SpanEventVisitor)4 SpanReader (com.navercorp.pinpoint.web.filter.visitor.SpanReader)4 OffsetFixedBuffer (com.navercorp.pinpoint.common.buffer.OffsetFixedBuffer)3 SpanBitFiled (com.navercorp.pinpoint.common.server.bo.serializer.trace.v2.bitfield.SpanBitFiled)3 PSpanEvent (com.navercorp.pinpoint.grpc.trace.PSpanEvent)3