use of com.navercorp.pinpoint.common.server.bo.SpanEventBo in project pinpoint by naver.
the class SpanEncoderV0 method writeSpanEventList.
private void writeSpanEventList(Buffer buffer, List<SpanEventBo> spanEventBoList, SpanEncodingContext<?> encodingContext) {
if (CollectionUtils.isEmpty(spanEventBoList)) {
buffer.putVInt(0);
} else {
buffer.putVInt(spanEventBoList.size());
SpanEventBo prevSpanEvent = null;
for (SpanEventBo spanEventBo : spanEventBoList) {
if (prevSpanEvent == null) {
writeFirstSpanEvent(buffer, spanEventBo, encodingContext);
} else {
writeNextSpanEvent(buffer, spanEventBo, prevSpanEvent, encodingContext);
}
prevSpanEvent = spanEventBo;
}
}
}
use of com.navercorp.pinpoint.common.server.bo.SpanEventBo in project pinpoint by naver.
the class SpanEncoderV0 method encodeSpanColumnValue.
@Override
public ByteBuffer encodeSpanColumnValue(SpanEncodingContext<SpanBo> encodingContext) {
final SpanBo span = encodingContext.getValue();
final SpanBitFiled bitField = SpanBitFiled.build(span);
final Buffer buffer = new AutomaticBuffer(256);
final byte version = span.getRawVersion();
buffer.putByte(version);
// bit field
buffer.putByte(bitField.getBitField());
final short serviceType = span.getServiceType();
buffer.putShort(serviceType);
switch(bitField.getApplicationServiceTypeEncodingStrategy()) {
case PREV_EQUALS:
break;
case RAW:
buffer.putShort(span.getApplicationServiceType());
break;
default:
throw new IllegalStateException("applicationServiceType");
}
// buffer.put(spanID);
if (!bitField.isRoot()) {
buffer.putLong(span.getParentSpanId());
}
// prevSpanEvent coding
final long startTime = span.getStartTime();
final long startTimeDelta = span.getCollectorAcceptTime() - startTime;
buffer.putVLong(startTimeDelta);
buffer.putVInt(span.getElapsed());
buffer.putPrefixedString(span.getRpc());
buffer.putPrefixedString(span.getEndPoint());
buffer.putPrefixedString(span.getRemoteAddr());
buffer.putSVInt(span.getApiId());
// BIT flag
if (bitField.isSetErrorCode()) {
buffer.putInt(span.getErrCode());
}
if (bitField.isSetHasException()) {
buffer.putSVInt(span.getExceptionId());
buffer.putPrefixedString(span.getExceptionMessage());
}
if (bitField.isSetFlag()) {
buffer.putShort(span.getFlag());
}
if (bitField.isSetLoggingTransactionInfo()) {
buffer.putByte(span.getLoggingTransactionInfo());
}
buffer.putPrefixedString(span.getAcceptorHost());
if (bitField.isSetAnnotation()) {
List<AnnotationBo> annotationBoList = span.getAnnotationBoList();
writeAnnotationList(buffer, annotationBoList, encodingContext);
}
final List<SpanEventBo> spanEventBoList = span.getSpanEventBoList();
writeSpanEventList(buffer, spanEventBoList, encodingContext);
return buffer.wrapByteBuffer();
}
use of com.navercorp.pinpoint.common.server.bo.SpanEventBo in project pinpoint by naver.
the class SpanEncoderV0 method encodeSpanQualifier.
@Override
public ByteBuffer encodeSpanQualifier(SpanEncodingContext<SpanBo> encodingContext) {
final SpanBo spanBo = encodingContext.getValue();
final List<SpanEventBo> spanEventBoList = spanBo.getSpanEventBoList();
final SpanEventBo firstEvent = getFirstSpanEvent(spanEventBoList);
return encodeQualifier(TYPE_SPAN, spanBo, firstEvent, null);
}
use of com.navercorp.pinpoint.common.server.bo.SpanEventBo in project pinpoint by naver.
the class SpanDecoderV0 method readSpanEvent.
private List<SpanEventBo> readSpanEvent(Buffer buffer, SpanDecodingContext decodingContext, SpanEventFilter spanEventFilter) {
final int spanEventSize = buffer.readVInt();
if (spanEventSize <= 0) {
return new ArrayList<>();
}
final List<SpanEventBo> spanEventBoList = new ArrayList<>();
SpanEventBo prev = null;
for (int i = 0; i < spanEventSize; i++) {
SpanEventBo spanEvent;
if (i == 0) {
spanEvent = readFirstSpanEvent(buffer, decodingContext);
} else {
spanEvent = readNextSpanEvent(buffer, prev, decodingContext);
}
prev = spanEvent;
boolean accept = spanEventFilter.filter(spanEvent);
if (accept) {
spanEventBoList.add(spanEvent);
}
}
return spanEventBoList;
}
use of com.navercorp.pinpoint.common.server.bo.SpanEventBo 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;
}
Aggregations