Search in sources :

Example 16 with AnnotationBo

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

the class SpanDecoderV0 method readFirstAnnotationBo.

private AnnotationBo readFirstAnnotationBo(Buffer buffer) {
    final int key = buffer.readSVInt();
    byte valueType = buffer.readByte();
    byte[] valueBytes = buffer.readPrefixedBytes();
    Object value = transcoder.decode(valueType, valueBytes);
    AnnotationBo current = new AnnotationBo(key, value);
    return current;
}
Also used : AnnotationBo(com.navercorp.pinpoint.common.server.bo.AnnotationBo)

Example 17 with AnnotationBo

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

the class SpanDecoderV0 method readSpanValue.

public void readSpanValue(Buffer buffer, SpanBo span, SpanDecodingContext decodingContext) {
    final byte version = buffer.readByte();
    span.setVersion(version);
    final SpanBitFiled bitFiled = new SpanBitFiled(buffer.readByte());
    final short serviceType = buffer.readShort();
    span.setServiceType(serviceType);
    switch(bitFiled.getApplicationServiceTypeEncodingStrategy()) {
        case PREV_EQUALS:
            span.setApplicationServiceType(serviceType);
            break;
        case RAW:
            span.setApplicationServiceType(buffer.readShort());
            break;
        default:
            throw new IllegalStateException("applicationServiceType");
    }
    if (!bitFiled.isRoot()) {
        span.setParentSpanId(buffer.readLong());
    } else {
        span.setParentSpanId(-1);
    }
    final long startTimeDelta = buffer.readVLong();
    final long startTime = span.getCollectorAcceptTime() - startTimeDelta;
    span.setStartTime(startTime);
    span.setElapsed(buffer.readVInt());
    span.setRpc(buffer.readPrefixedString());
    span.setEndPoint(buffer.readPrefixedString());
    span.setRemoteAddr(buffer.readPrefixedString());
    span.setApiId(buffer.readSVInt());
    if (bitFiled.isSetErrorCode()) {
        span.setErrCode(buffer.readInt());
    }
    if (bitFiled.isSetHasException()) {
        int exceptionId = buffer.readSVInt();
        String exceptionMessage = buffer.readPrefixedString();
        span.setExceptionInfo(exceptionId, exceptionMessage);
    }
    if (bitFiled.isSetFlag()) {
        span.setFlag(buffer.readShort());
    }
    if (bitFiled.isSetLoggingTransactionInfo()) {
        span.setLoggingTransactionInfo(buffer.readByte());
    }
    span.setAcceptorHost(buffer.readPrefixedString());
    if (bitFiled.isSetAnnotation()) {
        List<AnnotationBo> annotationBoList = readAnnotationList(buffer, decodingContext);
        span.setAnnotationBoList(annotationBoList);
    }
    List<SpanEventBo> spanEventBoList = readSpanEvent(buffer, decodingContext, SEQUENCE_SPAN_EVENT_FILTER);
    span.addSpanEventBoList(spanEventBoList);
}
Also used : AnnotationBo(com.navercorp.pinpoint.common.server.bo.AnnotationBo) SpanBitFiled(com.navercorp.pinpoint.common.server.bo.serializer.trace.v2.bitfield.SpanBitFiled) SpanEventBo(com.navercorp.pinpoint.common.server.bo.SpanEventBo)

Example 18 with AnnotationBo

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

the class GrpcSpanBinder method newAnnotationBo.

private AnnotationBo newAnnotationBo(PAnnotation pAnnotation) {
    Objects.requireNonNull(pAnnotation, "pAnnotation");
    AnnotationBo annotationBo = annotationFactory.buildAnnotation(pAnnotation);
    return annotationBo;
}
Also used : AnnotationBo(com.navercorp.pinpoint.common.server.bo.AnnotationBo)

Example 19 with AnnotationBo

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

the class GrpcSpanBinder method buildAnnotationList.

private List<AnnotationBo> buildAnnotationList(List<PAnnotation> pAnnotationList) {
    if (CollectionUtils.isEmpty(pAnnotationList)) {
        return Collections.emptyList();
    }
    List<AnnotationBo> boList = new ArrayList<>(pAnnotationList.size());
    for (PAnnotation tAnnotation : pAnnotationList) {
        final AnnotationBo annotationBo = newAnnotationBo(tAnnotation);
        boList.add(annotationBo);
    }
    boList.sort(AnnotationComparator.INSTANCE);
    return boList;
}
Also used : AnnotationBo(com.navercorp.pinpoint.common.server.bo.AnnotationBo) PAnnotation(com.navercorp.pinpoint.grpc.trace.PAnnotation) ArrayList(java.util.ArrayList)

Example 20 with AnnotationBo

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

the class AnnotationUtilsTest method findApiAnnotation_invalidType.

@Test
public void findApiAnnotation_invalidType() {
    AnnotationBo annotationBo = new AnnotationBo(AnnotationKey.API.getCode(), 1);
    String value = AnnotationUtils.findApiAnnotation(Collections.singletonList(annotationBo));
    Assert.assertNull(null, value);
}
Also used : AnnotationBo(com.navercorp.pinpoint.common.server.bo.AnnotationBo) Test(org.junit.Test)

Aggregations

AnnotationBo (com.navercorp.pinpoint.common.server.bo.AnnotationBo)55 ArrayList (java.util.ArrayList)17 SpanEventBo (com.navercorp.pinpoint.common.server.bo.SpanEventBo)14 SpanBo (com.navercorp.pinpoint.common.server.bo.SpanBo)13 ApiMetaDataBo (com.navercorp.pinpoint.common.server.bo.ApiMetaDataBo)7 Test (org.junit.Test)7 List (java.util.List)6 Buffer (com.navercorp.pinpoint.common.buffer.Buffer)5 TransactionId (com.navercorp.pinpoint.common.profiler.util.TransactionId)5 SpanEventBitField (com.navercorp.pinpoint.common.server.bo.serializer.trace.v2.bitfield.SpanEventBitField)5 AnnotationKey (com.navercorp.pinpoint.common.trace.AnnotationKey)5 Align (com.navercorp.pinpoint.web.calltree.span.Align)4 SpanAlign (com.navercorp.pinpoint.web.calltree.span.SpanAlign)4 ByteBuffer (java.nio.ByteBuffer)4 AutomaticBuffer (com.navercorp.pinpoint.common.buffer.AutomaticBuffer)3 SpanBitFiled (com.navercorp.pinpoint.common.server.bo.serializer.trace.v2.bitfield.SpanBitFiled)3 ServiceType (com.navercorp.pinpoint.common.trace.ServiceType)3 OffsetFixedBuffer (com.navercorp.pinpoint.common.buffer.OffsetFixedBuffer)2 SqlMetaDataBo (com.navercorp.pinpoint.common.server.bo.SqlMetaDataBo)2 StringMetaDataBo (com.navercorp.pinpoint.common.server.bo.StringMetaDataBo)2