Search in sources :

Example 26 with SpanEventBo

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

the class SpanEventBitFieldTest method testStartElapsed_equals_next.

@Test
public void testStartElapsed_equals_next() throws Exception {
    SpanEventBo prev = new SpanEventBo();
    SpanEventBo current = new SpanEventBo();
    prev.setStartElapsed(1234);
    current.setStartElapsed(1234);
    SpanEventBitField bitField = SpanEventBitField.build(current, prev);
    Assert.assertEquals(bitField.getStartElapsedEncodingStrategy(), StartElapsedTimeEncodingStrategy.PREV_EQUALS);
}
Also used : SpanEventBo(com.navercorp.pinpoint.common.server.bo.SpanEventBo) Test(org.junit.Test)

Example 27 with SpanEventBo

use of com.navercorp.pinpoint.common.server.bo.SpanEventBo 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);
    }
}
Also used : SpanReader(com.navercorp.pinpoint.web.filter.visitor.SpanReader) SpanEventVisitAdaptor(com.navercorp.pinpoint.web.filter.visitor.SpanEventVisitAdaptor) SpanBo(com.navercorp.pinpoint.common.server.bo.SpanBo) SpanAcceptor(com.navercorp.pinpoint.web.filter.visitor.SpanAcceptor) SpanEventVisitor(com.navercorp.pinpoint.web.filter.visitor.SpanEventVisitor) SpanEventBo(com.navercorp.pinpoint.common.server.bo.SpanEventBo)

Example 28 with SpanEventBo

use of com.navercorp.pinpoint.common.server.bo.SpanEventBo 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;
        }
    }));
}
Also used : SpanReader(com.navercorp.pinpoint.web.filter.visitor.SpanReader) SpanEventVisitAdaptor(com.navercorp.pinpoint.web.filter.visitor.SpanEventVisitAdaptor) SpanAcceptor(com.navercorp.pinpoint.web.filter.visitor.SpanAcceptor) SpanEventVisitor(com.navercorp.pinpoint.web.filter.visitor.SpanEventVisitor) SpanEventBo(com.navercorp.pinpoint.common.server.bo.SpanEventBo) LinkDataMap(com.navercorp.pinpoint.web.applicationmap.rawdata.LinkDataMap)

Example 29 with SpanEventBo

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

the class SpanEncoderV0 method encodeSpanChunkQualifier.

@Override
public ByteBuffer encodeSpanChunkQualifier(SpanEncodingContext<SpanChunkBo> encodingContext) {
    final SpanChunkBo spanChunkBo = encodingContext.getValue();
    final List<SpanEventBo> spanEventBoList = spanChunkBo.getSpanEventBoList();
    final SpanEventBo firstEvent = getFirstSpanEvent(spanEventBoList);
    LocalAsyncIdBo localAsyncId = spanChunkBo.getLocalAsyncId();
    return encodeQualifier(TYPE_SPAN_CHUNK, spanChunkBo, firstEvent, localAsyncId);
}
Also used : SpanChunkBo(com.navercorp.pinpoint.common.server.bo.SpanChunkBo) LocalAsyncIdBo(com.navercorp.pinpoint.common.server.bo.LocalAsyncIdBo) SpanEventBo(com.navercorp.pinpoint.common.server.bo.SpanEventBo)

Example 30 with SpanEventBo

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

the class SpanEncoderV0 method encodeSpanChunkColumnValue.

@Override
public ByteBuffer encodeSpanChunkColumnValue(SpanEncodingContext<SpanChunkBo> encodingContext) {
    final SpanChunkBo spanChunkBo = encodingContext.getValue();
    final Buffer buffer = new AutomaticBuffer(256);
    final byte version = (byte) spanChunkBo.getVersion();
    buffer.putByte(version);
    if (version == SpanVersion.TRACE_V2) {
        long keyTime = spanChunkBo.getKeyTime();
        buffer.putVLong(keyTime);
    }
    final List<SpanEventBo> spanEventBoList = spanChunkBo.getSpanEventBoList();
    writeSpanEventList(buffer, spanEventBoList, encodingContext);
    return buffer.wrapByteBuffer();
}
Also used : Buffer(com.navercorp.pinpoint.common.buffer.Buffer) AutomaticBuffer(com.navercorp.pinpoint.common.buffer.AutomaticBuffer) ByteBuffer(java.nio.ByteBuffer) SpanChunkBo(com.navercorp.pinpoint.common.server.bo.SpanChunkBo) AutomaticBuffer(com.navercorp.pinpoint.common.buffer.AutomaticBuffer) SpanEventBo(com.navercorp.pinpoint.common.server.bo.SpanEventBo)

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