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;
}
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);
}
}
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();
}
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();
}
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);
}
Aggregations