use of com.navercorp.pinpoint.common.server.bo.SpanEventBo in project pinpoint by naver.
the class TraceService method insertSpanChunk.
public void insertSpanChunk(final SpanChunkBo spanChunkBo) {
traceDao.insertSpanChunk(spanChunkBo);
final ServiceType applicationServiceType = getApplicationServiceType(spanChunkBo);
final List<SpanEventBo> spanEventList = spanChunkBo.getSpanEventBoList();
if (spanEventList != null) {
// TODO need to batch update later.
insertSpanEventList(spanEventList, applicationServiceType, spanChunkBo.getApplicationId(), spanChunkBo.getAgentId(), spanChunkBo.getEndPoint());
}
}
use of com.navercorp.pinpoint.common.server.bo.SpanEventBo in project pinpoint by naver.
the class SpanDecoderV0 method readNextSpanEvent.
private SpanEventBo readNextSpanEvent(final Buffer buffer, final SpanEventBo prev, SpanDecodingContext decodingContext) {
final SpanEventBo spanEventBo = new SpanEventBo();
final SpanEventBitField bitField = new SpanEventBitField(buffer.readShort());
switch(bitField.getStartElapsedEncodingStrategy()) {
case PREV_DELTA:
int startTimeDelta = buffer.readVInt();
int startTime = startTimeDelta + prev.getStartElapsed();
spanEventBo.setStartElapsed(startTime);
break;
case PREV_EQUALS:
spanEventBo.setStartElapsed(prev.getStartElapsed());
break;
default:
throw new IllegalStateException("unsupported SequenceEncodingStrategy");
}
spanEventBo.setEndElapsed(buffer.readVInt());
switch(bitField.getSequenceEncodingStrategy()) {
case PREV_DELTA:
int sequenceDelta = buffer.readVInt();
final int sequence = sequenceDelta + prev.getSequence();
spanEventBo.setSequence((short) sequence);
break;
case PREV_ADD1:
spanEventBo.setSequence((short) (prev.getSequence() + 1));
break;
default:
throw new IllegalStateException("unsupported SequenceEncodingStrategy");
}
switch(bitField.getDepthEncodingStrategy()) {
case RAW:
spanEventBo.setDepth(buffer.readSVInt());
break;
case PREV_EQUALS:
spanEventBo.setDepth(prev.getDepth());
break;
default:
throw new IllegalStateException("unsupported DepthEncodingStrategy");
}
switch(bitField.getServiceTypeEncodingStrategy()) {
case RAW:
spanEventBo.setServiceType(buffer.readShort());
break;
case PREV_EQUALS:
spanEventBo.setServiceType(prev.getServiceType());
break;
default:
throw new IllegalStateException("unsupported ServiceTypeEncodingStrategy");
}
spanEventBo.setApiId(buffer.readSVInt());
if (bitField.isSetRpc()) {
spanEventBo.setRpc(buffer.readPrefixedString());
}
if (bitField.isSetEndPoint()) {
spanEventBo.setEndPoint(buffer.readPrefixedString());
}
if (bitField.isSetDestinationId()) {
spanEventBo.setDestinationId(buffer.readPrefixedString());
}
if (bitField.isSetNextSpanId()) {
spanEventBo.setNextSpanId(buffer.readLong());
}
if (bitField.isSetHasException()) {
int exceptionId = buffer.readSVInt();
String exceptionMessage = buffer.readPrefixedString();
spanEventBo.setExceptionInfo(exceptionId, exceptionMessage);
}
if (bitField.isSetAnnotation()) {
List<AnnotationBo> annotationBoList = readAnnotationList(buffer, decodingContext);
spanEventBo.setAnnotationBoList(annotationBoList);
}
if (bitField.isSetNextAsyncId()) {
spanEventBo.setNextAsyncId(buffer.readSVInt());
}
if (bitField.isSetAsyncId()) {
spanEventBo.setAsyncId(buffer.readInt());
spanEventBo.setAsyncSequence((short) buffer.readVInt());
}
return spanEventBo;
}
use of com.navercorp.pinpoint.common.server.bo.SpanEventBo 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);
}
use of com.navercorp.pinpoint.common.server.bo.SpanEventBo in project pinpoint by naver.
the class CollectorGrpcSpanFactory method buildSpanChunkBo.
@Override
public SpanChunkBo buildSpanChunkBo(PSpanChunk pSpanChunk, Header header) {
final SpanChunkBo spanChunkBo = this.grpcBinder.bindSpanChunkBo(pSpanChunk, header);
final long acceptedTime = acceptedTimeService.getAcceptedTime();
spanChunkBo.setCollectorAcceptTime(acceptedTime);
final List<PSpanEvent> pSpanEventList = pSpanChunk.getSpanEventList();
List<SpanEventBo> spanEventList = buildSpanEventBoList(pSpanEventList);
spanChunkBo.addSpanEventBoList(spanEventList);
return spanChunkBo;
}
use of com.navercorp.pinpoint.common.server.bo.SpanEventBo in project pinpoint by naver.
the class GrpcSpanBinder method buildSpanEventBo.
// for test
public SpanEventBo buildSpanEventBo(PSpanEvent pSpanEvent, SpanEventBo prevSpanEvent) {
Objects.requireNonNull(pSpanEvent, "pSpanEvent");
final SpanEventBo spanEvent = new SpanEventBo();
bind(spanEvent, pSpanEvent, prevSpanEvent);
return spanEvent;
}
Aggregations