Search in sources :

Example 26 with AnnotationBo

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

the class AnnotationBoDecoder method decode.

// for test
List<AnnotationBo> decode(Buffer valueBuffer) {
    final int annotationSize = valueBuffer.readVInt();
    if (annotationSize == 0) {
        // exist outer add method
        return new ArrayList<AnnotationBo>();
    }
    List<AnnotationBo> annotationBoList = new ArrayList<AnnotationBo>(annotationSize);
    for (int i = 0; i < annotationSize; i++) {
        AnnotationBo annotation = decodeAnnotation(valueBuffer);
        annotationBoList.add(annotation);
    }
    return annotationBoList;
}
Also used : AnnotationBo(com.navercorp.pinpoint.common.server.bo.AnnotationBo) ArrayList(java.util.ArrayList)

Example 27 with AnnotationBo

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

the class AnnotationSerializer method serialize.

@Override
public void serialize(SpanBo spanBo, Put put, SerializationContext context) {
    // TODO  if we can identify whether the columnName is duplicated or not,
    // we can also know whether the span id is duplicated or not.
    final ByteBuffer spanId = ByteBuffer.wrap(Bytes.toBytes(spanBo.getSpanId()));
    final List<AnnotationBo> annotations = spanBo.getAnnotationBoList();
    if (CollectionUtils.isNotEmpty(annotations)) {
        ByteBuffer bytes = writeAnnotationList(annotations);
        final long acceptedTime = put.getTimeStamp();
        put.addColumn(TRACES_CF_ANNOTATION, spanId, acceptedTime, bytes);
    }
}
Also used : AnnotationBo(com.navercorp.pinpoint.common.server.bo.AnnotationBo) ByteBuffer(java.nio.ByteBuffer)

Example 28 with AnnotationBo

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

the class AnnotationSerializer method writeAnnotationList.

// for test
public ByteBuffer writeAnnotationList(List<AnnotationBo> annotationList, Buffer buffer) {
    if (annotationList == null) {
        annotationList = Collections.emptyList();
    }
    final int size = annotationList.size();
    buffer.putVInt(size);
    for (AnnotationBo annotationBo : annotationList) {
        writeAnnotation(annotationBo, buffer);
    }
    return buffer.wrapByteBuffer();
}
Also used : AnnotationBo(com.navercorp.pinpoint.common.server.bo.AnnotationBo)

Example 29 with AnnotationBo

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

the class SpanEventSerializer method writeValue.

public ByteBuffer writeValue(SpanEventEncodingContext spanEventEncodingContext) {
    SpanEventBo spanEventBo = spanEventEncodingContext.getSpanEventBo();
    BasicSpan basicSpan = spanEventEncodingContext.getBasicSpan();
    final Buffer buffer = new AutomaticBuffer(512);
    buffer.putByte(spanEventBo.getVersion());
    buffer.putPrefixedString(basicSpan.getAgentId());
    buffer.putPrefixedString(basicSpan.getApplicationId());
    buffer.putVLong(basicSpan.getAgentStartTime());
    buffer.putVInt(spanEventBo.getStartElapsed());
    buffer.putVInt(spanEventBo.getEndElapsed());
    // don't need to put sequence because it is set at Qualifier
    // buffer.put(sequence);
    buffer.putPrefixedString(spanEventBo.getRpc());
    buffer.putShort(spanEventBo.getServiceType());
    buffer.putPrefixedString(spanEventBo.getEndPoint());
    buffer.putPrefixedString(spanEventBo.getDestinationId());
    buffer.putSVInt(spanEventBo.getApiId());
    buffer.putSVInt(spanEventBo.getDepth());
    buffer.putLong(spanEventBo.getNextSpanId());
    if (spanEventBo.hasException()) {
        buffer.putBoolean(true);
        buffer.putSVInt(spanEventBo.getExceptionId());
        buffer.putPrefixedString(spanEventBo.getExceptionMessage());
    } else {
        buffer.putBoolean(false);
    }
    final List<AnnotationBo> annotationBoList = spanEventBo.getAnnotationBoList();
    this.annotationSerializer.writeAnnotationList(annotationBoList, buffer);
    buffer.putSVInt(spanEventBo.getNextAsyncId());
    return buffer.wrapByteBuffer();
}
Also used : Buffer(com.navercorp.pinpoint.common.buffer.Buffer) AutomaticBuffer(com.navercorp.pinpoint.common.buffer.AutomaticBuffer) ByteBuffer(java.nio.ByteBuffer) AnnotationBo(com.navercorp.pinpoint.common.server.bo.AnnotationBo) BasicSpan(com.navercorp.pinpoint.common.server.bo.BasicSpan) AutomaticBuffer(com.navercorp.pinpoint.common.buffer.AutomaticBuffer) SpanEventBo(com.navercorp.pinpoint.common.server.bo.SpanEventBo)

Example 30 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, SpanEventBo firstSpanEvent, SpanDecodingContext decodingContext) {
    final byte version = buffer.readByte();
    if (version != 0) {
        throw new IllegalStateException("unknown version :" + version);
    }
    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, firstSpanEvent, decodingContext);
    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)

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