Search in sources :

Example 46 with AnnotationBo

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

the class SpanDecoderV0 method readAnnotationList.

private List<AnnotationBo> readAnnotationList(Buffer buffer, SpanDecodingContext decodingContext) {
    int annotationListSize = buffer.readVInt();
    List<AnnotationBo> annotationBoList = new ArrayList<>(annotationListSize);
    // AnnotationBo prev = decodingContext.getPrevFirstAnnotationBo();
    AnnotationBo prev = null;
    for (int i = 0; i < annotationListSize; i++) {
        AnnotationBo current;
        if (i == 0) {
            current = readFirstAnnotationBo(buffer);
        // save first annotation for delta bitfield
        // decodingContext.setPrevFirstAnnotationBo(current);
        } else {
            current = readDeltaAnnotationBo(buffer, prev);
        }
        prev = current;
        annotationBoList.add(current);
    }
    return annotationBoList;
}
Also used : AnnotationBo(com.navercorp.pinpoint.common.server.bo.AnnotationBo) ArrayList(java.util.ArrayList)

Example 47 with AnnotationBo

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

the class SpanDecoderV0 method readDeltaAnnotationBo.

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

Example 48 with AnnotationBo

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

the class SpanDecoderV0 method readFirstSpanEvent.

private SpanEventBo readFirstSpanEvent(Buffer buffer, SpanDecodingContext decodingContext) {
    final SpanEventBitField bitField = new SpanEventBitField(buffer.readByte());
    final SpanEventBo firstSpanEvent = new SpanEventBo();
    firstSpanEvent.setStartElapsed(buffer.readVInt());
    firstSpanEvent.setEndElapsed(buffer.readVInt());
    firstSpanEvent.setSequence(buffer.readShort());
    firstSpanEvent.setDepth(buffer.readSVInt());
    firstSpanEvent.setServiceType(buffer.readShort());
    if (bitField.isSetRpc()) {
        firstSpanEvent.setRpc(buffer.readPrefixedString());
    }
    if (bitField.isSetEndPoint()) {
        firstSpanEvent.setEndPoint(buffer.readPrefixedString());
    }
    if (bitField.isSetDestinationId()) {
        firstSpanEvent.setDestinationId(buffer.readPrefixedString());
    }
    firstSpanEvent.setApiId(buffer.readSVInt());
    if (bitField.isSetNextSpanId()) {
        firstSpanEvent.setNextSpanId(buffer.readLong());
    }
    if (bitField.isSetHasException()) {
        int exceptionId = buffer.readSVInt();
        String exceptionMessage = buffer.readPrefixedString();
        firstSpanEvent.setExceptionInfo(exceptionId, exceptionMessage);
    }
    if (bitField.isSetAnnotation()) {
        List<AnnotationBo> annotationBoList = readAnnotationList(buffer, decodingContext);
        firstSpanEvent.setAnnotationBoList(annotationBoList);
    }
    if (bitField.isSetNextAsyncId()) {
        firstSpanEvent.setNextAsyncId(buffer.readSVInt());
    }
    // }
    return firstSpanEvent;
}
Also used : SpanEventBitField(com.navercorp.pinpoint.common.server.bo.serializer.trace.v2.bitfield.SpanEventBitField) AnnotationBo(com.navercorp.pinpoint.common.server.bo.AnnotationBo) SpanEventBo(com.navercorp.pinpoint.common.server.bo.SpanEventBo)

Example 49 with AnnotationBo

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

the class SpanEventBitFieldTest method testAnnotation_first.

@Test
public void testAnnotation_first() throws Exception {
    SpanEventBo spanEventBo = new SpanEventBo();
    spanEventBo.setAnnotationBoList(Collections.singletonList(new AnnotationBo(1, "test")));
    SpanEventBitField bitField = SpanEventBitField.buildFirst(spanEventBo);
    Assert.assertTrue(bitField.isSetAnnotation());
    bitField.setAnnotation(false);
    Assert.assertFalse(bitField.isSetAnnotation());
}
Also used : AnnotationBo(com.navercorp.pinpoint.common.server.bo.AnnotationBo) SpanEventBo(com.navercorp.pinpoint.common.server.bo.SpanEventBo) Test(org.junit.Test)

Example 50 with AnnotationBo

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

the class AnnotationUtilsTest method findApiAnnotation.

@Test
public void findApiAnnotation() {
    AnnotationBo annotationBo = new AnnotationBo(AnnotationKey.API.getCode(), "a");
    String value = AnnotationUtils.findApiAnnotation(Collections.singletonList(annotationBo));
    Assert.assertEquals("a", 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